Author: rdonkin
Date: Tue May 10 08:10:35 2011
New Revision: 1101358
URL: http://svn.apache.org/viewvc?rev=1101358&view=rev
Log:
MAILETDOCS-3 Use enum for type.
Modified:
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetMatcherDescriptor.java
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetdocsMojo.java
Modified:
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java
URL:
http://svn.apache.org/viewvc/james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java?rev=1101358&r1=1101357&r2=1101358&view=diff
==============================================================================
---
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java
(original)
+++
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java
Tue May 10 08:10:35 2011
@@ -132,7 +132,7 @@ public class DefaultDescriptorsExtractor
result.setName(nextClass.getName());
result.setFullyQualifiedName(nameOfNextClass);
result.setClassDocs(nextClass.getComment());
- result.setType(MailetMatcherDescriptor.TYPE_MATCHER);
+ result.setType(MailetMatcherDescriptor.Type.MATCHER);
final Object instance = klass.newInstance();
final String info = (String) klass.getMethod(
@@ -156,7 +156,7 @@ public class DefaultDescriptorsExtractor
result.setName(nextClass.getName());
result.setFullyQualifiedName(nameOfNextClass);
result.setClassDocs(nextClass.getComment());
- result.setType(MailetMatcherDescriptor.TYPE_MAILET);
+ result.setType(MailetMatcherDescriptor.Type.MAILET);
final Object instance = klass.newInstance();
final String info = (String) klass.getMethod(
Modified:
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetMatcherDescriptor.java
URL:
http://svn.apache.org/viewvc/james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetMatcherDescriptor.java?rev=1101358&r1=1101357&r2=1101358&view=diff
==============================================================================
---
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetMatcherDescriptor.java
(original)
+++
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetMatcherDescriptor.java
Tue May 10 08:10:35 2011
@@ -24,9 +24,7 @@ package org.apache.james.mailet;
*/
public class MailetMatcherDescriptor {
- public final static int TYPE_MAILET = 1;
-
- public final static int TYPE_MATCHER = 2;
+ public enum Type {MAILET, MATCHER};
private String fqName;
@@ -36,7 +34,7 @@ public class MailetMatcherDescriptor {
private String classDocs;
- private int type;
+ private Type type;
public String getFullyQualifiedName() {
return fqName;
@@ -70,11 +68,11 @@ public class MailetMatcherDescriptor {
this.classDocs = classDocs;
}
- public int getType() {
+ public Type getType() {
return type;
}
- public void setType(int type) {
+ public void setType(Type type) {
this.type = type;
}
Modified:
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetdocsMojo.java
URL:
http://svn.apache.org/viewvc/james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetdocsMojo.java?rev=1101358&r1=1101357&r2=1101358&view=diff
==============================================================================
---
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetdocsMojo.java
(original)
+++
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetdocsMojo.java
Tue May 10 08:10:35 2011
@@ -72,14 +72,14 @@ public class MailetdocsMojo extends Abst
*/
private static final class TypePredicate implements Predicate {
- private int type;
+ private MailetMatcherDescriptor.Type type;
- public TypePredicate(int typeMatcher) {
+ public TypePredicate(MailetMatcherDescriptor.Type typeMatcher) {
this.type = typeMatcher;
}
- public boolean evaluate(Object arg0) {
- return ((MailetMatcherDescriptor) arg0).getType() == type;
+ public boolean evaluate(Object subject) {
+ return ((MailetMatcherDescriptor) subject).getType() == type;
}
}
@@ -107,10 +107,10 @@ public class MailetdocsMojo extends Abst
@SuppressWarnings("unchecked")
List<MailetMatcherDescriptor> matchers =
(List<MailetMatcherDescriptor>) CollectionUtils.select(descriptors,
- new TypePredicate(MailetMatcherDescriptor.TYPE_MATCHER));
+ new TypePredicate(MailetMatcherDescriptor.Type.MATCHER));
@SuppressWarnings("unchecked")
List<MailetMatcherDescriptor> mailets =
(List<MailetMatcherDescriptor>) CollectionUtils.select(descriptors,
- new TypePredicate(MailetMatcherDescriptor.TYPE_MAILET));
+ new TypePredicate(MailetMatcherDescriptor.Type.MAILET));
getSink().section1();
getSink().sectionTitle1();
@@ -202,9 +202,9 @@ public class MailetdocsMojo extends Abst
if (descriptors.get(i).getInfo() != null) {
getSink().paragraph();
- if (descriptors.get(i).getType() ==
MailetMatcherDescriptor.TYPE_MAILET) {
+ if (descriptors.get(i).getType() ==
MailetMatcherDescriptor.Type.MAILET) {
getSink().text("Mailet Info: ");
- } else if (descriptors.get(i).getType() ==
MailetMatcherDescriptor.TYPE_MATCHER) {
+ } else if (descriptors.get(i).getType() ==
MailetMatcherDescriptor.Type.MATCHER) {
getSink().text("Matcher Info: ");
} else {
getSink().text("Info: ");
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]