org.kuali.rice.krad.datadictionary.validation
Class DictionaryObjectAttributeValueReader

java.lang.Object
  extended by org.kuali.rice.krad.datadictionary.validation.BaseAttributeValueReader
      extended by org.kuali.rice.krad.datadictionary.validation.DictionaryObjectAttributeValueReader
All Implemented Interfaces:
AttributeValueReader
Direct Known Subclasses:
MaintenanceDocumentAttributeValueReader

public class DictionaryObjectAttributeValueReader
extends BaseAttributeValueReader

This class allows a dictionary object to expose information about its fields / attributes, including the values of those fields, with some guidance from the DataDictionaryEntry object.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Field Summary
protected  org.springframework.beans.BeanWrapper beanWrapper
           
protected  DataDictionaryEntry entry
           
protected  Object object
           
 
Fields inherited from class org.kuali.rice.krad.datadictionary.validation.BaseAttributeValueReader
attributeName, entryName
 
Constructor Summary
DictionaryObjectAttributeValueReader(Object object, String entryName, DataDictionaryEntry entry)
           
DictionaryObjectAttributeValueReader(Object object, String entryName, DataDictionaryEntry entry, String attributePath)
           
 
Method Summary
 AttributeValueReader clone()
          overrides Object.clone()
 Constrainable getDefinition(String attrName)
          provides access to the constrainable attribute definition of a specific attribute name
 List<Constrainable> getDefinitions()
          gets a list of all constrainable dictionary metadata definitions for attributes or fields encapsulated by this object
 Constrainable getEntry()
          gets the dictionary metadata associated with an object (its "entry" in the dictionary)
 String getLabel(String attrName)
          looks up a label for a specific attribute name
 Object getObject()
          gets the underlying object itself (not the field/attribute value, but the object)
 String getPath()
          gets the path, which is a string representation of specifically which attribute (at some depth) is being accessed
 Class<?> getType(String attrName)
          gets the type of the attribute specified - A Java class
<X> X
getValue()
          looks up the attribute value that is currently being processed
<X> X
getValue(String attrName)
          looks up any attribute value by name for the object being processed
 boolean isNestedAttribute()
           
 boolean isParentAttributeNull()
           
 boolean isReadable()
          Indicates whether the configured attribute name is readable for the object
 
Methods inherited from class org.kuali.rice.krad.datadictionary.validation.BaseAttributeValueReader
getAttributeName, getCleanSearchableValues, getEntryName, setAttributeName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

object

protected Object object

entry

protected DataDictionaryEntry entry

beanWrapper

protected org.springframework.beans.BeanWrapper beanWrapper
Constructor Detail

DictionaryObjectAttributeValueReader

public DictionaryObjectAttributeValueReader(Object object,
                                            String entryName,
                                            DataDictionaryEntry entry)

DictionaryObjectAttributeValueReader

public DictionaryObjectAttributeValueReader(Object object,
                                            String entryName,
                                            DataDictionaryEntry entry,
                                            String attributePath)
Method Detail

getDefinition

public Constrainable getDefinition(String attrName)
Description copied from interface: AttributeValueReader
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:
attrName - - the name of the attribute/field whose metadata is being requested
Returns:
dictionary metadata object implementing some constrainable capability

getDefinitions

public List<Constrainable> getDefinitions()
Description copied from interface: AttributeValueReader
gets a list of all constrainable dictionary metadata definitions for attributes or fields encapsulated by this object

Returns:
a list of constrainable definitions

getEntry

public Constrainable getEntry()
Description copied from interface: AttributeValueReader
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

getLabel

public String getLabel(String attrName)
Description copied from interface: AttributeValueReader
looks up a label for a specific attribute name

Parameters:
attrName - - the name of attribute
Returns:
some descriptive label that can be exposed to the end user for error messages

getObject

public Object getObject()
Description copied from interface: AttributeValueReader
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

public String getPath()
Description copied from interface: AttributeValueReader
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

public Class<?> getType(String attrName)
Description copied from interface: AttributeValueReader
gets the type of the attribute specified - A Java class

Parameters:
attrName - - 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

public boolean isReadable()
Description copied from interface: AttributeValueReader
Indicates whether the configured attribute name is readable for the object

Returns:
boolean if attribute is readable, false if not

getValue

public <X> X getValue()
           throws AttributeValidationException
Description copied from interface: AttributeValueReader
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

public <X> X getValue(String attrName)
           throws AttributeValidationException
Description copied from interface: AttributeValueReader
looks up any attribute value by name for the object being processed

Type Parameters:
X - - the type of the attribute
Parameters:
attrName - - the name of attribute whose value is looked up
Returns:
- the attribute's value if found, null if not
Throws:
AttributeValidationException

isParentAttributeNull

public boolean isParentAttributeNull()
Returns:
false if parent attribute exists and is not null, otherwise returns true.

isNestedAttribute

public boolean isNestedAttribute()

clone

public AttributeValueReader clone()
Description copied from interface: AttributeValueReader
overrides Object.clone()

Specified by:
clone in interface AttributeValueReader
Specified by:
clone in class BaseAttributeValueReader
Returns:
a cloned AttributeValueReader


Copyright © 2005-2014 The Kuali Foundation. All Rights Reserved.