2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl;
10 import com.google.common.base.Function;
11 import com.google.common.base.Preconditions;
12 import com.google.common.collect.Collections2;
13 import com.google.common.collect.Lists;
14 import com.google.common.collect.Maps;
15 import org.opendaylight.controller.config.api.RuntimeBeanRegistratorAwareModule;
16 import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface;
17 import org.opendaylight.controller.config.api.runtime.RuntimeBean;
18 import org.opendaylight.controller.config.spi.Module;
19 import org.opendaylight.controller.config.yangjmxgenerator.AbstractEntry;
20 import org.opendaylight.controller.config.yangjmxgenerator.ModuleMXBeanEntry;
21 import org.opendaylight.controller.config.yangjmxgenerator.RuntimeBeanEntry;
22 import org.opendaylight.controller.config.yangjmxgenerator.RuntimeBeanEntry.Rpc;
23 import org.opendaylight.controller.config.yangjmxgenerator.ServiceInterfaceEntry;
24 import org.opendaylight.controller.config.yangjmxgenerator.attribute.*;
25 import org.opendaylight.controller.config.yangjmxgenerator.attribute.DependencyAttribute.Dependency;
26 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.*;
27 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.Annotation.Parameter;
28 import org.opendaylight.controller.config.yangjmxgenerator.plugin.util.FullyQualifiedNameHelper;
29 import org.opendaylight.yangtools.binding.generator.util.BindingGeneratorUtil;
30 import org.opendaylight.yangtools.sal.binding.model.api.Type;
32 import javax.management.openmbean.SimpleType;
34 import java.util.Map.Entry;
36 public class TemplateFactory {
38 public static Map<String, FtlTemplate> getFtlTemplates(
39 ModuleMXBeanEntry entry) {
40 Map<String, FtlTemplate> result = new HashMap<>();
42 result.putAll(TemplateFactory.tOsFromMbe(entry));
45 result.put(entry.getMXBeanInterfaceName() + ".java",
46 TemplateFactory.mXBeanInterfaceTemplateFromMbe(entry));
49 result.put(entry.getAbstractFactoryName() + ".java",
50 TemplateFactory.abstractFactoryTemplateFromMbe(entry));
53 result.put(entry.getAbstractModuleName() + ".java",
54 TemplateFactory.abstractModuleTemplateFromMbe(entry));
59 public static Map<String, FtlTemplate> getFtlStubTemplates(
60 ModuleMXBeanEntry entry) {
61 Map<String, FtlTemplate> result = new HashMap<>();
63 result.put(entry.getStubFactoryName() + ".java",
64 TemplateFactory.stubFactoryTemplateFromMbe(entry));
66 result.put(entry.getStubModuleName() + ".java",
67 TemplateFactory.stubModuleTemplateFromMbe(entry));
71 public static Map<String, FtlTemplate> getFtlTemplates(
72 ServiceInterfaceEntry entry) {
74 Map<String, FtlTemplate> result = new HashMap<>();
75 result.put(entry.getTypeName() + ".java",
76 TemplateFactory.serviceInterfaceFromSie(entry));
82 * Get map of file name as key, FtlFile instance representing runtime mx
83 * bean as value that should be persisted from this instance.
85 public static Map<String, FtlTemplate> getTOAndMXInterfaceFtlFiles(
86 RuntimeBeanEntry entry) {
87 Map<String, FtlTemplate> result = new HashMap<>();
88 { // create GeneralInterfaceFtlFile for runtime MXBean. Attributes will
89 // be transformed to getter methods
90 String mxBeanTypeName = entry.getJavaNameOfRuntimeMXBean();
91 List<String> extendedInterfaces = Arrays.asList(RuntimeBean.class
93 List<MethodDeclaration> methods = new ArrayList<>();
95 // convert attributes to getters
96 for (AttributeIfc attributeIfc : entry.getAttributes()) {
97 String returnType = null;
98 returnType = getReturnType(entry, attributeIfc);
99 String getterName = "get"
100 + attributeIfc.getUpperCaseCammelCase();
101 MethodDeclaration getter = new MethodDeclaration(returnType,
102 getterName, Collections.<Field> emptyList());
107 for (Rpc rpc : entry.getRpcs()) {
108 // convert JavaAttribute parameters into fields
109 List<Field> fields = new ArrayList<>();
110 for (JavaAttribute ja : rpc.getParameters()) {
111 Field field = new Field(Collections.<String> emptyList(),
112 ja.getType().getFullyQualifiedName(),
113 ja.getLowerCaseCammelCase());
116 MethodDeclaration operation = new MethodDeclaration(
117 getReturnType(entry, rpc.getReturnType()), rpc.getName(), fields);
118 methods.add(operation);
122 GeneralInterfaceTemplate runtimeMxBeanIfc = new GeneralInterfaceTemplate(
123 null, entry.getPackageName(), mxBeanTypeName,
124 extendedInterfaces, methods);
126 result.put(runtimeMxBeanIfc.getTypeDeclaration().getName()
127 + ".java", runtimeMxBeanIfc);
130 result.putAll(TemplateFactory.tOsFromRbe(entry));
135 private static String getReturnType(RuntimeBeanEntry entry, AttributeIfc attributeIfc) {
137 if (attributeIfc instanceof TypedAttribute) {
138 returnType = ((TypedAttribute) attributeIfc).getType()
139 .getFullyQualifiedName();
140 } else if (attributeIfc instanceof TOAttribute) {
141 String fullyQualifiedName = FullyQualifiedNameHelper
142 .getFullyQualifiedName(entry.getPackageName(),
143 attributeIfc.getUpperCaseCammelCase());
145 returnType = fullyQualifiedName;
146 } else if (attributeIfc instanceof ListAttribute) {
147 AttributeIfc innerAttr = ((ListAttribute) attributeIfc)
148 .getInnerAttribute();
150 String innerTpe = innerAttr instanceof TypedAttribute ? ((TypedAttribute) innerAttr)
151 .getType().getFullyQualifiedName()
152 : FullyQualifiedNameHelper.getFullyQualifiedName(
153 entry.getPackageName(),
154 attributeIfc.getUpperCaseCammelCase());
156 returnType = "java.util.List<" + innerTpe + ">";
157 } else if (attributeIfc == VoidAttribute.getInstance()) {
160 throw new UnsupportedOperationException(
161 "Attribute not supported: "
162 + attributeIfc.getClass());
167 public static GeneralInterfaceTemplate serviceInterfaceFromSie(
168 ServiceInterfaceEntry sie) {
170 List<String> extendedInterfaces = Lists
171 .newArrayList(AbstractServiceInterface.class.getCanonicalName());
172 if (sie.getBase().isPresent()) {
173 extendedInterfaces.add(sie.getBase().get().getFullyQualifiedName());
177 GeneralInterfaceTemplate sieTemplate = new GeneralInterfaceTemplate(
178 getHeaderFromEntry(sie), sie.getPackageName(),
179 sie.getTypeName(), extendedInterfaces,
180 Lists.<MethodDeclaration> newArrayList());
181 sieTemplate.setJavadoc(sie.getNullableDescription());
183 if (sie.getNullableDescription() != null)
184 sieTemplate.getAnnotations().add(
185 Annotation.createDescriptionAnnotation(sie
186 .getNullableDescription()));
187 sieTemplate.getAnnotations().add(Annotation.createSieAnnotation(sie.getQName(), sie.getExportedOsgiClassName
193 public static AbstractFactoryTemplate abstractFactoryTemplateFromMbe(
194 ModuleMXBeanEntry mbe) {
195 AbstractFactoryAttributesProcessor attrProcessor = new AbstractFactoryAttributesProcessor();
196 attrProcessor.processAttributes(mbe.getAttributes(),
197 mbe.getPackageName());
199 Collection<String> transformed = Collections2.transform(mbe
200 .getProvidedServices().keySet(),
201 new Function<String, String>() {
204 public String apply(String input) {
205 return input + ".class";
209 return new AbstractFactoryTemplate(getHeaderFromEntry(mbe),
210 mbe.getPackageName(), mbe.getAbstractFactoryName(),
211 mbe.getGloballyUniqueName(), mbe.getFullyQualifiedName(mbe
212 .getStubModuleName()), attrProcessor.getFields(),
213 Lists.newArrayList(transformed));
216 public static AbstractModuleTemplate abstractModuleTemplateFromMbe(
217 ModuleMXBeanEntry mbe) {
218 AbstractModuleAttributesProcessor attrProcessor = new AbstractModuleAttributesProcessor();
219 attrProcessor.processAttributes(mbe.getAttributes(),
220 mbe.getPackageName());
222 List<ModuleField> moduleFields = attrProcessor.getModuleFields();
223 List<String> implementedIfcs = Lists.newArrayList(
224 Module.class.getCanonicalName(),
225 mbe.getFullyQualifiedName(mbe.getMXBeanInterfaceName()));
227 for (String implementedService : mbe.getProvidedServices().keySet()) {
228 implementedIfcs.add(implementedService);
231 boolean generateRuntime = false;
232 String registratorFullyQualifiedName = null;
233 if (mbe.getRuntimeBeans() != null
234 && mbe.getRuntimeBeans().isEmpty() == false) {
235 generateRuntime = true;
236 RuntimeBeanEntry rootEntry = RuntimeRegistratorFtlTemplate
237 .findRoot(mbe.getRuntimeBeans());
238 registratorFullyQualifiedName = rootEntry
241 .concat(RuntimeRegistratorFtlTemplate.getJavaNameOfRuntimeRegistrator(rootEntry));
242 implementedIfcs.add(RuntimeBeanRegistratorAwareModule.class
243 .getCanonicalName());
246 AbstractModuleTemplate abstractModuleTemplate = new AbstractModuleTemplate(
247 getHeaderFromEntry(mbe), mbe.getPackageName(),
248 mbe.getAbstractModuleName(), implementedIfcs, moduleFields,
249 attrProcessor.getMethods(), generateRuntime,
250 registratorFullyQualifiedName);
252 if (mbe.getNullableDescription() != null)
253 abstractModuleTemplate.getAnnotations().add(
254 Annotation.createDescriptionAnnotation(mbe
255 .getNullableDescription()));
256 return abstractModuleTemplate;
259 public static StubFactoryTemplate stubFactoryTemplateFromMbe(
260 ModuleMXBeanEntry mbe) {
261 return new StubFactoryTemplate(getHeaderFromEntry(mbe),
262 mbe.getPackageName(), mbe.getStubFactoryName(),
263 mbe.getFullyQualifiedName(mbe.getAbstractFactoryName()),
264 mbe.getStubModuleName());
267 public static StubModuleTemplate stubModuleTemplateFromMbe(
268 ModuleMXBeanEntry mbe) {
269 return new StubModuleTemplate(getHeaderFromEntry(mbe),
270 mbe.getPackageName(), mbe.getStubModuleName(),
271 mbe.getFullyQualifiedName(mbe.getAbstractModuleName()));
274 public static GeneralInterfaceTemplate mXBeanInterfaceTemplateFromMbe(
275 ModuleMXBeanEntry mbe) {
276 MXBeanInterfaceAttributesProcessor attrProcessor = new MXBeanInterfaceAttributesProcessor();
277 attrProcessor.processAttributes(mbe.getAttributes(),
278 mbe.getPackageName());
279 GeneralInterfaceTemplate ifcTemplate = new GeneralInterfaceTemplate(
280 getHeaderFromEntry(mbe), mbe.getPackageName(),
281 mbe.getMXBeanInterfaceName(), Lists.<String> newArrayList(),
282 attrProcessor.getMethods());
283 ifcTemplate.setJavadoc(mbe.getNullableDescription());
287 public static Map<String, GeneralClassTemplate> tOsFromMbe(
288 ModuleMXBeanEntry mbe) {
289 Map<String, GeneralClassTemplate> retVal = Maps.newHashMap();
290 TOAttributesProcessor processor = new TOAttributesProcessor();
291 processor.processAttributes(mbe.getAttributes(), mbe.getPackageName());
292 for (org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.TemplateFactory.TOAttributesProcessor.TOInternal to : processor
294 List<Constructor> constructors = Lists.newArrayList();
295 constructors.add(new Constructor(to.getName(), "super();"));
297 Header header = getHeaderFromEntry(mbe);
300 new GeneralClassTemplate(header, mbe.getPackageName(), to
301 .getName(), Collections.<String> emptyList(),
302 Collections.<String> emptyList(), to.getFields(),
303 to.getMethods(), false, false, constructors));
308 public static Map<String, GeneralClassTemplate> tOsFromRbe(
309 RuntimeBeanEntry rbe) {
310 Map<String, GeneralClassTemplate> retVal = Maps.newHashMap();
311 TOAttributesProcessor processor = new TOAttributesProcessor();
312 Map<String, AttributeIfc> yangPropertiesToTypesMap = Maps.newHashMap(rbe.getYangPropertiesToTypesMap());
314 // Add TOs from output parameters
315 for (Rpc rpc : rbe.getRpcs()) {
316 AttributeIfc returnType = rpc.getReturnType();
318 if (returnType == VoidAttribute.getInstance())
320 if (returnType instanceof JavaAttribute)
322 if (returnType instanceof ListAttribute && returnType.getOpenType() instanceof SimpleType)
325 Preconditions.checkState(yangPropertiesToTypesMap.containsKey(returnType.getAttributeYangName()) == false,
326 "Duplicate TO %s for %s", returnType.getAttributeYangName(), rbe);
327 yangPropertiesToTypesMap.put(returnType.getAttributeYangName(), returnType);
330 processor.processAttributes(yangPropertiesToTypesMap, rbe.getPackageName());
331 for (org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.TemplateFactory.TOAttributesProcessor.TOInternal to : processor
333 List<Constructor> constructors = Lists.newArrayList();
334 constructors.add(new Constructor(to.getName(), "super();"));
339 new GeneralClassTemplate(null, rbe.getPackageName(), to
340 .getName(), Collections.<String> emptyList(),
341 Collections.<String> emptyList(), to.getFields(),
342 to.getMethods(), false, false, constructors));
347 private static Header getHeaderFromEntry(AbstractEntry mbe) {
348 return new Header(mbe.getYangModuleName(), mbe.getYangModuleLocalname());
351 // TODO refactor attribute processors
353 private static class TOAttributesProcessor {
355 private final List<TOInternal> tos = Lists.newArrayList();
357 void processAttributes(Map<String, AttributeIfc> attributes,
358 String packageName) {
359 for (Entry<String, AttributeIfc> attrEntry : attributes.entrySet()) {
360 AttributeIfc attributeIfc = attrEntry.getValue();
361 if (attributeIfc instanceof TOAttribute) {
362 createTOInternal(packageName, attributeIfc);
364 if (attributeIfc instanceof ListAttribute) {
365 AttributeIfc innerAttr = ((ListAttribute) attributeIfc)
366 .getInnerAttribute();
367 if (innerAttr instanceof TOAttribute) {
368 createTOInternal(packageName, innerAttr);
374 private void createTOInternal(String packageName,
375 AttributeIfc attributeIfc) {
376 String fullyQualifiedName = FullyQualifiedNameHelper
377 .getFullyQualifiedName(packageName, attributeIfc.getUpperCaseCammelCase());
379 String type = fullyQualifiedName;
380 String name = attributeIfc.getUpperCaseCammelCase();
381 Map<String, AttributeIfc> attrs = ((TOAttribute) attributeIfc)
382 .getCapitalizedPropertiesToTypesMap();
383 // recursive processing
384 processAttributes(attrs, packageName);
386 tos.add(new TOInternal(type, name, attrs, packageName));
389 List<TOInternal> getTOs() {
393 private static class TOInternal {
394 private final String type, name;
395 private List<Field> fields;
396 private List<MethodDefinition> methods;
398 public TOInternal(String type, String name,
399 Map<String, AttributeIfc> attrs, String packageName) {
403 processAttrs(attrs, packageName);
406 private void processAttrs(Map<String, AttributeIfc> attrs,
407 String packageName) {
408 fields = Lists.newArrayList();
409 methods = Lists.newArrayList();
411 for (Entry<String, AttributeIfc> attrEntry : attrs.entrySet()) {
412 String innerName = attrEntry.getKey();
413 String varName = BindingGeneratorUtil
414 .parseToValidParamName(attrEntry.getKey());
416 String fullyQualifiedName = null;
417 if (attrEntry.getValue() instanceof TypedAttribute) {
418 Type innerType = ((TypedAttribute) attrEntry.getValue())
420 fullyQualifiedName = innerType.getFullyQualifiedName();
421 } else if (attrEntry.getValue() instanceof ListAttribute) {
422 AttributeIfc innerAttr = ((ListAttribute) attrEntry
423 .getValue()).getInnerAttribute();
425 String innerTpe = innerAttr instanceof TypedAttribute ? ((TypedAttribute) innerAttr)
426 .getType().getFullyQualifiedName()
427 : FullyQualifiedNameHelper
428 .getFullyQualifiedName(packageName, attrEntry.getValue().getUpperCaseCammelCase());
430 fullyQualifiedName = "java.util.List<" + innerTpe + ">";
432 fullyQualifiedName = FullyQualifiedNameHelper
433 .getFullyQualifiedName(packageName, attrEntry.getValue().getUpperCaseCammelCase());
435 fields.add(new Field(fullyQualifiedName, varName));
437 String getterName = "get" + innerName;
438 MethodDefinition getter = new MethodDefinition(
439 fullyQualifiedName, getterName,
440 Collections.<Field> emptyList(), "return "
443 String setterName = "set" + innerName;
444 MethodDefinition setter = new MethodDefinition("void",
445 setterName, Lists.newArrayList(new Field(
446 fullyQualifiedName, varName)), "this."
447 + varName + " = " + varName + ";");
462 List<Field> getFields() {
466 List<MethodDefinition> getMethods() {
472 private static class MXBeanInterfaceAttributesProcessor {
473 private static final String STRING_FULLY_QUALIFIED_NAME = "java.util.List";
474 private final List<MethodDeclaration> methods = Lists.newArrayList();
476 void processAttributes(Map<String, AttributeIfc> attributes,
477 String packageName) {
478 for (Entry<String, AttributeIfc> attrEntry : attributes.entrySet()) {
480 AttributeIfc attributeIfc = attrEntry.getValue();
482 if (attributeIfc instanceof TypedAttribute) {
483 returnType = ((TypedAttribute) attributeIfc).getType()
484 .getFullyQualifiedName();
485 } else if (attributeIfc instanceof TOAttribute) {
486 String fullyQualifiedName = FullyQualifiedNameHelper
487 .getFullyQualifiedName(packageName, attributeIfc.getUpperCaseCammelCase());
489 returnType = fullyQualifiedName;
490 } else if (attributeIfc instanceof ListAttribute) {
491 String fullyQualifiedName = null;
493 AttributeIfc innerAttr = ((ListAttribute) attributeIfc)
494 .getInnerAttribute();
495 if (innerAttr instanceof JavaAttribute) {
496 fullyQualifiedName = ((JavaAttribute) innerAttr)
497 .getType().getFullyQualifiedName();
498 } else if (innerAttr instanceof TOAttribute) {
499 fullyQualifiedName = FullyQualifiedNameHelper
500 .getFullyQualifiedName(packageName, innerAttr.getUpperCaseCammelCase());
503 returnType = STRING_FULLY_QUALIFIED_NAME.concat("<")
504 .concat(fullyQualifiedName).concat(">");
506 throw new UnsupportedOperationException(
507 "Attribute not supported: "
508 + attributeIfc.getClass());
511 String getterName = "get"
512 + attributeIfc.getUpperCaseCammelCase();
513 MethodDeclaration getter = new MethodDeclaration(returnType,
514 getterName, Collections.<Field> emptyList());
516 String varName = BindingGeneratorUtil
517 .parseToValidParamName(attrEntry.getKey());
518 String setterName = "set"
519 + attributeIfc.getUpperCaseCammelCase();
520 MethodDeclaration setter = new MethodDeclaration("void",
521 setterName, Lists.newArrayList(new Field(returnType,
526 if (attributeIfc.getNullableDescription() != null) {
527 setter.setJavadoc(attrEntry.getValue()
528 .getNullableDescription());
533 List<MethodDeclaration> getMethods() {
538 private static class AbstractFactoryAttributesProcessor {
540 private final List<Field> fields = Lists.newArrayList();
541 private static final String STRING_FULLY_QUALIFIED_NAME = "java.util.List";
543 void processAttributes(Map<String, AttributeIfc> attributes,
544 String packageName) {
545 for (Entry<String, AttributeIfc> attrEntry : attributes.entrySet()) {
547 AttributeIfc attributeIfc = attrEntry.getValue();
549 if (attributeIfc instanceof TypedAttribute) {
550 type = ((TypedAttribute) attributeIfc).getType()
551 .getFullyQualifiedName();
552 } else if (attributeIfc instanceof TOAttribute) {
553 String fullyQualifiedName = FullyQualifiedNameHelper
554 .getFullyQualifiedName(packageName, attributeIfc.getUpperCaseCammelCase());
556 type = fullyQualifiedName;
557 } else if (attributeIfc instanceof ListAttribute) {
558 String fullyQualifiedName = null;
559 AttributeIfc innerAttr = ((ListAttribute) attributeIfc)
560 .getInnerAttribute();
561 if (innerAttr instanceof JavaAttribute) {
562 fullyQualifiedName = ((JavaAttribute) innerAttr)
563 .getType().getFullyQualifiedName();
564 } else if (innerAttr instanceof TOAttribute) {
565 fullyQualifiedName = FullyQualifiedNameHelper
566 .getFullyQualifiedName(packageName, innerAttr.getUpperCaseCammelCase());
569 type = STRING_FULLY_QUALIFIED_NAME.concat("<")
570 .concat(fullyQualifiedName).concat(">");
573 throw new UnsupportedOperationException(
574 "Attribute not supported: "
575 + attributeIfc.getClass());
578 fields.add(new Field(type, attributeIfc
579 .getUpperCaseCammelCase()));
583 List<Field> getFields() {
588 private static class AbstractModuleAttributesProcessor {
590 private static final String STRING_FULLY_QUALIFIED_NAME = "java.util.List";
592 private final List<ModuleField> moduleFields = Lists.newArrayList();
593 private final List<MethodDefinition> methods = Lists.newArrayList();
595 void processAttributes(Map<String, AttributeIfc> attributes,
596 String packageName) {
597 for (Entry<String, AttributeIfc> attrEntry : attributes.entrySet()) {
599 AttributeIfc attributeIfc = attrEntry.getValue();
601 if (attributeIfc instanceof TypedAttribute) {
602 type = ((TypedAttribute) attributeIfc).getType()
603 .getFullyQualifiedName();
604 } else if (attributeIfc instanceof TOAttribute) {
605 String fullyQualifiedName = FullyQualifiedNameHelper
606 .getFullyQualifiedName(packageName, attributeIfc.getUpperCaseCammelCase());
608 type = fullyQualifiedName;
609 } else if (attributeIfc instanceof ListAttribute) {
610 String fullyQualifiedName = null;
611 AttributeIfc innerAttr = ((ListAttribute) attributeIfc)
612 .getInnerAttribute();
613 if (innerAttr instanceof JavaAttribute) {
614 fullyQualifiedName = ((JavaAttribute) innerAttr)
615 .getType().getFullyQualifiedName();
616 } else if (innerAttr instanceof TOAttribute) {
617 fullyQualifiedName = FullyQualifiedNameHelper
618 .getFullyQualifiedName(packageName, innerAttr.getUpperCaseCammelCase());
621 type = STRING_FULLY_QUALIFIED_NAME.concat("<")
622 .concat(fullyQualifiedName).concat(">");
624 throw new UnsupportedOperationException(
625 "Attribute not supported: "
626 + attributeIfc.getClass());
629 boolean isDependency = false;
630 Dependency dependency = null;
631 Annotation overrideAnnotation = new Annotation("Override",
632 Collections.<Parameter> emptyList());
633 List<Annotation> annotations = Lists
634 .newArrayList(overrideAnnotation);
636 if (attributeIfc instanceof DependencyAttribute) {
638 dependency = ((DependencyAttribute) attributeIfc)
640 annotations.add(Annotation
641 .createRequireIfcAnnotation(dependency.getSie()));
644 String varName = BindingGeneratorUtil
645 .parseToValidParamName(attrEntry.getKey());
646 moduleFields.add(new ModuleField(type, varName, attributeIfc
647 .getUpperCaseCammelCase(), attributeIfc
648 .getNullableDefault(), isDependency, dependency));
650 String getterName = "get"
651 + attributeIfc.getUpperCaseCammelCase();
652 MethodDefinition getter = new MethodDefinition(type,
653 getterName, Collections.<Field> emptyList(),
654 Lists.newArrayList(overrideAnnotation), "return "
657 String setterName = "set"
658 + attributeIfc.getUpperCaseCammelCase();
660 if (attributeIfc.getNullableDescription() != null) {
661 annotations.add(Annotation
662 .createDescriptionAnnotation(attributeIfc.getNullableDescription()));
665 MethodDefinition setter = new MethodDefinition("void",
667 Lists.newArrayList(new Field(type, varName)),
668 annotations, "this." + varName + " = " + varName + ";");
669 setter.setJavadoc(attributeIfc.getNullableDescription());
676 List<ModuleField> getModuleFields() {
680 List<MethodDefinition> getMethods() {