Class AttributeFactory

java.lang.Object
org.codice.ddf.catalog.plugin.metacard.util.AttributeFactory

public class AttributeFactory extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    ddf.catalog.data.Attribute
    createAttribute(ddf.catalog.data.AttributeDescriptor attributeDescriptor, String value)
    Attempts to create an Attribute according to the provided AttributeDescriptor whose value is represented by the given string .
    parseAttributeValue(ddf.catalog.data.AttributeDescriptor attributeDescriptor, String value)
    Attempts to parse a value for an Attribute according to the provided AttributeDescriptor whose value is represented by the given string .

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AttributeFactory

      public AttributeFactory()
  • Method Details

    • createAttribute

      public ddf.catalog.data.Attribute createAttribute(ddf.catalog.data.AttributeDescriptor attributeDescriptor, String value)
      Attempts to create an Attribute according to the provided AttributeDescriptor whose 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 Attribute conforming to the given AttributeDescriptor with a value of that was parsed and processed to Serializable.
      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 an Attribute according to the provided AttributeDescriptor whose value is represented by the given string . Returns null if 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 .