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.model;
11 import org.opendaylight.controller.config.yangjmxgenerator.attribute.Dependency;
13 import java.util.ArrayList;
14 import java.util.Collections;
15 import java.util.List;
17 public class ModuleField extends Field {
19 private final String nullableDefault, attributeName;
20 private final boolean dependent;
21 private final Dependency dependency;
23 public ModuleField(List<String> modifiers, String type, String name,
24 String attributeName, String nullableDefault, boolean isDependency,
25 Dependency dependency) {
26 super(modifiers, type, name);
27 this.dependent = isDependency;
28 this.dependency = dependency;
29 this.attributeName = attributeName;
30 if (type.startsWith(List.class.getName()) && nullableDefault == null) {
31 String generics = type.substring(List.class.getName().length());
32 nullableDefault = "new " + ArrayList.class.getName() + generics + "()";
34 this.nullableDefault = nullableDefault;
37 public ModuleField(String type, String name, String attributeName,
38 String nullableDefault, boolean isDependency, Dependency dependency) {
39 this(Collections.<String> emptyList(), type, name, attributeName,
40 nullableDefault, isDependency, dependency);
43 public Dependency getDependency() {
47 public String getNullableDefault() {
48 return nullableDefault;
51 public boolean isDependent() {
55 public String getAttributeName() {