Class AttributeFactory
java.lang.Object
org.codice.ddf.catalog.plugin.metacard.util.AttributeFactory
Support class for working with and constructing
Attributes. The default method for
handling multi-valued attributes as a single string is to delimit each value with a comma.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionddf.catalog.data.AttributecreateAttribute(ddf.catalog.data.AttributeDescriptor attributeDescriptor, String value) Attempts to create anAttributeaccording to the providedAttributeDescriptorwhose value is represented by the given string .parseAttributeValue(ddf.catalog.data.AttributeDescriptor attributeDescriptor, String value) Attempts to parse a value for anAttributeaccording to the providedAttributeDescriptorwhose value is represented by the given string .
-
Constructor Details
-
AttributeFactory
public AttributeFactory()
-
-
Method Details
-
createAttribute
public ddf.catalog.data.Attribute createAttribute(ddf.catalog.data.AttributeDescriptor attributeDescriptor, String value) Attempts to create anAttributeaccording to the providedAttributeDescriptorwhose value is represented by the given string . Throws an exception if could not be parsed.- Parameters:
attributeDescriptor- The descriptor used to create the attribute.value- The non-empty string to use to create an attribute value. Multi-valued entities should be separated by commas.- Returns:
- An
Attributeconforming to the givenAttributeDescriptorwith a value of that was parsed and processed toSerializable. - Throws:
IllegalArgumentException- If the given value could not be parsed or if the inputs were null or empty.
-
parseAttributeValue
@Nullable public Serializable parseAttributeValue(ddf.catalog.data.AttributeDescriptor attributeDescriptor, String value) Attempts to parse a value for anAttributeaccording to the providedAttributeDescriptorwhose value is represented by the given string . Returnsnullif could not be parsed.The input must be effectively
Serializable.- Parameters:
attributeDescriptor- The descriptor to use to parse the value.value- The string containing the value to be parsed.- Returns:
- The deserialized object of according to .
-