val module = ctx.findModuleByNamespaceAndRevision(pathElement.namespace, pathElement.revision);
if (module !== null) {
var foundNode = module.getDataChildByName(pathElement)
- if(foundNode == null) {
+ if (foundNode === null) {
val child = nodes.last
if (child instanceof DataNodeContainer) {
val dataContNode = child as DataNodeContainer
foundNode = findNodeInChildNodes(pathElement, dataContNode.childNodes)
}
}
- if(foundNode != null) {
+ if (foundNode !== null) {
nodes.add(foundNode);
}
}
}
// find recursively
for(child : childNodes) {
- if(child instanceof ContainerSchemaNode) {
+ if (child instanceof ContainerSchemaNode) {
val foundChild = findNodeInChildNodes(findingNode, child.childNodes)
- if (foundChild != null)
+ if (foundChild !== null)
return foundChild;
- }
- else if(child instanceof ListSchemaNode) {
+ } else if (child instanceof ListSchemaNode) {
val foundChild = findNodeInChildNodes(findingNode, child.childNodes)
- if (foundChild != null)
+ if (foundChild !== null)
return foundChild;
}
}
for (name : path) {
if (parent instanceof DataNodeContainer) {
var SchemaNode node = parent.getDataChildByName(name)
- if (node == null && (parent instanceof Module)) {
+ if (node === null && (parent instanceof Module)) {
val notifications = (parent as Module).notifications;
for (notification : notifications) {
if (notification.QName.equals(name)) {
}
}
}
- if (node == null && (parent instanceof Module)) {
+ if (node === null && (parent instanceof Module)) {
val rpcs = (parent as Module).rpcs;
for (rpc : rpcs) {
if (rpc.QName.equals(name)) {
def CharSequence childInfo(DataSchemaNode node, Map<SchemaPath, DataSchemaNode> childNodes) '''
«val String path = nodeSchemaPathToPath(node, childNodes)»
- «IF path != null»
+ «IF path !== null»
«code(path)»
«IF node !== null»
<ul>
'''
def toLengthStmt(Collection<LengthConstraint> lengths) '''
- «IF lengths != null && !lengths.empty»
+ «IF lengths !== null && !lengths.empty»
«listItem("Length restrictions:")»
<ul>
«FOR length : lengths»
'''
def toRangeStmt(Collection<RangeConstraint> ranges) '''
- «IF ranges != null && !ranges.empty»
+ «IF ranges !== null && !ranges.empty»
«listItem("Range restrictions:")»
<ul>
«FOR range : ranges»
'''
def toBaseStmt(TypeDefinition<?> baseType) '''
- «IF baseType != null»
+ «IF baseType !== null»
«listItem("Base type", typeAnchorLink(baseType?.path, baseType.QName.localName))»
«ENDIF»
'''
<resource path="operations">
«FOR rpc : module.rpcs»
<resource path="«module.name»:«rpc.QName.localName»">
- «methodPostRpc(rpc.input != null, rpc.output !== null)»
+ «methodPostRpc(rpc.input !== null, rpc.output !== null)»
</resource>
«ENDFOR»
</resource>
private def resourceParams() '''
«FOR pathParam : pathListParams»
- «IF pathParam != null»
+ «IF pathParam !== null»
«val type = pathParam.type.QName.localName»
<param required="true" style="template" name="«pathParam.QName.localName»" type="«type»"/>
«ENDIF»
private static final Splitter NL_SPLITTER = Splitter.on(NL_MATCHER)
new(GeneratedType _type) {
- if (_type == null) {
+ if (_type === null) {
throw new IllegalArgumentException("Generated type reference cannot be NULL!")
}
this.type = _type;
* @return string with comment in JAVA format
*/
def protected CharSequence asJavadoc(String comment) {
- if(comment == null) return ''
+ if(comment === null) return ''
var txt = comment
txt = comment.trim
}
protected def formatToParagraph(String text) {
- if(text == null || text.isEmpty)
+ if(text === null || text.isEmpty)
return text
var formattedText = text
}
}
val GeneratedTransferObject parent = gto.superType
- if (parent != null) {
+ if (parent !== null) {
return findProperty(parent, name)
}
return null
* @param implementedIfcs list of implemented interfaces
*/
def private void collectImplementedMethods(Set<MethodSignature> methods, List<Type> implementedIfcs) {
- if (implementedIfcs == null || implementedIfcs.empty) {
+ if (implementedIfcs === null || implementedIfcs.empty) {
return
}
for (implementedIfc : implementedIfcs) {
* @return set of generated property instances which represents the getter <code>methods</code>
*/
def private propertiesFromMethods(Collection<MethodSignature> methods) {
- if (methods == null || methods.isEmpty()) {
+ if (methods === null || methods.isEmpty()) {
return Collections.emptySet
}
val Set<GeneratedProperty> result = new LinkedHashSet
for (m : methods) {
val createdField = m.propertyFromGetter
- if (createdField != null) {
+ if (createdField !== null) {
result.add(createdField)
}
}
* </ul>
*/
def private GeneratedProperty propertyFromGetter(MethodSignature method) {
- if (method == null || method.name == null || method.name.empty || method.returnType == null) {
+ if (method === null || method.name === null || method.name.empty || method.returnType === null) {
throw new IllegalArgumentException("Method, method name, method return type reference cannot be NULL or empty!")
}
var prefix = "get";
- if(Types.BOOLEAN.equals(method.returnType)) {
+ if (Types.BOOLEAN.equals(method.returnType)) {
prefix = "is";
}
if (method.name.startsWith(prefix)) {
'''
def private generateAugmentField(boolean isPrivate) '''
- «IF augmentField != null»
+ «IF augmentField !== null»
«IF isPrivate»private «ENDIF»«Map.importedName»<«Class.importedName»<? extends «augmentField.returnType.importedName»>, «augmentField.returnType.importedName»> «augmentField.name» = «Collections.importedName».emptyMap();
«ENDIF»
'''
«FOR field : properties SEPARATOR '\n'»
«/* FIXME: generate checkers as simple blocks and embed them directly in setters */»
«val restrictions = field.returnType.restrictions»
- «IF !(field.returnType instanceof GeneratedType) && restrictions != null»
+ «IF !(field.returnType instanceof GeneratedType) && restrictions !== null»
«IF !restrictions.rangeConstraints.nullOrEmpty»
«val rangeGenerator = AbstractRangeGenerator.forType(field.returnType)»
«rangeGenerator.generateRangeChecker(field.name.toFirstUpper, restrictions.rangeConstraints)»
«ENDIF»
«ENDIF»
public «type.name»«BUILDER» set«field.name.toFirstUpper»(final «field.returnType.importedName» value) {
- «IF !(field.returnType instanceof GeneratedType) && restrictions != null»
- «IF restrictions != null && (!restrictions.rangeConstraints.nullOrEmpty || !restrictions.lengthConstraints.nullOrEmpty)»
+ «IF !(field.returnType instanceof GeneratedType) && restrictions !== null»
+ «IF restrictions !== null && (!restrictions.rangeConstraints.nullOrEmpty || !restrictions.lengthConstraints.nullOrEmpty)»
if (value != null) {
«IF !restrictions.rangeConstraints.nullOrEmpty»
«val rangeGenerator = AbstractRangeGenerator.forType(field.returnType)»
return this;
}
«ENDFOR»
- «IF augmentField != null»
+ «IF augmentField !== null»
public «type.name»«BUILDER» add«augmentField.name.toFirstUpper»(«Class.importedName»<? extends «augmentField.returnType.importedName»> augmentationType, «augmentField.returnType.importedName» augmentation) {
if (augmentation == null) {
«val allProps = new ArrayList(properties)»
«val isList = implementsIfc(type, Types.parameterizedTypeFor(Types.typeForClass(Identifiable), type))»
«val keyType = type.getKey»
- «IF isList && keyType != null»
+ «IF isList && keyType !== null»
«val keyProps = new ArrayList((keyType as GeneratedTransferObject).properties)»
«Collections.sort(keyProps,
[ p1, p2 |
«FOR field : allProps»
this.«field.fieldName» = base.«field.getterMethodName»();
«ENDFOR»
- «IF augmentField != null»
+ «IF augmentField !== null»
«IF impl»
switch (base.«augmentField.name».size()) {
case 0:
toRemove = p;
}
}
- if (toRemove != null) {
+ if (toRemove !== null) {
props.remove(toRemove);
}
}
«field.getterMethod»
«ENDFOR»
«ENDIF»
- «IF augmentField != null»
+ «IF augmentField !== null»
@SuppressWarnings("unchecked")
«IF addOverride»@Override«ENDIF»
* @return string with the <code>hashCode()</code> method definition in JAVA format
*/
def protected generateHashCode() '''
- «IF !properties.empty || augmentField != null»
+ «IF !properties.empty || augmentField !== null»
private int hash = 0;
private volatile boolean hashValid = false;
result = prime * result + «Objects.importedName».hashCode(«property.fieldName»);
«ENDIF»
«ENDFOR»
- «IF augmentField != null»
+ «IF augmentField !== null»
result = prime * result + «Objects.importedName».hashCode(«augmentField.name»);
«ENDIF»
* @return string with the <code>equals()</code> method definition in JAVA format
*/
def protected generateEquals() '''
- «IF !properties.empty || augmentField != null»
+ «IF !properties.empty || augmentField !== null»
@Override
public boolean equals(«Object.importedName» obj) {
if (this == obj) {
return false;
}
«ENDFOR»
- «IF augmentField != null»
+ «IF augmentField !== null»
if (getClass() == obj.getClass()) {
// Simple case: we are comparing against self
«type.name»«IMPL» otherImpl = («type.name»«IMPL») obj;
builder.append(«property.fieldName»);
«ENDIF»
«ENDFOR»
- «IF augmentField != null»
+ «IF augmentField !== null»
«IF !properties.empty»
«««Append comma separator only if it's not there already from previous operation»»»
final int builderLength = builder.length();
this.consts = genType.constantDefinitions
this.enclosedGeneratedTypes = genType.enclosedTypes
- if (restrictions != null && !restrictions.rangeConstraints.nullOrEmpty) {
+ if (restrictions !== null && !restrictions.rangeConstraints.nullOrEmpty) {
rangeGenerator = AbstractRangeGenerator.forType(findProperty(genType, "value").returnType)
Preconditions.checkNotNull(rangeGenerator)
} else {
«constantsDeclarations»
«generateFields»
- «IF restrictions != null»
+ «IF restrictions !== null»
«IF !restrictions.lengthConstraints.nullOrEmpty»
«LengthGenerator.generateLengthChecker("_value", findProperty(genTO, "value").returnType, restrictions.lengthConstraints)»
«ENDIF»
ELSE»«
" "»«
ENDIF»class «type.name»«
- IF (genTO.superType != null)»«
+ IF (genTO.superType !== null)»«
" extends "»«genTO.superType.importedName»«
ENDIF»
«IF (!type.implements.empty)»«
'''
def protected suidDeclaration() '''
- «IF genTO.SUID != null»
+ «IF genTO.SUID !== null»
private static final long serialVersionUID = «genTO.SUID.value»L;
«ENDIF»
'''
def protected annotationDeclaration() '''
- «IF genTO.getAnnotations != null»
+ «IF genTO.getAnnotations !== null»
«FOR e : genTO.getAnnotations»
@«e.getName»
«ENDFOR»
*/
new(GeneratedType genType) {
super(genType)
- if (genType == null) {
+ if (genType === null) {
throw new IllegalArgumentException("Generated type reference cannot be NULL!")
}
def private generateAnnotations(List<AnnotationType> annotations) '''
- «IF annotations != null && !annotations.empty»
+ «IF annotations !== null && !annotations.empty»
«FOR annotation : annotations»
@«annotation.importedName»
- «IF annotation.parameters != null && !annotation.parameters.empty»
+ «IF annotation.parameters !== null && !annotation.parameters.empty»
(
«FOR param : annotation.parameters SEPARATOR ","»
«param.name»=«param.value»
for (property : finalProperties) {
val propRet = property.returnType
if (propRet instanceof GeneratedTransferObject && (propRet as GeneratedTransferObject).typedef &&
- (propRet as GeneratedTransferObject).properties != null &&
+ (propRet as GeneratedTransferObject).properties !== null &&
!(propRet as GeneratedTransferObject).properties.empty &&
((propRet as GeneratedTransferObject).properties.size == 1) &&
(propRet as GeneratedTransferObject).properties.get(0).name.equals("value") &&
«field.fieldName» = «property.fieldName».getValue();
«ELSEIF propRet instanceof GeneratedTransferObject // Is it a GeneratedTransferObject
&& (propRet as GeneratedTransferObject).typedef // Is it a typedef
- && (propRet as GeneratedTransferObject).properties != null
+ && (propRet as GeneratedTransferObject).properties !== null
&& !(propRet as GeneratedTransferObject).properties.empty
&& ((propRet as GeneratedTransferObject).properties.size == 1)
&& (propRet as GeneratedTransferObject).properties.get(0).name.equals("value")
«field.fieldName» = «property.fieldName».isValue().toString().toCharArray();
«ELSEIF propRet instanceof GeneratedTransferObject // Is it a GeneratedTransferObject
&& (propRet as GeneratedTransferObject).typedef // Is it a typedef
- && (propRet as GeneratedTransferObject).properties != null
+ && (propRet as GeneratedTransferObject).properties !== null
&& !(propRet as GeneratedTransferObject).properties.empty
&& ((propRet as GeneratedTransferObject).properties.size == 1)
&& (propRet as GeneratedTransferObject).properties.get(0).name.equals("value")
«FOR imp : m.imports»
«val name = imp.moduleName»
«val rev = imp.revision»
- «IF rev == null»
+ «IF rev === null»
«val Set<Module> modules = ctx.modules»
«val TreeMap<Date, Module> sorted = new TreeMap()»
«FOR module : modules»
}
if (type instanceof ParameterizedType) {
val Type[] params = type.getActualTypeArguments()
- if (params != null) {
+ if (params !== null) {
for (Type param : params) {
putTypeIntoImports(param);
}
}
final def String getParameters(Type[] pTypes) {
- if (pTypes == null || pTypes.length == 0) {
+ if (pTypes === null || pTypes.length == 0) {
return "?";
}
val StringBuilder builder = new StringBuilder();