import java.util.Collections\rimport java.util.Arrays
import org.opendaylight.yangtools.sal.binding.model.api.Restrictions
import com.google.common.collect.Range
+import java.util.regex.Pattern
/**\r
* Template for generating JAVA class. \r
\r
«generateEquals»\r
\r
- «generateToString»\r
+ «generateToString(genTO.toStringIdentifiers)»\r
\r
«generateGetLength»\r
\r
super(«parentProperties.asArguments»);\r
«ENDIF»\r
«FOR p : allProperties» \r
- «generateLengthRestrictions(type, p.fieldName.toString, p.returnType)»\r
+ «generateRestrictions(type, p.fieldName.toString, p.returnType)»\r
«ENDFOR»\r
«FOR p : properties» \r
this.«p.fieldName» = «p.fieldName»;\r
«IF false == parentProperties.empty»\r
super(«parentProperties.asArguments»);\r
«ENDIF»\r
- «generateLengthRestrictions(type, property.fieldName.toString, property.returnType)»\r
+ «generateRestrictions(type, property.fieldName.toString, property.returnType)»\r
this.«property.fieldName» = «property.name»;\r
«FOR p : other»\r
this.«p.fieldName» = null;\r
«val cValue = c.value»\r
«IF cValue instanceof List<?>»\r
«val cValues = cValue as List<?>»\r
- private static final List<Pattern> «Constants.MEMBER_PATTERN_LIST» = new ArrayList<Pattern>();\r
- public static final List<String> «TypeConstants.PATTERN_CONSTANT_NAME» = «Arrays.importedName».asList(«\r
+ private static final «List.importedName»<«Pattern.importedName»> «Constants.MEMBER_PATTERN_LIST» = new «ArrayList.importedName»<«Pattern.importedName»>();\r
+ public static final «List.importedName»<String> «TypeConstants.PATTERN_CONSTANT_NAME» = «Arrays.importedName».asList(«\r
FOR v : cValues SEPARATOR ", "»«\r
IF v instanceof String»"«\r
v as String»"«\r
«ENDIF»\r
'''\r
\r
- /**\r
- * Template method which generates the method <code>toString()</code>.\r
- *\r
- * @return string with the <code>toString()</code> method definition in JAVA format\r
- */\r
- def protected generateToString() '''\r
- «IF !genTO.toStringIdentifiers.empty»\r
- @Override\r
- public String toString() {\r
- StringBuilder builder = new StringBuilder();\r
- «val properties = genTO.toStringIdentifiers»\r
- builder.append("«type.name» [«properties.get(0).fieldName»=");\r
- «IF properties.get(0).returnType.name.contains("[")»\r
- builder.append(«Arrays.importedName».toString(«properties.get(0).fieldName»));\r
- «ELSE»\r
- builder.append(«properties.get(0).fieldName»);\r
- «ENDIF»\r
- «FOR i : 1..<genTO.toStringIdentifiers.size»\r
- builder.append(", «properties.get(i).fieldName»=");\r
- «IF properties.get(i).returnType.name.contains("[")»\r
- builder.append(«Arrays.importedName».toString(«properties.get(i).fieldName»));\r
- «ELSE»\r
- builder.append(«properties.get(i).fieldName»);\r
- «ENDIF»\r
- «ENDFOR»\r
- builder.append("]");\r
- return builder.toString();\r
- }\r
- «ENDIF»\r
- '''\r
-\r
def private generateGetLength() '''\r
«IF restrictions != null && !(restrictions.lengthConstraints.empty)»\r
public static «List.importedName»<«Range.importedName»<Integer>> getLength() {\r