public String generateModelProvider() { return modelProviderTemplate.render(packageName, YangModelBindingProvider.class.getName(), YangModuleInfo.class .getName()).body(); }
@Override protected String body() { String importedName = importedName(String.class); return enumTemplate.render(enums, importedName).body(); }
protected String body() { /** * list of all imported names for template. */ final Map<String, String> importedNames = new HashMap<>(); importedNames.put("string", importedName(String.class)); importedNames.put("stringBuilder", importedName(StringBuilder.class)); importedNames.put("set", importedName(Set.class)); importedNames.put("hashSet", importedName(HashSet.class)); importedNames.put("collections", importedName(Collections.class)); importedNames.put("immutableSet", importedName(ImmutableSet.class)); importedNames.put("inputStream", importedName(InputStream.class)); importedNames.put("iOException", importedName(IOException.class)); importedNames.put("yangModuleInfo", importedName(YangModuleInfo.class)); importedNames.put("optional", importedName(Optional.class)); importedNames.put("semVer", importedName(SemVer.class)); importedNames.put("schemaSourceRepresentation", importedName(SchemaSourceRepresentation.class)); return yangModuleInfoTemplate.render(module, ctx, importedNames, moduleFilePathResolver).body(); }
protected String generateConstructors() { getImportedNames().put("constructorProperties", importedName(ConstructorProperties.class)); getImportedNames().put("preconditions", importedName(Preconditions.class)); final StringBuilder sb1 = new StringBuilder(); for (GeneratedProperty allProperty : allProperties) { sb1.append(classTemplateRestrictions.render(getType(), fieldName(allProperty), allProperty .getReturnType(), rangeGenerator).body()); } final String genRestrictions = sb1.toString(); final StringBuilder sb2 = new StringBuilder(); if (genTO.isUnionType()) { for (GeneratedProperty allProperty : allProperties) { final List other = new ArrayList<>(properties); if (other.remove(allProperty)) { sb2.append(classTemplateUnionConstr.render(getType(), parentProperties, allProperty, other, importedName(allProperty.getReturnType()), genRestrictions).body()); } } } final String unionConstructor = sb2.toString(); final String argumentsDeclaration = asArgumentsDeclaration(allProperties); return classTemplateConstructors.render(genTO, allProperties, properties, parentProperties, getImportedNames(), argumentsDeclaration, unionConstructor, genRestrictions).body(); }
protected String body() { // list of all imported names for template final Map<String, String> importedNames = new HashMap<>(); final Map<String, String> generatedParameters = new HashMap<>(); importedNames.put("unsupportedOperationException", importedName(UnsupportedOperationException.class)); for (MethodSignature methodSignature : genTO.getMethodDefinitions()) { importedNames.put(methodSignature.getName(), importedName(methodSignature.getReturnType())); generatedParameters.put(methodSignature.getName(), generateParameters(methodSignature.getParameters())); } return unionBuilderTemplate.render(genTO, getType().getName(), importedNames, generatedParameters).body(); } }
for (Enumeration enumeration : getType().getEnumerations()) { final String importedName = importedName(String.class); final String enumBody = enumTemplate.render(enumeration, importedName).body(); sb2.append(enumBody); this::importedName, true).body(); generatedConstants, generatedInnerClasses, identifier.getKey(), identifier.getValue()).body();
getProperties(), sb.toString()).body();
private String generateListForCopyConstructor() { final List allProps = new ArrayList<>(properties); final boolean isList = implementsIfc(getType(), Types.parameterizedTypeFor(typeForClass(Identifiable.class), getType())); final Type keyType = getKey(getType()); if (isList && keyType != null) { final List<GeneratedProperty> keyProps = ((GeneratedTransferObject) keyType).getProperties(); for (GeneratedProperty keyProp : keyProps) { removeProperty(allProps, keyProp.getName()); } removeProperty(allProps, "key"); getImportedNames().put("keyTypeConstructor", importedName(keyType)); return builderConstructorHelperTemplate.render(allProps, keyProps, getImportedNames(), getPropertyList(keyProps)).body(); } return builderConstructorHelperTemplate.render(allProps, null, getImportedNames(), null).body(); }