Bug 6859 - Binding generator v1 refactoring
[controller.git] / opendaylight / config / yang-jmx-generator-plugin / src / main / java / org / opendaylight / controller / config / yangjmxgenerator / plugin / ftl / TemplateFactory.java
index 294520b36389992edb75af3e0121c7232728496d..22201699119d85e937a7e801fea0ee9fc92638f5 100644 (file)
@@ -47,8 +47,8 @@ import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.Meth
 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.ParameterizedType;
+import org.opendaylight.mdsal.binding.model.api.Type;
 import org.opendaylight.yangtools.yang.binding.BindingMapping;
 
 public class TemplateFactory {
@@ -59,42 +59,42 @@ 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);
 
@@ -110,12 +110,12 @@ public class TemplateFactory {
     // 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 {
@@ -137,7 +137,7 @@ public class TemplateFactory {
     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";
@@ -152,14 +152,14 @@ public class TemplateFactory {
     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());
@@ -177,7 +177,7 @@ public class TemplateFactory {
 
     public static AbstractFactoryTemplate abstractFactoryTemplateFromMbe(
             final ModuleMXBeanEntry mbe) {
-        AbstractFactoryAttributesProcessor attrProcessor = new AbstractFactoryAttributesProcessor();
+        final AbstractFactoryAttributesProcessor attrProcessor = new AbstractFactoryAttributesProcessor();
         attrProcessor.processAttributes(mbe.getAttributes());
 
 
@@ -190,22 +190,22 @@ public class TemplateFactory {
 
     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);
         }
 
         boolean generateRuntime = false;
         String registratorFullyQualifiedName = null;
-        if (mbe.getRuntimeBeans() != null
+        if ((mbe.getRuntimeBeans() != null)
                 && !mbe.getRuntimeBeans().isEmpty()) {
             generateRuntime = true;
-            RuntimeBeanEntry rootEntry = RuntimeRegistratorFtlTemplate
+            final RuntimeBeanEntry rootEntry = RuntimeRegistratorFtlTemplate
                     .findRoot(mbe.getRuntimeBeans());
             registratorFullyQualifiedName = rootEntry
                     .getPackageName()
@@ -215,9 +215,9 @@ public class TemplateFactory {
                     .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,
@@ -241,9 +241,9 @@ public class TemplateFactory {
 
     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());
@@ -253,15 +253,15 @@ public class TemplateFactory {
 
     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
@@ -274,13 +274,13 @@ public class TemplateFactory {
 
     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;
@@ -288,7 +288,7 @@ public class TemplateFactory {
             if (returnType instanceof JavaAttribute) {
                 continue;
             }
-            if (returnType instanceof ListAttribute && returnType.getOpenType() instanceof SimpleType) {
+            if ((returnType instanceof ListAttribute) && (returnType.getOpenType() instanceof SimpleType)) {
                 continue;
             }
 
@@ -298,9 +298,9 @@ public class TemplateFactory {
         }
 
         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
@@ -325,13 +325,13 @@ public class TemplateFactory {
         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);
@@ -342,15 +342,15 @@ public class TemplateFactory {
 
         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 {
@@ -373,18 +373,18 @@ public class TemplateFactory {
             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) {
@@ -393,9 +393,9 @@ public class TemplateFactory {
                             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;
                             }
@@ -405,30 +405,30 @@ public class TemplateFactory {
                         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) {
@@ -436,8 +436,8 @@ public class TemplateFactory {
                         "        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" +
@@ -452,7 +452,7 @@ public class TemplateFactory {
             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(", ");
                 }
@@ -462,19 +462,19 @@ public class TemplateFactory {
             }
 
             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;
             }
         }
     }
@@ -484,15 +484,15 @@ public class TemplateFactory {
         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()) {
+                    if ((attributeIfc instanceof JavaAttribute) && ((JavaAttribute)attrEntry.getValue()).isIdentityRef()) {
                         returnType = serializeType(identityRefType);
                     }
 
@@ -502,20 +502,20 @@ public class TemplateFactory {
                                     + 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()
@@ -525,7 +525,7 @@ public class TemplateFactory {
         }
 
         List<MethodDeclaration> getMethods() {
-            return methods;
+            return this.methods;
         }
     }
 
@@ -534,17 +534,17 @@ public class TemplateFactory {
 
         @Override
         public String getPackageName() {
-            return IDENTITY_ATTRIBUTE_REF_CLASS.getPackage().getName();
+            return this.IDENTITY_ATTRIBUTE_REF_CLASS.getPackage().getName();
         }
 
         @Override
         public String getName() {
-            return IDENTITY_ATTRIBUTE_REF_CLASS.getSimpleName();
+            return this.IDENTITY_ATTRIBUTE_REF_CLASS.getSimpleName();
         }
 
         @Override
         public String getFullyQualifiedName() {
-            return IDENTITY_ATTRIBUTE_REF_CLASS.getName();
+            return this.IDENTITY_ATTRIBUTE_REF_CLASS.getName();
         }
     };
 
@@ -553,12 +553,12 @@ public class TemplateFactory {
         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(
@@ -569,7 +569,7 @@ public class TemplateFactory {
         }
 
         List<Field> getFields() {
-            return fields;
+            return this.fields;
         }
     }
 
@@ -592,16 +592,16 @@ public class TemplateFactory {
         }
 
         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();
@@ -619,9 +619,9 @@ public class TemplateFactory {
                 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) {
@@ -635,26 +635,26 @@ public class TemplateFactory {
                     }
                 }
 
-                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);
@@ -671,16 +671,16 @@ public class TemplateFactory {
                 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) {
@@ -690,11 +690,11 @@ public class TemplateFactory {
 
                 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);
@@ -706,11 +706,11 @@ public class TemplateFactory {
         }
 
         List<ModuleField> getModuleFields() {
-            return holder.moduleFields;
+            return this.holder.moduleFields;
         }
 
         List<MethodDefinition> getMethods() {
-            return holder.methods;
+            return this.holder.methods;
         }
 
     }
@@ -721,7 +721,7 @@ public class TemplateFactory {
             return true;
         }
         if(value instanceof ListAttribute) {
-            AttributeIfc innerAttribute = ((ListAttribute) value).getInnerAttribute();
+            final AttributeIfc innerAttribute = ((ListAttribute) value).getInnerAttribute();
             return needsDepResolver(innerAttribute);
         }
 
@@ -730,7 +730,7 @@ public class TemplateFactory {
 
     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]);
     }