prop.setCardinality(ad.getIntegerValue("cardinality", 0)); if (prop.getMultiValue() != null && prop.getCardinality() == 0) { prop.setUnbounded(PropertyUnbounded.ARRAY); prop.setCardinality(0);
prop.setUnbounded(PropertyUnbounded.DEFAULT); if ( cardinality != null ) { prop.setCardinality(Integer.valueOf(cardinality)); if ( prop.getCardinality() == Integer.MAX_VALUE ) { prop.setCardinality(0); prop.setUnbounded(PropertyUnbounded.ARRAY); } else if ( prop.getCardinality() == Integer.MIN_VALUE ) { prop.setCardinality(0); prop.setUnbounded(PropertyUnbounded.VECTOR);
/** Generates a property descriptor of type {@link PropertyType} */ private void generatePropertyDescriptor(final ClassAnnotation cad, final ClassDescription classDescription, final boolean metatype, final String propertyName, final String propertyDescriptorName, PropertyType propertyType, String label, String description, boolean isArray) { final PropertyDescription pd = new PropertyDescription(cad); pd.setName(propertyDescriptorName); pd.setLabel(label); pd.setDescription(description); pd.setType(propertyType); if(isArray) { final String[] values = (String[]) cad.getValue(propertyName); pd.setMultiValue(values); pd.setUnbounded(PropertyUnbounded.ARRAY); pd.setCardinality(Integer.MAX_VALUE); } else { final Object propertyVal = cad.getValue(propertyName); String pdValue = (propertyVal instanceof String) ? (String) propertyVal : propertyVal!=null ? propertyVal.toString() : null; pd.setValue(pdValue); pd.setUnbounded(PropertyUnbounded.DEFAULT); } if (!metatype) { pd.setPrivate(true); } classDescription.add(pd); }
@Override public AbstractDescription clone() { final PropertyDescription cd = new PropertyDescription(this.annotation); cd.setName(this.getName()); cd.setLabel(this.getLabel()); cd.setDescription(this.getDescription()); if ( this.getValue() != null ) { cd.setValue(this.getValue()); } else { cd.setMultiValue(this.getMultiValue()); } cd.setType(this.getType()); cd.setUnbounded(this.getUnbounded()); cd.setCardinality(this.getCardinality()); cd.setPrivate(this.isPrivate()); cd.setOptions(this.getOptions()); return cd; } }