final protected def getterMethod(GeneratedProperty field) {
'''
public «field.returnType.importedName» «field.getterMethodName»() {
+ «IF field.returnType.importedName.contains("[]")»
+ return Arrays.copyOf(«field.fieldName», «field.fieldName».length);
+ «ELSE»
return «field.fieldName»;
+ «ENDIF»
}
'''
}
return sb.toString
}
- def isDocumentationParametersNullOrEmtpy(GeneratedType type) {
- val boolean isTypeDescriptionNullOrEmpty = type.description.nullOrEmpty
- val boolean isTypeReferenceNullOrEmpty = type.reference.nullOrEmpty
- val boolean isTypeModuleNameNullOrEmpty = type.moduleName.nullOrEmpty
- val boolean isTypeSchemaPathNullOrEmpty = type.schemaPath.nullOrEmpty
-
- if (isTypeDescriptionNullOrEmpty && isTypeReferenceNullOrEmpty && isTypeModuleNameNullOrEmpty
- && isTypeSchemaPathNullOrEmpty) {
- return true
- }
- return false
- }
-
def generateRestrictions(Type type, String paramName, Type returnType) '''
«val restrictions = type.getRestrictions»
«IF restrictions !== null»
«ENDIF»
«FOR p : properties»
+ «IF p.returnType.importedName.contains("[]")»
+ this.«p.fieldName» = Arrays.copyOf(«p.fieldName», «p.fieldName».length);
+ «ELSE»
this.«p.fieldName» = «p.fieldName»;
+ «ENDIF»
«ENDFOR»
}
«ENDIF»
«IF !properties.empty»
«FOR f : properties»
- «IF f.readOnly»final«ENDIF» private «f.returnType.importedName» «f.fieldName»;
+ private«IF f.readOnly» final«ENDIF» «f.returnType.importedName» «f.fieldName»;
«ENDFOR»
«ENDIF»
'''
«type.name» defInst = «type.name»Builder.getDefaultInstance(defVal);
«FOR other : finalProperties»
«IF other.name.equals("value")»
+ «IF other.returnType.importedName.contains("[]")»
+ this.«other.fieldName» = Arrays.copyOf(«other.fieldName», «other.fieldName».length);
+ «ELSE»
this.«other.fieldName» = «other.fieldName»;
+ «ENDIF»
«ELSE»
this.«other.fieldName» = defInst.«other.fieldName»;
«ENDIF»
«ENDIF»
«IF !properties.empty»
«FOR p : properties»
+ «IF p.returnType.importedName.contains("[]")»
+ this.«p.fieldName» = Arrays.copyOf(source.«p.fieldName», source.«p.fieldName».length);
+ «ELSE»
this.«p.fieldName» = source.«p.fieldName»;
+ «ENDIF»
«ENDFOR»
«ENDIF»
}