import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.MethodDefinition;
import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.ModuleField;
import org.opendaylight.controller.config.yangjmxgenerator.plugin.util.FullyQualifiedNameHelper;
-import org.opendaylight.yangtools.sal.binding.model.api.ParameterizedType;
-import org.opendaylight.yangtools.sal.binding.model.api.Type;
+import org.opendaylight.mdsal.binding.model.api.JavaTypeName;
+import org.opendaylight.mdsal.binding.model.api.ParameterizedType;
+import org.opendaylight.mdsal.binding.model.api.Type;
import org.opendaylight.yangtools.yang.binding.BindingMapping;
public class TemplateFactory {
*/
public static Map<String, FtlTemplate> getTOAndMXInterfaceFtlFiles(
final RuntimeBeanEntry entry) {
- Map<String, FtlTemplate> result = new HashMap<>();
+ final Map<String, FtlTemplate> result = new HashMap<>();
{ // create GeneralInterfaceFtlFile for runtime MXBean. Attributes will
// be transformed to getter methods
- String mxBeanTypeName = entry.getJavaNameOfRuntimeMXBean();
- List<String> extendedInterfaces = Collections.singletonList(RuntimeBean.class
+ final String mxBeanTypeName = entry.getJavaNameOfRuntimeMXBean();
+ final List<String> extendedInterfaces = Collections.singletonList(RuntimeBean.class
.getCanonicalName());
- List<MethodDeclaration> methods = new ArrayList<>();
+ final List<MethodDeclaration> methods = new ArrayList<>();
// convert attributes to getters
- for (AttributeIfc attributeIfc : entry.getAttributes()) {
+ for (final AttributeIfc attributeIfc : entry.getAttributes()) {
String returnType;
returnType = getReturnType(attributeIfc);
- String getterName = "get"
+ final String getterName = "get"
+ attributeIfc.getUpperCaseCammelCase();
- MethodDeclaration getter = new MethodDeclaration(returnType,
+ final MethodDeclaration getter = new MethodDeclaration(returnType,
getterName, Collections.<Field> emptyList());
methods.add(getter);
}
// add rpc methods
- for (Rpc rpc : entry.getRpcs()) {
+ for (final Rpc rpc : entry.getRpcs()) {
// convert JavaAttribute parameters into fields
- List<Field> fields = new ArrayList<>();
- for (JavaAttribute ja : rpc.getParameters()) {
- Field field = new Field(Collections.emptyList(),
+ final List<Field> fields = new ArrayList<>();
+ for (final JavaAttribute ja : rpc.getParameters()) {
+ final Field field = new Field(Collections.emptyList(),
ja.getType().getFullyQualifiedName(),
ja.getLowerCaseCammelCase(), ja.getNullableDefaultWrappedForCode());
fields.add(field);
}
- MethodDeclaration operation = new MethodDeclaration(
+ final MethodDeclaration operation = new MethodDeclaration(
getReturnType(rpc.getReturnType()), rpc.getName(), fields);
methods.add(operation);
}
// FIXME header
- GeneralInterfaceTemplate runtimeMxBeanIfc = new GeneralInterfaceTemplate(
+ final GeneralInterfaceTemplate runtimeMxBeanIfc = new GeneralInterfaceTemplate(
null, entry.getPackageName(), mxBeanTypeName,
extendedInterfaces, methods);
// FIXME: put into Type.toString
static String serializeType(final Type type, final boolean addWildcards) {
if (type instanceof ParameterizedType){
- ParameterizedType parameterizedType = (ParameterizedType) type;
- StringBuilder sb = new StringBuilder();
+ final ParameterizedType parameterizedType = (ParameterizedType) type;
+ final StringBuilder sb = new StringBuilder();
sb.append(parameterizedType.getRawType().getFullyQualifiedName());
sb.append(addWildcards ? "<? extends " : "<");
boolean first = true;
- for(Type parameter: parameterizedType.getActualTypeArguments()) {
+ for(final Type parameter: parameterizedType.getActualTypeArguments()) {
if (first) {
first = false;
} else {
private static String getReturnType(final AttributeIfc attributeIfc) {
String returnType;
if (attributeIfc instanceof TypedAttribute) {
- Type type = ((TypedAttribute) attributeIfc).getType();
+ final Type type = ((TypedAttribute) attributeIfc).getType();
returnType = serializeType(type);
} else if (attributeIfc == VoidAttribute.getInstance()) {
return "void";
public static GeneralInterfaceTemplate serviceInterfaceFromSie(
final ServiceInterfaceEntry sie) {
- List<String> extendedInterfaces = Lists
+ final List<String> extendedInterfaces = Lists
.newArrayList(AbstractServiceInterface.class.getCanonicalName());
if (sie.getBase().isPresent()) {
extendedInterfaces.add(sie.getBase().get().getFullyQualifiedName());
}
// FIXME header
- GeneralInterfaceTemplate sieTemplate = new GeneralInterfaceTemplate(
+ final GeneralInterfaceTemplate sieTemplate = new GeneralInterfaceTemplate(
getHeaderFromEntry(sie), sie.getPackageName(),
sie.getTypeName(), extendedInterfaces,
Lists.<MethodDeclaration> newArrayList());
public static AbstractFactoryTemplate abstractFactoryTemplateFromMbe(
final ModuleMXBeanEntry mbe) {
- AbstractFactoryAttributesProcessor attrProcessor = new AbstractFactoryAttributesProcessor();
+ final AbstractFactoryAttributesProcessor attrProcessor = new AbstractFactoryAttributesProcessor();
attrProcessor.processAttributes(mbe.getAttributes());
public static AbstractModuleTemplate abstractModuleTemplateFromMbe(
final ModuleMXBeanEntry mbe) {
- AbstractModuleAttributesProcessor attrProcessor = new AbstractModuleAttributesProcessor(mbe.getAttributes());
+ final AbstractModuleAttributesProcessor attrProcessor = new AbstractModuleAttributesProcessor(mbe.getAttributes());
- List<ModuleField> moduleFields = attrProcessor.getModuleFields();
- List<String> implementedIfcs = Lists.newArrayList(
+ final List<ModuleField> moduleFields = attrProcessor.getModuleFields();
+ final List<String> implementedIfcs = Lists.newArrayList(
mbe.getFullyQualifiedName(mbe.getMXBeanInterfaceName()));
- for (String implementedService : mbe.getProvidedServices().keySet()) {
+ for (final String implementedService : mbe.getProvidedServices().keySet()) {
implementedIfcs.add(implementedService);
}
if (mbe.getRuntimeBeans() != null
&& !mbe.getRuntimeBeans().isEmpty()) {
generateRuntime = true;
- RuntimeBeanEntry rootEntry = RuntimeRegistratorFtlTemplate
+ final RuntimeBeanEntry rootEntry = RuntimeRegistratorFtlTemplate
.findRoot(mbe.getRuntimeBeans());
registratorFullyQualifiedName = rootEntry
.getPackageName()
.getCanonicalName());
}
- List<String> extendedClasses = Collections.singletonList(AbstractModule.class.getCanonicalName() + "<" + mbe.getAbstractModuleName() + ">");
+ final List<String> extendedClasses = Collections.singletonList(AbstractModule.class.getCanonicalName() + "<" + mbe.getAbstractModuleName() + ">");
- AbstractModuleTemplate abstractModuleTemplate = new AbstractModuleTemplate(
+ final AbstractModuleTemplate abstractModuleTemplate = new AbstractModuleTemplate(
getHeaderFromEntry(mbe), mbe.getPackageName(),
mbe.getAbstractModuleName(), extendedClasses, implementedIfcs, moduleFields,
attrProcessor.getMethods(), generateRuntime,
public static GeneralInterfaceTemplate mXBeanInterfaceTemplateFromMbe(
final ModuleMXBeanEntry mbe) {
- MXBeanInterfaceAttributesProcessor attrProcessor = new MXBeanInterfaceAttributesProcessor();
+ final MXBeanInterfaceAttributesProcessor attrProcessor = new MXBeanInterfaceAttributesProcessor();
attrProcessor.processAttributes(mbe.getAttributes());
- GeneralInterfaceTemplate ifcTemplate = new GeneralInterfaceTemplate(
+ final GeneralInterfaceTemplate ifcTemplate = new GeneralInterfaceTemplate(
getHeaderFromEntry(mbe), mbe.getPackageName(),
mbe.getMXBeanInterfaceName(), Lists.<String> newArrayList(),
attrProcessor.getMethods());
public static Map<String, GeneralClassTemplate> tOsFromMbe(
final ModuleMXBeanEntry mbe) {
- Map<String, GeneralClassTemplate> retVal = Maps.newHashMap();
- TOAttributesProcessor processor = new TOAttributesProcessor();
+ final Map<String, GeneralClassTemplate> retVal = Maps.newHashMap();
+ final TOAttributesProcessor processor = new TOAttributesProcessor();
processor.processAttributes(mbe.getAttributes());
- for (org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.TemplateFactory.TOAttributesProcessor.TOInternal to : processor
+ for (final org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.TemplateFactory.TOAttributesProcessor.TOInternal to : processor
.getTOs()) {
- List<Constructor> constructors = Lists.newArrayList();
+ final List<Constructor> constructors = Lists.newArrayList();
constructors.add(new Constructor(to.getName(), "super();"));
- Header header = getHeaderFromEntry(mbe);
+ final Header header = getHeaderFromEntry(mbe);
retVal.put(
to.getType(),
new GeneralClassTemplate(header, mbe.getPackageName(), to
public static Map<String, GeneralClassTemplate> tOsFromRbe(
final RuntimeBeanEntry rbe) {
- Map<String, GeneralClassTemplate> retVal = Maps.newHashMap();
- TOAttributesProcessor processor = new TOAttributesProcessor();
- Map<String, AttributeIfc> yangPropertiesToTypesMap = Maps.newHashMap(rbe.getYangPropertiesToTypesMap());
+ final Map<String, GeneralClassTemplate> retVal = Maps.newHashMap();
+ final TOAttributesProcessor processor = new TOAttributesProcessor();
+ final Map<String, AttributeIfc> yangPropertiesToTypesMap = Maps.newHashMap(rbe.getYangPropertiesToTypesMap());
// Add TOs from output parameters
- for (Rpc rpc : rbe.getRpcs()) {
- AttributeIfc returnType = rpc.getReturnType();
+ for (final Rpc rpc : rbe.getRpcs()) {
+ final AttributeIfc returnType = rpc.getReturnType();
if (returnType == VoidAttribute.getInstance()) {
continue;
}
processor.processAttributes(yangPropertiesToTypesMap);
- for (org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.TemplateFactory.TOAttributesProcessor.TOInternal to : processor
+ for (final org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.TemplateFactory.TOAttributesProcessor.TOInternal to : processor
.getTOs()) {
- List<Constructor> constructors = Lists.newArrayList();
+ final List<Constructor> constructors = Lists.newArrayList();
constructors.add(new Constructor(to.getName(), "super();"));
// TODO header
private final List<TOInternal> tos = Lists.newArrayList();
void processAttributes(final Map<String, AttributeIfc> attributes) {
- for (Entry<String, AttributeIfc> attrEntry : attributes.entrySet()) {
- AttributeIfc attributeIfc = attrEntry.getValue();
+ for (final Entry<String, AttributeIfc> attrEntry : attributes.entrySet()) {
+ final AttributeIfc attributeIfc = attrEntry.getValue();
if (attributeIfc instanceof TOAttribute) {
createTOInternal((TOAttribute) attributeIfc);
}
if (attributeIfc instanceof ListAttribute) {
- AttributeIfc innerAttr = ((ListAttribute) attributeIfc)
+ final AttributeIfc innerAttr = ((ListAttribute) attributeIfc)
.getInnerAttribute();
if (innerAttr instanceof TOAttribute) {
createTOInternal((TOAttribute) innerAttr);
private void createTOInternal(final TOAttribute toAttribute) {
- Map<String, AttributeIfc> attrs = toAttribute.getCapitalizedPropertiesToTypesMap();
+ final Map<String, AttributeIfc> attrs = toAttribute.getCapitalizedPropertiesToTypesMap();
// recursive processing of TO's attributes
processAttributes(attrs);
- tos.add(new TOInternal(toAttribute.getType(), attrs));
+ this.tos.add(new TOInternal(toAttribute.getType(), attrs));
}
List<TOInternal> getTOs() {
- return tos;
+ return this.tos;
}
private static class TOInternal {
private final static String dependencyResolverInjectMethodName = "injectDependencyResolver";
private void processAttrs(final Map<String, AttributeIfc> attrs, final String packageName) {
- fields = Lists.newArrayList();
- methods = Lists.newArrayList();
+ this.fields = Lists.newArrayList();
+ this.methods = Lists.newArrayList();
// FIXME conflict if "dependencyResolver" field from yang
- Field depRes = new Field(DependencyResolver.class.getName(), dependencyResolverVarName);
- fields.add(depRes);
- methods.add(new MethodDefinition("void", dependencyResolverInjectMethodName, Lists.newArrayList(depRes),
+ final Field depRes = new Field(DependencyResolver.class.getName(), dependencyResolverVarName);
+ this.fields.add(depRes);
+ this.methods.add(new MethodDefinition("void", dependencyResolverInjectMethodName, Lists.newArrayList(depRes),
"this." + dependencyResolverVarName + " = " + dependencyResolverVarName + ";"));
- for (Entry<String, AttributeIfc> attrEntry : attrs.entrySet()) {
- String innerName = attrEntry.getKey();
- String varName = BindingMapping.getPropertyName(attrEntry.getKey());
+ for (final Entry<String, AttributeIfc> attrEntry : attrs.entrySet()) {
+ final String innerName = attrEntry.getKey();
+ final String varName = BindingMapping.getPropertyName(attrEntry.getKey());
String fullyQualifiedName, nullableDefault = null;
if (attrEntry.getValue() instanceof TypedAttribute) {
nullableDefault = ((JavaAttribute)attrEntry.getValue()).getNullableDefaultWrappedForCode();
if(((JavaAttribute)attrEntry.getValue()).isIdentityRef()) {
- String fieldType = serializeType(type, true);
- String innerType = getInnerTypeFromIdentity(type);
- methods.add(new MethodDefinition(fieldType, "resolve" + attrEntry.getKey(), Collections.<Field>emptyList(),
+ final String fieldType = serializeType(type, true);
+ final String innerType = getInnerTypeFromIdentity(type);
+ this.methods.add(new MethodDefinition(fieldType, "resolve" + attrEntry.getKey(), Collections.<Field>emptyList(),
"return " + varName + ".resolveIdentity(" + dependencyResolverVarName + "," + innerType + ".class);"));
type = identityRefType;
}
fullyQualifiedName = FullyQualifiedNameHelper
.getFullyQualifiedName(packageName, attrEntry.getValue().getUpperCaseCammelCase());
}
- fields.add(new Field(fullyQualifiedName, varName, nullableDefault, needsDepResolver(attrEntry.getValue())));
+ this.fields.add(new Field(fullyQualifiedName, varName, nullableDefault, needsDepResolver(attrEntry.getValue())));
- String getterName = "get" + innerName;
- MethodDefinition getter = new MethodDefinition(
+ final String getterName = "get" + innerName;
+ final MethodDefinition getter = new MethodDefinition(
fullyQualifiedName, getterName,
Collections.<Field> emptyList(), "return "
+ varName + ";");
- String setterName = "set" + innerName;
- MethodDefinition setter = new MethodDefinition("void",
+ final String setterName = "set" + innerName;
+ final MethodDefinition setter = new MethodDefinition("void",
setterName, Lists.newArrayList(new Field(
fullyQualifiedName, varName)), "this."
+ varName + " = " + varName + ";");
- methods.add(getter);
- methods.add(setter);
+ this.methods.add(getter);
+ this.methods.add(setter);
}
// Add hashCode
final MethodDefinition hashCode = getHash(attrs);
- methods.add(hashCode);
+ this.methods.add(hashCode);
// Add equals
final MethodDefinition equals = getEquals(attrs);
- methods.add(equals);
+ this.methods.add(equals);
}
private MethodDefinition getEquals(final Map<String, AttributeIfc> attrs) {
" if (this == o) { return true; }\n" +
" if (o == null || getClass() != o.getClass()) { return false; }\n");
equalsBodyBuilder.append(String.format(
- " final %s that = (%s) o;\n", name, name));
- for (AttributeIfc s : attrs.values()) {
+ " final %s that = (%s) o;\n", this.name, this.name));
+ for (final AttributeIfc s : attrs.values()) {
equalsBodyBuilder.append(String.format(
" if (!java.util.Objects.equals(%1$s, that.%1$s)) {\n" +
" return false;\n" +
private static MethodDefinition getHash(final Map<String, AttributeIfc> attrs) {
final StringBuilder hashBodyBuilder = new StringBuilder(
" return java.util.Objects.hash(");
- for (AttributeIfc s : attrs.values()) {
+ for (final AttributeIfc s : attrs.values()) {
hashBodyBuilder.append(s.getLowerCaseCammelCase());
hashBodyBuilder.append(", ");
}
}
String getType() {
- return fullyQualifiedName;
+ return this.fullyQualifiedName;
}
String getName() {
- return name;
+ return this.name;
}
List<Field> getFields() {
- return fields;
+ return this.fields;
}
List<MethodDefinition> getMethods() {
- return methods;
+ return this.methods;
}
}
}
private final List<MethodDeclaration> methods = Lists.newArrayList();
void processAttributes(final Map<String, AttributeIfc> attributes) {
- for (Entry<String, AttributeIfc> attrEntry : attributes.entrySet()) {
+ for (final Entry<String, AttributeIfc> attrEntry : attributes.entrySet()) {
String returnType;
- AttributeIfc attributeIfc = attrEntry.getValue();
+ final AttributeIfc attributeIfc = attrEntry.getValue();
if (attributeIfc instanceof TypedAttribute) {
- TypedAttribute typedAttribute = (TypedAttribute) attributeIfc;
+ final TypedAttribute typedAttribute = (TypedAttribute) attributeIfc;
returnType = serializeType(typedAttribute.getType());
if (attributeIfc instanceof JavaAttribute && ((JavaAttribute)attrEntry.getValue()).isIdentityRef()) {
+ attributeIfc.getClass());
}
- String getterName = "get"
+ final String getterName = "get"
+ attributeIfc.getUpperCaseCammelCase();
- MethodDeclaration getter = new MethodDeclaration(returnType,
+ final MethodDeclaration getter = new MethodDeclaration(returnType,
getterName, Collections.<Field> emptyList());
- String varName = BindingMapping.getPropertyName(attrEntry.getKey());
- String setterName = "set"
+ final String varName = BindingMapping.getPropertyName(attrEntry.getKey());
+ final String setterName = "set"
+ attributeIfc.getUpperCaseCammelCase();
- MethodDeclaration setter = new MethodDeclaration("void",
+ final MethodDeclaration setter = new MethodDeclaration("void",
setterName, Lists.newArrayList(new Field(returnType,
varName)));
- methods.add(getter);
- methods.add(setter);
+ this.methods.add(getter);
+ this.methods.add(setter);
if (attributeIfc.getNullableDescription() != null) {
setter.setJavadoc(attrEntry.getValue()
}
List<MethodDeclaration> getMethods() {
- return methods;
+ return this.methods;
}
}
private static final Type identityRefType = new Type() {
public final Class<IdentityAttributeRef> IDENTITY_ATTRIBUTE_REF_CLASS = IdentityAttributeRef.class;
+ private final JavaTypeName identifier = JavaTypeName.create(IDENTITY_ATTRIBUTE_REF_CLASS);
@Override
- public String getPackageName() {
- return IDENTITY_ATTRIBUTE_REF_CLASS.getPackage().getName();
- }
-
- @Override
- public String getName() {
- return IDENTITY_ATTRIBUTE_REF_CLASS.getSimpleName();
- }
-
- @Override
- public String getFullyQualifiedName() {
- return IDENTITY_ATTRIBUTE_REF_CLASS.getName();
+ public JavaTypeName getIdentifier() {
+ return identifier;
}
};
private final List<Field> fields = Lists.newArrayList();
void processAttributes(final Map<String, AttributeIfc> attributes) {
- for (AttributeIfc attributeIfc : attributes.values()) {
+ for (final AttributeIfc attributeIfc : attributes.values()) {
if (attributeIfc instanceof TypedAttribute) {
- TypedAttribute typedAttribute = (TypedAttribute) attributeIfc;
- String type = serializeType(typedAttribute.getType());
+ final TypedAttribute typedAttribute = (TypedAttribute) attributeIfc;
+ final String type = serializeType(typedAttribute.getType());
- fields.add(new Field(type, attributeIfc
+ this.fields.add(new Field(type, attributeIfc
.getUpperCaseCammelCase(), null));
} else {
throw new UnsupportedOperationException(
}
List<Field> getFields() {
- return fields;
+ return this.fields;
}
}
}
private static Holder processAttributes(final Map<String, AttributeIfc> attributes) {
- List<ModuleField> moduleFields = new ArrayList<>();
- List<MethodDefinition> methods = new ArrayList<>();
- for (Entry<String, AttributeIfc> attrEntry : attributes.entrySet()) {
+ final List<ModuleField> moduleFields = new ArrayList<>();
+ final List<MethodDefinition> methods = new ArrayList<>();
+ for (final Entry<String, AttributeIfc> attrEntry : attributes.entrySet()) {
String type, nullableDefaultWrapped = null;
- AttributeIfc attributeIfc = attrEntry.getValue();
+ final AttributeIfc attributeIfc = attrEntry.getValue();
boolean isIdentity = false;
- boolean needsDepResolver = needsDepResolver(attrEntry.getValue());
+ final boolean needsDepResolver = needsDepResolver(attrEntry.getValue());
if (attributeIfc instanceof TypedAttribute) {
- TypedAttribute typedAttribute = (TypedAttribute) attributeIfc;
+ final TypedAttribute typedAttribute = (TypedAttribute) attributeIfc;
type = serializeType(typedAttribute.getType());
if (attributeIfc instanceof JavaAttribute) {
nullableDefaultWrapped = ((JavaAttribute) attributeIfc).getNullableDefaultWrappedForCode();
boolean isDependency = false;
boolean isListOfDependencies = false;
Dependency dependency = null;
- Annotation overrideAnnotation = new Annotation("Override",
+ final Annotation overrideAnnotation = new Annotation("Override",
Collections.<Parameter> emptyList());
- List<Annotation> annotations = Lists
+ final List<Annotation> annotations = Lists
.newArrayList(overrideAnnotation);
if (attributeIfc instanceof AbstractDependencyAttribute) {
}
}
- String varName = BindingMapping.getPropertyName(attrEntry.getKey());
+ final String varName = BindingMapping.getPropertyName(attrEntry.getKey());
ModuleField field;
if (isIdentity) {
- String identityBaseClass = getInnerTypeFromIdentity(((TypedAttribute) attributeIfc).getType());
- IdentityRefModuleField identityField = new IdentityRefModuleField(type, varName,
+ final String identityBaseClass = getInnerTypeFromIdentity(((TypedAttribute) attributeIfc).getType());
+ final IdentityRefModuleField identityField = new IdentityRefModuleField(type, varName,
attributeIfc.getUpperCaseCammelCase(), identityBaseClass);
- String getterName = "get"
+ final String getterName = "get"
+ attributeIfc.getUpperCaseCammelCase() + "Identity";
- MethodDefinition additionalGetter = new MethodDefinition(type, getterName, Collections.<Field> emptyList(),
+ final MethodDefinition additionalGetter = new MethodDefinition(type, getterName, Collections.<Field> emptyList(),
Collections.<Annotation> emptyList(), "return " + identityField.getIdentityClassName()
+ ";");
methods.add(additionalGetter);
- String setterName = "set"
+ final String setterName = "set"
+ attributeIfc.getUpperCaseCammelCase();
- String setterBody = "this." + identityField.getIdentityClassName() + " = " + identityField.getIdentityClassName() + ";";
- MethodDefinition additionalSetter = new MethodDefinition("void",
+ final String setterBody = "this." + identityField.getIdentityClassName() + " = " + identityField.getIdentityClassName() + ";";
+ final MethodDefinition additionalSetter = new MethodDefinition("void",
setterName,
Lists.newArrayList(new Field(type, identityField.getIdentityClassName())),
Collections.<Annotation> emptyList(), setterBody);
moduleFields.add(field);
- String getterName = "get"
+ final String getterName = "get"
+ attributeIfc.getUpperCaseCammelCase();
- MethodDefinition getter = new MethodDefinition(type,
+ final MethodDefinition getter = new MethodDefinition(type,
getterName, Collections.<Field> emptyList(),
Lists.newArrayList(overrideAnnotation), "return "
+ varName + ";");
methods.add(getter);
- String setterName = "set"
+ final String setterName = "set"
+ attributeIfc.getUpperCaseCammelCase();
if (attributeIfc.getNullableDescription() != null) {
String setterBody = "this." + varName + " = " + varName + ";";
if (isListOfDependencies) {
- String nullCheck = String.format("if (%s == null) {\n%s = new java.util.ArrayList<>(); \n}%n",
+ final String nullCheck = String.format("if (%s == null) {\n%s = new java.util.ArrayList<>(); \n}%n",
varName, varName);
setterBody = nullCheck + setterBody;
}
- MethodDefinition setter = new MethodDefinition("void",
+ final MethodDefinition setter = new MethodDefinition("void",
setterName,
Lists.newArrayList(new Field(type, varName)),
annotations, setterBody);
}
List<ModuleField> getModuleFields() {
- return holder.moduleFields;
+ return this.holder.moduleFields;
}
List<MethodDefinition> getMethods() {
- return holder.methods;
+ return this.holder.methods;
}
}
return true;
}
if(value instanceof ListAttribute) {
- AttributeIfc innerAttribute = ((ListAttribute) value).getInnerAttribute();
+ final AttributeIfc innerAttribute = ((ListAttribute) value).getInnerAttribute();
return needsDepResolver(innerAttribute);
}
private static String getInnerTypeFromIdentity(final Type type) {
Preconditions.checkArgument(type instanceof ParameterizedType);
- Type[] args = ((ParameterizedType) type).getActualTypeArguments();
+ final Type[] args = ((ParameterizedType) type).getActualTypeArguments();
Preconditions.checkArgument(args.length ==1);
return serializeType(args[0]);
}