Use 'newInstance' as name for static factory methods
This commit is contained in:
parent
84cef1d8b1
commit
411ec0ec34
8 changed files with 16 additions and 16 deletions
|
@ -20,7 +20,7 @@ public class MimeMultipart extends Multipart {
|
|||
private final String boundary;
|
||||
|
||||
|
||||
public static MimeMultipart createMimeMultipart() {
|
||||
public static MimeMultipart newInstance() {
|
||||
String boundary = BoundaryGenerator.getInstance().generateBoundary();
|
||||
return new MimeMultipart(boundary);
|
||||
}
|
||||
|
|
|
@ -986,7 +986,7 @@ class ImapFolder extends Folder<ImapMessage> {
|
|||
/*
|
||||
* This is a multipart/*
|
||||
*/
|
||||
MimeMultipart mp = MimeMultipart.createMimeMultipart();
|
||||
MimeMultipart mp = MimeMultipart.newInstance();
|
||||
for (int i = 0, count = bs.size(); i < count; i++) {
|
||||
if (bs.get(i) instanceof ImapList) {
|
||||
/*
|
||||
|
|
|
@ -717,11 +717,11 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
return null;
|
||||
}
|
||||
|
||||
PgpMessageBuilder pgpBuilder = PgpMessageBuilder.createPgpMessageBuilder();
|
||||
PgpMessageBuilder pgpBuilder = PgpMessageBuilder.newInstance();
|
||||
recipientPresenter.builderSetProperties(pgpBuilder);
|
||||
builder = pgpBuilder;
|
||||
} else {
|
||||
builder = SimpleMessageBuilder.createSimpleMessageBuilder();
|
||||
builder = SimpleMessageBuilder.newInstance();
|
||||
}
|
||||
|
||||
builder.setSubject(mSubjectView.getText().toString())
|
||||
|
|
|
@ -49,7 +49,7 @@ public class PgpMessageBuilder extends MessageBuilder {
|
|||
private boolean opportunisticSecondPass;
|
||||
|
||||
|
||||
public static PgpMessageBuilder createPgpMessageBuilder() {
|
||||
public static PgpMessageBuilder newInstance() {
|
||||
Context context = Globals.getContext();
|
||||
MessageIdGenerator messageIdGenerator = MessageIdGenerator.getInstance();
|
||||
BoundaryGenerator boundaryGenerator = BoundaryGenerator.getInstance();
|
||||
|
|
|
@ -14,7 +14,7 @@ import com.fsck.k9.mail.internet.MimeMessage;
|
|||
|
||||
public class SimpleMessageBuilder extends MessageBuilder {
|
||||
|
||||
public static SimpleMessageBuilder createSimpleMessageBuilder() {
|
||||
public static SimpleMessageBuilder newInstance() {
|
||||
Context context = Globals.getContext();
|
||||
MessageIdGenerator messageIdGenerator = MessageIdGenerator.getInstance();
|
||||
BoundaryGenerator boundaryGenerator = BoundaryGenerator.getInstance();
|
||||
|
|
|
@ -55,7 +55,7 @@ public class MessageDecryptVerifierTest {
|
|||
@Test
|
||||
public void findEncryptedPartsShouldReturnEmptyEncryptedPart() throws Exception {
|
||||
MimeMessage message = new MimeMessage();
|
||||
MimeMultipart multipartEncrypted = MimeMultipart.createMimeMultipart();
|
||||
MimeMultipart multipartEncrypted = MimeMultipart.newInstance();
|
||||
multipartEncrypted.setSubType("encrypted");
|
||||
MimeMessageHelper.setBody(message, multipartEncrypted);
|
||||
setContentTypeWithProtocol(message, MIME_TYPE_MULTIPART_ENCRYPTED, PROTCOL_PGP_ENCRYPTED);
|
||||
|
@ -69,11 +69,11 @@ public class MessageDecryptVerifierTest {
|
|||
@Test
|
||||
public void findEncryptedPartsShouldReturnMultipleEncryptedParts() throws Exception {
|
||||
MimeMessage message = new MimeMessage();
|
||||
MimeMultipart multipartMixed = MimeMultipart.createMimeMultipart();
|
||||
MimeMultipart multipartMixed = MimeMultipart.newInstance();
|
||||
multipartMixed.setSubType("mixed");
|
||||
MimeMessageHelper.setBody(message, multipartMixed);
|
||||
|
||||
MimeMultipart multipartEncryptedOne = MimeMultipart.createMimeMultipart();
|
||||
MimeMultipart multipartEncryptedOne = MimeMultipart.newInstance();
|
||||
multipartEncryptedOne.setSubType("encrypted");
|
||||
MimeBodyPart bodyPartOne = new MimeBodyPart(multipartEncryptedOne);
|
||||
setContentTypeWithProtocol(bodyPartOne, MIME_TYPE_MULTIPART_ENCRYPTED, PROTCOL_PGP_ENCRYPTED);
|
||||
|
@ -82,7 +82,7 @@ public class MessageDecryptVerifierTest {
|
|||
MimeBodyPart bodyPartTwo = new MimeBodyPart(null, "text/plain");
|
||||
multipartMixed.addBodyPart(bodyPartTwo);
|
||||
|
||||
MimeMultipart multipartEncryptedThree = MimeMultipart.createMimeMultipart();
|
||||
MimeMultipart multipartEncryptedThree = MimeMultipart.newInstance();
|
||||
multipartEncryptedThree.setSubType("encrypted");
|
||||
MimeBodyPart bodyPartThree = new MimeBodyPart(multipartEncryptedThree);
|
||||
setContentTypeWithProtocol(bodyPartThree, MIME_TYPE_MULTIPART_ENCRYPTED, PROTCOL_PGP_ENCRYPTED);
|
||||
|
@ -279,7 +279,7 @@ public class MessageDecryptVerifierTest {
|
|||
}
|
||||
|
||||
MimeBodyPart multipart(String type, BodyPart... subParts) throws MessagingException {
|
||||
MimeMultipart multiPart = MimeMultipart.createMimeMultipart();
|
||||
MimeMultipart multiPart = MimeMultipart.newInstance();
|
||||
multiPart.setSubType(type);
|
||||
for (BodyPart subPart : subParts) {
|
||||
multiPart.addBodyPart(subPart);
|
||||
|
|
|
@ -52,7 +52,7 @@ public class AttachmentResolverTest {
|
|||
|
||||
@Test
|
||||
public void buildCidMap__onMultipartWithNoParts__shouldReturnEmptyMap() throws Exception {
|
||||
Multipart multipartBody = MimeMultipart.createMimeMultipart();
|
||||
Multipart multipartBody = MimeMultipart.newInstance();
|
||||
Part multipartPart = new MimeBodyPart(multipartBody);
|
||||
|
||||
Map<String,Uri> result = AttachmentResolver.buildCidToAttachmentUriMap(attachmentInfoExtractor, multipartPart);
|
||||
|
@ -62,7 +62,7 @@ public class AttachmentResolverTest {
|
|||
|
||||
@Test
|
||||
public void buildCidMap__onMultipartWithEmptyBodyPart__shouldReturnEmptyMap() throws Exception {
|
||||
Multipart multipartBody = MimeMultipart.createMimeMultipart();
|
||||
Multipart multipartBody = MimeMultipart.newInstance();
|
||||
BodyPart bodyPart = spy(new MimeBodyPart());
|
||||
Part multipartPart = new MimeBodyPart(multipartBody);
|
||||
multipartBody.addBodyPart(bodyPart);
|
||||
|
@ -75,7 +75,7 @@ public class AttachmentResolverTest {
|
|||
|
||||
@Test
|
||||
public void buildCidMap__onTwoPart__shouldReturnBothUris() throws Exception {
|
||||
Multipart multipartBody = MimeMultipart.createMimeMultipart();
|
||||
Multipart multipartBody = MimeMultipart.newInstance();
|
||||
Part multipartPart = new MimeBodyPart(multipartBody);
|
||||
|
||||
BodyPart subPart1 = new MimeBodyPart();
|
||||
|
|
|
@ -151,7 +151,7 @@ public class MessageViewInfoExtractorTest {
|
|||
TextBody body2 = new TextBody(bodyText2);
|
||||
|
||||
// Create multipart/mixed part
|
||||
MimeMultipart multipart = MimeMultipart.createMimeMultipart();
|
||||
MimeMultipart multipart = MimeMultipart.newInstance();
|
||||
MimeBodyPart bodyPart1 = new MimeBodyPart(body1, "text/plain");
|
||||
MimeBodyPart bodyPart2 = new MimeBodyPart(body2, "text/plain");
|
||||
multipart.addBodyPart(bodyPart1);
|
||||
|
@ -209,7 +209,7 @@ public class MessageViewInfoExtractorTest {
|
|||
MimeMessageHelper.setBody(innerMessage, innerBody);
|
||||
|
||||
// Create multipart/mixed part
|
||||
MimeMultipart multipart = MimeMultipart.createMimeMultipart();
|
||||
MimeMultipart multipart = MimeMultipart.newInstance();
|
||||
MimeBodyPart bodyPart1 = new MimeBodyPart(textBody, "text/plain");
|
||||
MimeBodyPart bodyPart2 = new MimeBodyPart(innerMessage, "message/rfc822");
|
||||
bodyPart2.setHeader("Content-Disposition", "inline; filename=\"message.eml\"");
|
||||
|
|
Loading…
Reference in a new issue