Interface AttributeValueReader

All Known Implementing Classes:
BaseAttributeValueReader, DictionaryObjectAttributeValueReader, SingleAttributeValueReader, ViewAttributeValueReader

public interface AttributeValueReader
AttributeValueReader defines classes that encapsulate access to both dictionary metadata and object field values

For example, by reflection and introspection, for the purpose of performing validation against constraints defined in the DictionaryValidationService implementation.

Practically speaking, this interface should only need to be implemented by a small number of classes. The two major use cases are for

  1. a dictionary object with members
  2. a specific member of a dictionary object

In the first case, implementing classes should provide access to all underlying members of the object via reflection or some other mechanism. In the second case, implementing classes only need to provide access to the value associated with that specific member, and constraints requiring access to additional members will be skipped.

Since:
1.1
Author:
Kuali Rice Team (rice.collab@kuali.org)
  • Method Summary

    Modifier and Type
    Method
    Description
    overrides Object.clone()
    acts as an accessor for the attribute name that is currently being processed by the DictionaryValidationService implementation
    enables legacy processing of string representations of attribute values like a date range in the format 12/03/2001..1/29/2009
    getDefinition(String attributeName)
    provides access to the constrainable attribute definition of a specific attribute name
    gets a list of all constrainable dictionary metadata definitions for attributes or fields encapsulated by this object
    gets the dictionary metadata associated with an object (its "entry" in the dictionary)
    gets the entry name for the purposes of correct error look up
    getLabel(String attributeName)
    looks up a label for a specific attribute name
    gets the underlying object itself (not the field/attribute value, but the object)
    gets the path, which is a string representation of specifically which attribute (at some depth) is being accessed
    getType(String attributeName)
    gets the type of the attribute specified - A Java class
    <X> X
    looks up the attribute value that is currently being processed
    <X> X
    getValue(String attributeName)
    looks up any attribute value by name for the object being processed
    boolean
    Indicates whether the configured attribute name is readable for the object
    void
    setAttributeName(String attributeName)
    Setter for the current attribute that is being processed
  • Method Details

    • getAttributeName

      String getAttributeName()
      acts as an accessor for the attribute name that is currently being processed by the DictionaryValidationService implementation
      Returns:
      the current attribute name being processed
    • getDefinition

      Constrainable getDefinition(String attributeName)
      provides access to the constrainable attribute definition of a specific attribute name

      If the value of the metadata associated with the object field does not implement constrainable, or if no metadata is associated with this object field, then null should be returned.

      Parameters:
      attributeName - - the name of the attribute/field whose metadata is being requested
      Returns:
      dictionary metadata object implementing some constrainable capability
    • getDefinitions

      List<Constrainable> getDefinitions()
      gets a list of all constrainable dictionary metadata definitions for attributes or fields encapsulated by this object
      Returns:
      a list of constrainable definitions
    • getEntry

      Constrainable getEntry()
      gets the dictionary metadata associated with an object (its "entry" in the dictionary)

      It can also be constrainable, in which case the object value itself can be validated against one or more constraints. If the specific entry for the dictionary object encapsulated by this reader is not constrainable, or if no entry exists for this dictionary object, or no dictionary object is being encapsulted, then null should be returned.

      Returns:
      the constrainable dictionary entry metadata for this object, or null
    • getEntryName

      String getEntryName()
      gets the entry name for the purposes of correct error look up

      Errors are generally found by entry name + attribute name + error key

      Returns:
      the name that the data dictionary uses to store metadata about this object (not its attributes)
    • getLabel

      String getLabel(String attributeName)
      looks up a label for a specific attribute name
      Parameters:
      attributeName - - the name of attribute
      Returns:
      some descriptive label that can be exposed to the end user for error messages
    • getObject

      Object getObject()
      gets the underlying object itself (not the field/attribute value, but the object)
      Returns:
      the object that is being encapsulated by this reader, or null if no object is being encapsulated
    • getPath

      String getPath()
      gets the path, which is a string representation of specifically which attribute (at some depth) is being accessed

      For example, on a person object there might be the following field path: joe.home.mailingAddress.state

      Returns:
      the string representation of the attribute identifier currently being processed
    • getType

      Class<?> getType(String attributeName)
      gets the type of the attribute specified - A Java class
      Parameters:
      attributeName - - the name of attribute
      Returns:
      the type of the attribute referenced by the passed name, or null if no attribute exists of that name
    • isReadable

      boolean isReadable()
      Indicates whether the configured attribute name is readable for the object
      Returns:
      boolean if attribute is readable, false if not
    • getValue

      <X> X getValue() throws AttributeValidationException
      looks up the attribute value that is currently being processed
      Type Parameters:
      X - - the type of the attribute
      Returns:
      the attribute's value if found, null if not
      Throws:
      AttributeValidationException
    • getValue

      <X> X getValue(String attributeName) throws AttributeValidationException
      looks up any attribute value by name for the object being processed
      Type Parameters:
      X - - the type of the attribute
      Parameters:
      attributeName - - the name of attribute whose value is looked up
      Returns:
      - the attribute's value if found, null if not
      Throws:
      AttributeValidationException
    • getCleanSearchableValues

      List<String> getCleanSearchableValues(String attributeName) throws AttributeValidationException
      enables legacy processing of string representations of attribute values like a date range in the format 12/03/2001..1/29/2009
      Parameters:
      attributeName - - the attribute name
      Returns:
      the list of token strings for the attribute value of the named attribute
      Throws:
      AttributeValidationException
    • setAttributeName

      void setAttributeName(String attributeName)
      Setter for the current attribute that is being processed
      Parameters:
      attributeName -
    • clone

      overrides Object.clone()
      Returns:
      a cloned AttributeValueReader