private ValueRepresentation getRepresentation(final PropertyDescriptor<?> descriptor, final Object value) { if (descriptor.isMultiValue()) { final List<?> val = (List<?>) value; if (val.isEmpty()) { return EmptySequence.getInstance(); } final Item[] converted = new Item[val.size()]; for (int i = 0; i < val.size(); i++) { converted[i] = getAtomicRepresentation(val.get(i)); } return new SequenceExtent(converted); } else { return getAtomicRepresentation(value); } }
private Element createPropertyDefinitionElementBR(PropertyDescriptor<?> propertyDescriptor) { final Element propertyElement = createPropertyValueElement(propertyDescriptor, propertyDescriptor.defaultValue()); propertyElement.setAttribute(PropertyDescriptorField.TYPE.attributeName(), PropertyTypeId.typeIdFor(propertyDescriptor.type(), propertyDescriptor.isMultiValue())); Map<PropertyDescriptorField, String> propertyValuesById = propertyDescriptor.attributeValuesById(); for (Map.Entry<PropertyDescriptorField, String> entry : propertyValuesById.entrySet()) { propertyElement.setAttribute(entry.getKey().attributeName(), entry.getValue()); } return propertyElement; }
if (propertyDescriptor.isMultiValue()) { @SuppressWarnings("unchecked") // multi valued properties are using a List MultiValuePropertyDescriptor<List<?>> multiPropertyDescriptor = (MultiValuePropertyDescriptor<List<?>>) propertyDescriptor; if (propertyDescriptor.isMultiValue()) { MultiValuePropertyDescriptor<?> multiValuePropertyDescriptor = (MultiValuePropertyDescriptor<?>) propertyDescriptor;
private ValueRepresentation getRepresentation(final PropertyDescriptor<?> descriptor, final Object value) { if (descriptor.isMultiValue()) { final List<?> val = (List<?>) value; if (val.isEmpty()) { return EmptySequence.getInstance(); } final Item[] converted = new Item[val.size()]; for (int i = 0; i < val.size(); i++) { converted[i] = getAtomicRepresentation(val.get(i)); } return new SequenceExtent(converted); } else { return getAtomicRepresentation(value); } }
private Element createPropertyDefinitionElementBR(PropertyDescriptor<?> propertyDescriptor) { final Element propertyElement = createPropertyValueElement(propertyDescriptor, propertyDescriptor.defaultValue()); propertyElement.setAttribute(PropertyDescriptorField.TYPE.attributeName(), PropertyTypeId.typeIdFor(propertyDescriptor.type(), propertyDescriptor.isMultiValue())); Map<PropertyDescriptorField, String> propertyValuesById = propertyDescriptor.attributeValuesById(); for (Map.Entry<PropertyDescriptorField, String> entry : propertyValuesById.entrySet()) { propertyElement.setAttribute(entry.getKey().attributeName(), entry.getValue()); } return propertyElement; }