Interface AttributeDataType


public interface AttributeDataType
A data type is a description of the data that an attribute has. Basically, it is an id with a presentable name that can give a description of different kinds of validation schemes called refinements.
Author:
Per-Erik
  • Method Details

    • getID

      String getID()
      Returns a persistably unique string that can be used to lookup this data type. "Persistably" means that the returned string should be the same no matter when the method is called, even if the object is a new instance. That is, this method's return value should behave as if it was statically defined.
      All implementations must take the returned id into account in their equals and hash methods. Two attribute data types that have the same id should always be considered equal.
      Returns:
      A unique string-id for this data type, e.g. "com.acme.Number".
    • getName

      String getName(Locale locale)
      Returns a presentable name for this data type, e.g. "Number" in the language that best matches the given locale. Note that the only api requirement is that a string is returned and that this string is the same string for each time the method is called with the same parameter value. Thus, two successive calls to this method should yeild the same result if it is called with the same locale object, or if the locale objects are equal.
      Parameters:
      locale - The requested locale.
      Returns:
      A name for this type, that may be different with different parameters sent in.
    • equals

      boolean equals(Object o)
      Compares this object with the sent in object for equaltiy. Besides fullfilling the base contract of equals, implementations must also make sure that two AttributeDataTypes with the same id are equal.
      Overrides:
      equals in class Object
      Parameters:
      o - The object to compare to
      Returns:
      True if this object is equal to the sent in object. This is always the case if the sent in object is an AttributeDataType with the same id. Otherwise, false is returned.
    • getLocalizationHint

      AttributeDataType.LocalizationHint getLocalizationHint()
      Returns the localization hint for this data type's refinements.
      Returns:
      the localization hint for this data type's refinements.
    • createDefaultRefinement

      Refinement createDefaultRefinement()
      Creates a new refinement for this data type. The new refinement will be used to construct a refinement string that is persistable.
      Returns:
      A new refinement or null if this type has no refinement.
    • createRefinement

      Refinement createRefinement(String serialized)
      Creates a new refinement based on the given string. The string will be one that has been previously returned by Refinement.getRefinementString(). This method will never be called with a string that was created by a refinement coming from some other data type.
      Parameters:
      serialized - A string representation of a refinement created by this data type.
      Returns:
      A new refinement based on the parameter, or null if this type has no refinement.
      See Also:
    • isDerivedInformation

      default boolean isDerivedInformation()
      Returns true if attributes with this data type is derived solely from the data type and thus never has an attribute value associated with it. For example, a data type that displays the number 1 for all models of type "General Model" and the number 2 for all other models will never have any actual value associated with any particular model. So, there is no actual value stored for any specific model, but there still IS a result to be retrieved for ALL models. Thus, some algorithms that check for the existence of a value alone will fail to recognise that there are results for this data type. Such algorithms will use this method to include some results that would otherwise be "empty".
      Could also be stated as "returns true if values of this data type are based on the refinement, the dataType itself, the value holder's UUID or a combination of these - BUT never based on an editable value".
      Returns:
      see method documentation