Merge "Add support for identity-ref config attributes to config/netconf subsystem"
[controller.git] / opendaylight / config / yang-jmx-generator-plugin / src / main / java / org / opendaylight / controller / config / yangjmxgenerator / plugin / ftl / model / IdentityRefModuleField.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model;
9
10 import org.opendaylight.controller.config.api.IdentityAttributeRef;
11
12 public class IdentityRefModuleField extends ModuleField {
13
14     public static final String IDENTITY_CLASS_FIELD_SUFFIX = "IdentityClass";
15     private final String identityBaseClass;
16
17     public IdentityRefModuleField(String type, String name, String attributeName, String identityBaseClass) {
18         super(type, name, attributeName, null, false, null, false, false);
19         this.identityBaseClass = identityBaseClass;
20     }
21
22     public String getIdentityBaseClass() {
23         return identityBaseClass;
24     }
25
26     @Override
27     public boolean isIdentityRef() {
28         return true;
29     }
30
31     public String getType() {
32         return IdentityAttributeRef.class.getName();
33     }
34
35     public String getIdentityClassType() {
36         return super.getType();
37     }
38
39     public String getIdentityClassName() {
40         return addIdentityClassFieldSuffix(getName());
41     }
42
43     public static String addIdentityClassFieldSuffix(String prefix) {
44         return prefix + IDENTITY_CLASS_FIELD_SUFFIX;
45     }
46 }