def private Object generateConstructorFromIfc(Type impl) '''
«IF (impl instanceof GeneratedType)»
«IF impl.hasNonDefaultMethods»
- public «type.name»(«impl.fullyQualifiedName» arg) {
+ public «type.name»(«impl.importedName» arg) {
«printConstructorPropertySetter(impl)»
}
«ENDIF»
* Set fields from given grouping argument. Valid argument is instance of one of following types:
* <ul>
«FOR impl : type.getAllIfcs»
- * <li>«impl.fullyQualifiedName»</li>
+ * <li>«impl.importedName»</li>
«ENDFOR»
* </ul>
*
def private generateIfCheck(Type impl, List<Type> done) '''
«IF (impl instanceof GeneratedType && (impl as GeneratedType).hasNonDefaultMethods)»
«val implType = impl as GeneratedType»
- if (arg instanceof «implType.fullyQualifiedName») {
+ if (arg instanceof «implType.importedName») {
«printPropertySetter(implType)»
isValidArg = true;
}
«val ifc = implementedIfc as GeneratedType»
«FOR getter : ifc.nonDefaultMethods»
«IF BindingMapping.isGetterMethodName(getter.name) && !hasOverrideAnnotation(getter)»
- «printPropertySetter(getter, '''((«ifc.fullyQualifiedName»)arg).«getter.name»()''', getter.propertyNameFromGetter)»;
+ «printPropertySetter(getter, '''((«ifc.importedName»)arg).«getter.name»()''', getter.propertyNameFromGetter)»;
«ENDIF»
«ENDFOR»
«ENDIF»
if (Types.isListType(ownGetterType)) {
val itemType = (ownGetterType as ParameterizedType).actualTypeArguments.get(0)
return '''
- this._«propertyName» = «CODEHELPERS.importedName».checkListFieldCast(«itemType.fullyQualifiedName».class, "«propertyName»", «retrieveProperty»)'''
+ this._«propertyName» = «CODEHELPERS.importedName».checkListFieldCast(«itemType.importedName».class, "«propertyName»", «retrieveProperty»)'''
}
return '''
- this._«propertyName» = «CODEHELPERS.importedName».checkFieldCast(«ownGetter.returnType.fullyQualifiedName».class, "«propertyName»", «retrieveProperty»)'''
+ this._«propertyName» = «CODEHELPERS.importedName».checkFieldCast(«ownGetter.returnType.importedName».class, "«propertyName»", «retrieveProperty»)'''
}
private def List<Type> getBaseIfcs(GeneratedType type) {
private def List<String> toListOfNames(Collection<Type> types) {
val List<String> names = new ArrayList
for (type : types) {
- names.add(type.fullyQualifiedName)
+ names.add(type.importedName)
}
return names
}
private static final String TAB_CLOSING_METHOD_BRACE = TAB + CLOSING_METHOD_BRACE;
private static final String DTAB_CLOSING_METHOD_BRACE = DOUBLE_TAB + CLOSING_METHOD_BRACE;
- private static final String FOO_GRP_REF = "org.opendaylight.yang.gen.v1.mdsal426.norev.FooGrp";
- private static final String RESOLVED_LEAF_GRP_REF = "org.opendaylight.yang.gen.v1.mdsal426.norev.ResolvedLeafGrp";
+ private static final String FOO_GRP_REF = "FooGrp";
+ private static final String RESOLVED_LEAF_GRP_REF = "ResolvedLeafGrp";
private static final String UNRESOLVED_GROUPING_REF =
- "org.opendaylight.yang.gen.v1.mdsal426.norev.UnresolvedGrouping";
+ "UnresolvedGrouping";
private static final String ARG_AS_FOO_GRP = "((" + FOO_GRP_REF + ")arg)";
TAB_FIELDS_FROM_SIGNATURE,
DTAB_INIT_IS_VALID_ARG_FALSE,
doubleTab("if (arg instanceof " + FOO_GRP_REF + ") {"),
- tripleTab("this._leaf1 = CodeHelpers.checkFieldCast(java.lang.String.class, \"leaf1\", "
+ tripleTab("this._leaf1 = CodeHelpers.checkFieldCast(String.class, \"leaf1\", "
+ ARG_AS_FOO_GRP + ".getLeaf1());"),
- tripleTab("this._leafList1 = CodeHelpers.checkListFieldCast(java.lang.String.class, \"leafList1\", "
+ tripleTab("this._leafList1 = CodeHelpers.checkListFieldCast(String.class, \"leafList1\", "
+ ARG_AS_FOO_GRP + ".getLeafList1());"),
tripleTab("this._leaf2 = " + ARG_AS_FOO_GRP + ".getLeaf2();"),
TTAB_SET_IS_VALID_ARG_TRUE,
private static void barContBuilderConstructorFooGrpTest(final File file, final String content) {
FileSearchUtil.assertFileContainsConsecutiveLines(file, content,
tab("public BarContBuilder(" + FOO_GRP_REF + " arg) {"),
- doubleTab("this._leaf1 = CodeHelpers.checkFieldCast(java.lang.String.class, \"leaf1\", "
+ doubleTab("this._leaf1 = CodeHelpers.checkFieldCast(String.class, \"leaf1\", "
+ "arg.getLeaf1());"),
- doubleTab("this._leafList1 = CodeHelpers.checkListFieldCast(java.lang.String.class, \"leafList1\", "
+ doubleTab("this._leafList1 = CodeHelpers.checkListFieldCast(String.class, \"leafList1\", "
+ "arg.getLeafList1());"),
doubleTab(LEAF2_ASSIGNMENT),
TAB_CLOSING_METHOD_BRACE);
TAB_FIELDS_FROM_SIGNATURE,
DTAB_INIT_IS_VALID_ARG_FALSE,
doubleTab("if (arg instanceof " + UNRESOLVED_GROUPING_REF + ") {"),
- tripleTab("this._leaf1 = CodeHelpers.checkFieldCast(java.lang.Boolean.class, \"leaf1\", (("
+ tripleTab("this._leaf1 = CodeHelpers.checkFieldCast(Boolean.class, \"leaf1\", (("
+ UNRESOLVED_GROUPING_REF + ")arg).getLeaf1());"),
TTAB_SET_IS_VALID_ARG_TRUE,
DTAB_CLOSING_METHOD_BRACE,
private static void booleanContBuilderConstructorTest(final File file, final String content) {
FileSearchUtil.assertFileContainsConsecutiveLines(file, content,
tab("public BooleanContBuilder(" + UNRESOLVED_GROUPING_REF + " arg) {"),
- doubleTab("this._leaf1 = CodeHelpers.checkFieldCast(java.lang.Boolean.class, \"leaf1\", "
+ doubleTab("this._leaf1 = CodeHelpers.checkFieldCast(Boolean.class, \"leaf1\", "
+ "arg.getLeaf1());"),
TAB_CLOSING_METHOD_BRACE);
}