public CollectionMode onNonElement(CPropertyInfo p) { return p.isCollection() ? CollectionMode.REPEATED_ELEMENT : CollectionMode.NOT_REPEATED; }
public CollectionMode onNonElement(CPropertyInfo p) { return p.isCollection() ? CollectionMode.REPEATED_ELEMENT : CollectionMode.NOT_REPEATED; }
protected boolean isSingleField(PrincipalStrategy principalStrategy, FieldOutline fieldOutline, Options options) { return !fieldOutline.getPropertyInfo().isCollection(); }
@Override public boolean isCollection() { return this.fieldOutline.getPropertyInfo().isCollection(); }
public SingleEnumValueWrappingField(ClassOutlineImpl context, CPropertyInfo prop, CPropertyInfo core) { super(context, prop, core); // Single assert !core.isCollection(); // Builtin assert core.ref().size() == 1; assert core.ref().iterator().next() instanceof CEnumLeafInfo; this.enumType = (CEnumLeafInfo) core.ref().iterator().next(); this.enumClass = this.enumType.toType(context.parent(), Aspect.EXPOSED); }
public Collection<CPropertyInfo> process(ProcessModel context, CPropertyInfo propertyInfo) { // Single assert propertyInfo.isCollection(); final Collection<? extends CTypeInfo> types = context.getGetTypes().process(context, propertyInfo); // Builtin assert types.size() == 1; assert types.iterator().next() instanceof CEnumLeafInfo; return getCreatePropertyInfos(context, propertyInfo).process(context, propertyInfo); }
public Collection<CPropertyInfo> process(ProcessModel context, CPropertyInfo propertyInfo) { // Single assert !propertyInfo.isCollection(); final Collection<? extends CTypeInfo> types = context.getGetTypes().process( context, propertyInfo); // Builtin assert types.size() == 1; assert types.iterator().next() instanceof CEnumLeafInfo; return getCreatePropertyInfos(context, propertyInfo).process(context, propertyInfo); }
public SingleEnumValueWrappingField(ClassOutlineImpl context, CPropertyInfo prop, CPropertyInfo core) { super(context, prop, core); // Single assert !core.isCollection(); // Builtin assert core.ref().size() == 1; assert core.ref().iterator().next() instanceof CEnumLeafInfo; this.enumType = (CEnumLeafInfo) core.ref().iterator().next(); this.enumClass = this.enumType.toType(context.parent(), Aspect.EXPOSED); }
public Collection<CPropertyInfo> process(ProcessModel context, CPropertyInfo propertyInfo) { // Single assert !propertyInfo.isCollection(); final Collection<? extends CTypeInfo> types = context.getGetTypes().process( context, propertyInfo); // Builtin assert types.size() == 1; assert types.iterator().next() instanceof CEnumLeafInfo; return getCreatePropertyInfos(context, propertyInfo).process(context, propertyInfo); }
public Collection<CPropertyInfo> process(ProcessModel context, CPropertyInfo propertyInfo) { // Single assert propertyInfo.isCollection(); final Collection<? extends CTypeInfo> types = context.getGetTypes().process(context, propertyInfo); // Builtin assert types.size() == 1; assert types.iterator().next() instanceof CEnumLeafInfo; return getCreatePropertyInfos(context, propertyInfo).process(context, propertyInfo); }
@Override public boolean test(FieldOutline fieldOutline){ CPropertyInfo propertyInfo = fieldOutline.getPropertyInfo(); if(("extensions").equals(propertyInfo.getName(false)) && propertyInfo.isCollection()){ JType elementType = CodeModelUtil.getElementType(fieldOutline.getRawType()); return checkType(elementType, "org.dmg.pmml.Extension"); } return false; } };
@Override public boolean test(FieldOutline fieldOutline){ CPropertyInfo propertyInfo = fieldOutline.getPropertyInfo(); if(propertyInfo.isCollection()){ JType elementType = CodeModelUtil.getElementType(fieldOutline.getRawType()); String name = elementType.name(); return ((this.name).equals(name + "s") || (this.name).equals(JJavaName.getPluralForm(name))); } return false; } };
public static JType getElementType(final FieldOutline fieldOutline) { final JFieldVar definedField = PluginUtil.getDeclaredField(fieldOutline); if (definedField != null) { if (fieldOutline.getPropertyInfo().isCollection()) { return definedField.type().isArray() ? definedField.type().elementType() : ((JClass) definedField.type()).getTypeParameters().get(0); } else { return definedField.type(); } } else { return null; } }
ConstField( ClassOutlineImpl outline, CPropertyInfo prop ) { super(outline,prop); // we only support value constraints for a single-value property. assert !prop.isCollection(); JPrimitiveType ptype = implType.boxify().getPrimitiveType(); // generate the constant JExpression defaultValue = null; if(prop.defaultValue!=null) defaultValue = prop.defaultValue.compute(outline.parent()); $ref = outline.ref.field(JMod.PUBLIC|JMod.STATIC|JMod.FINAL, ptype!=null?ptype:implType, prop.getName(true), defaultValue ); $ref.javadoc().append(prop.javadoc); annotate($ref); }
ConstField( ClassOutlineImpl outline, CPropertyInfo prop ) { super(outline,prop); // we only support value constraints for a single-value property. assert !prop.isCollection(); JPrimitiveType ptype = implType.boxify().getPrimitiveType(); // generate the constant JExpression defaultValue = null; if(prop.defaultValue!=null) defaultValue = prop.defaultValue.compute(outline.parent()); $ref = outline.ref.field(JMod.PUBLIC|JMod.STATIC|JMod.FINAL, ptype!=null?ptype:implType, prop.getName(true), defaultValue ); $ref.javadoc().append(prop.javadoc); annotate($ref); }
ConstField( ClassOutlineImpl outline, CPropertyInfo prop ) { super(outline,prop); // we only support value constraints for a single-value property. assert !prop.isCollection(); JPrimitiveType ptype = implType.boxify().getPrimitiveType(); // generate the constant JExpression defaultValue = null; if(prop.defaultValue!=null) defaultValue = prop.defaultValue.compute(outline.parent()); $ref = outline.ref.field(JMod.PUBLIC|JMod.STATIC|JMod.FINAL, ptype!=null?ptype:implType, prop.getName(true), defaultValue ); $ref.javadoc().append(prop.javadoc); annotate($ref); }
ConstField( ClassOutlineImpl outline, CPropertyInfo prop ) { super(outline,prop); // we only support value constraints for a single-value property. assert !prop.isCollection(); JPrimitiveType ptype = implType.boxify().getPrimitiveType(); // generate the constant JExpression defaultValue = null; if(prop.defaultValue!=null) defaultValue = prop.defaultValue.compute(outline.parent()); $ref = outline.ref.field(JMod.PUBLIC|JMod.STATIC|JMod.FINAL, ptype!=null?ptype:implType, prop.getName(true), defaultValue ); $ref.javadoc().append(prop.javadoc); annotate($ref); }
ConstField( ClassOutlineImpl outline, CPropertyInfo prop ) { super(outline,prop); // we only support value constraints for a single-value property. assert !prop.isCollection(); JPrimitiveType ptype = implType.boxify().getPrimitiveType(); // generate the constant JExpression defaultValue = null; if(prop.defaultValue!=null) defaultValue = prop.defaultValue.compute(outline.parent()); $ref = outline.ref.field(JMod.PUBLIC|JMod.STATIC|JMod.FINAL, ptype!=null?ptype:implType, prop.getName(true), defaultValue ); $ref.javadoc().append(prop.javadoc); annotate($ref); }
private JVar addProperty(JDefinedClass clazz, FieldOutline field) { JType jType = getJavaType(field); if (field.getPropertyInfo().isCollection()) { return clazz.field(JMod.PRIVATE, jType, field.getPropertyInfo().getName(false), getNewCollectionExpression(field.parent().implClass.owner(), jType)); } else { return clazz.field(JMod.PRIVATE, jType, field.getPropertyInfo().getName(false)); } }
public void fromRawValue(JBlock block, String uniqueName, JExpression $var) { if (constantField != null) { } else if (setter != null) { block.invoke(targetObject, setter).arg($var); } else { unsetValues(block); if (fieldOutline.getPropertyInfo().isCollection()) { fieldAccessor.fromRawValue(block ._if($var.ne(JExpr._null()))._then(), uniqueName, $var); } else { fieldAccessor.fromRawValue(block, uniqueName, $var); } } }