import com.google.common.base.CharMatcher
import com.google.common.base.MoreObjects
import com.google.common.base.Splitter
+import com.google.common.collect.ImmutableMap
import com.google.common.collect.Iterables
+import java.math.BigInteger
import java.util.Collection
import java.util.List
import java.util.Locale
import org.opendaylight.mdsal.binding.spec.naming.BindingMapping
import org.opendaylight.yangtools.yang.binding.CodeHelpers
import org.opendaylight.yangtools.yang.common.QName
+import org.opendaylight.yangtools.yang.common.Uint8
+import org.opendaylight.yangtools.yang.common.Uint16
+import org.opendaylight.yangtools.yang.common.Uint32
+import org.opendaylight.yangtools.yang.common.Uint64
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode
import org.opendaylight.yangtools.yang.model.api.ListSchemaNode
import org.opendaylight.yangtools.yang.model.api.NotificationDefinition
.addIgnoredStatement(YangStmtMapping.ORGANIZATION)
.build();
+ protected static val UINT_TYPES = ImmutableMap.of(
+ Types.typeForClass(Uint8), Types.typeForClass(Short),
+ Types.typeForClass(Uint16), Types.typeForClass(Integer),
+ Types.typeForClass(Uint32), Types.typeForClass(Long),
+ Types.typeForClass(Uint64), Types.typeForClass(BigInteger)
+ );
+
new(GeneratedType type) {
super(type)
}
import static org.opendaylight.mdsal.binding.spec.naming.BindingMapping.AUGMENTATION_FIELD
import com.google.common.collect.ImmutableList
-import com.google.common.collect.ImmutableMap
-import java.math.BigInteger
import java.util.ArrayList
import java.util.Collection
import java.util.HashMap
import org.opendaylight.yangtools.yang.binding.AugmentationHolder
import org.opendaylight.yangtools.yang.binding.CodeHelpers
import org.opendaylight.yangtools.yang.binding.DataObject
-import org.opendaylight.yangtools.yang.common.Uint8
-import org.opendaylight.yangtools.yang.common.Uint16
-import org.opendaylight.yangtools.yang.common.Uint64
-import org.opendaylight.yangtools.yang.common.Uint32
/**
* Template for generating JAVA builder classes.
static val AUGMENTATION_FIELD_UPPER = AUGMENTATION_FIELD.toFirstUpper
- static val UINT_TYPES = ImmutableMap.of(
- Types.typeForClass(Uint8), Types.typeForClass(Short),
- Types.typeForClass(Uint16), Types.typeForClass(Integer),
- Types.typeForClass(Uint32), Types.typeForClass(Long),
- Types.typeForClass(Uint64), Types.typeForClass(BigInteger)
- );
-
/**
* Constructs new instance of this class.
* @throws IllegalArgumentException if <code>genType</code> equals <code>null</code>
def private generateSetter(GeneratedProperty field, Type actualType) '''
«val restrictions = restrictionsForSetter(actualType)»
«IF restrictions !== null»
+
«generateCheckers(field, restrictions, actualType)»
«ENDIF»
«val setterName = "set" + field.getName.toFirstUpper»
public «type.getName» «setterName»(final «field.returnType.importedName» value) {
- «IF restrictions !== null»
- if (value != null) {
- «checkArgument(field, restrictions, actualType, "value")»
- }
- «ENDIF»
+ «IF restrictions !== null»
+ if (value != null) {
+ «checkArgument(field, restrictions, actualType, "value")»
+ }
+ «ENDIF»
this.«field.fieldName.toString» = value;
return this;
}
«val uintType = UINT_TYPES.get(field.returnType)»
«IF uintType !== null»
- /**
- * Utility migration setter.
- *
- * @deprecated Use {#link «setterName»(«field.returnType.importedName»)} instead.
- */
- @Deprecated(forRemoval = true)
- public «type.getName» «setterName»(final «uintType.importedName» value) {
- return «setterName»(«CodeHelpers.importedName».compatUint(value));
- }
+ /**
+ * Utility migration setter.
+ *
+ * @param value field value in legacy type
+ * @deprecated Use {#link «setterName»(«field.returnType.importedName»)} instead.
+ */
+ @Deprecated(forRemoval = true)
+ public «type.getName» «setterName»(final «uintType.importedName» value) {
+ return «setterName»(«CodeHelpers.importedName».compatUint(value));
+ }
«ENDIF»
'''