You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2011/01/31 16:21:43 UTC
svn commit: r1065650 -
/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBinderImpl.java
Author: simonetripodi
Date: Mon Jan 31 15:21:42 2011
New Revision: 1065650
URL: http://svn.apache.org/viewvc?rev=1065650&view=rev
Log:
added setTop() method implementation
Modified:
commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBinderImpl.java
Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBinderImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBinderImpl.java?rev=1065650&r1=1065649&r2=1065650&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBinderImpl.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBinderImpl.java Mon Jan 31 15:21:42 2011
@@ -124,8 +124,48 @@ final class RulesBinderImpl implements R
return this;
}
- public ParamTypeBuilder<SetTopRule> setTop(String methodName) {
- return null;
+ /**
+ *
+ */
+ public ParamTypeBuilder<SetTopRule> setTop(final String methodName) {
+ if (methodName == null || methodName.length() == 0) {
+ addError("{forPattern(\"%s\").setTop(String)} empty 'methodName' not allowed", keyPattern);
+ }
+
+ return new ParamTypeBuilder<SetTopRule>() {
+
+ private boolean useExactMatch = false;
+
+ private String paramType;
+
+ public LinkedRuleBuilder then() {
+ return mainBuilder;
+ }
+
+ public ParamTypeBuilder<SetTopRule> useExactMatch(boolean useExactMatch) {
+ this.useExactMatch = useExactMatch;
+ return this;
+ }
+
+ public ParamTypeBuilder<SetTopRule> withParameterType(Class<?> paramType) {
+ if (paramType == null) {
+ addError("{forPattern(\"%s\").createObject().ofType(Class<?>)} NULL Java type not allowed",
+ keyPattern);
+ return this;
+ }
+ return this.withParameterType(paramType.getName());
+ }
+
+ public ParamTypeBuilder<SetTopRule> withParameterType(String paramType) {
+ this.paramType = paramType;
+ return this;
+ }
+
+ public SetTopRule get() {
+ return new SetTopRule(methodName, paramType, useExactMatch);
+ }
+
+ };
}
public ParamTypeBuilder<SetRootRule> setRoot(String methodName) {
@@ -193,7 +233,7 @@ final class RulesBinderImpl implements R
public ObjectCreateBuilder ofType(Class<?> type) {
if (type == null) {
- addError("{forPattern(\"%s\").createObject().ofType(Class<?>)} When specifying 'className', NULL Java type is not admitted",
+ addError("{forPattern(\"%s\").createObject().ofType(Class<?>)} NULL Java type not allowed",
keyPattern);
return this;
}