com.ca.commons.jndi.beans
Class EnumPropertyHandler
java.lang.Object
com.ca.commons.jndi.beans.MultiValuedAttribHandler
com.ca.commons.jndi.beans.EnumPropertyHandler
- All Implemented Interfaces:
- JNDIBeanPropertyHandler
public class EnumPropertyHandler
- extends MultiValuedAttribHandler
Simple handler for enumerated type attributes, for performing mappings
from user-friendly (often used as display) values to less-friendly internal
values. Another useful feature is being able to map an empty string to null.
|
Method Summary |
protected Object |
attrib2Property(Object attrValue)
Converts a single attribute value to a value to be included in
the Collection result. |
void |
init(Properties props)
Initialize the to-and-from maps, using configuration similar in format to:
where 'name' corresponds to the value in the property, and
'value' refers to the value in the LDAP attribute. |
protected Object |
property2Attrib(Object propValue)
Converts a single property value to an attribute value. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EnumPropertyHandler
public EnumPropertyHandler()
init
public void init(Properties props)
throws JNDIBeanStoreConfigException
- Initialize the to-and-from maps, using configuration similar in format to:
where 'name' corresponds to the value in the property, and
'value' refers to the value in the LDAP attribute.
- Specified by:
init in interface JNDIBeanPropertyHandler- Overrides:
init in class MultiValuedAttribHandler
- Parameters:
props -
- Throws:
JNDIBeanStoreConfigException
attrib2Property
protected Object attrib2Property(Object attrValue)
throws JNDIBeanStoreException
- Converts a single attribute value to a value to be included in
the
Collection result. This is called by
MultiValuedAttribHandler.getPropertyValue(javax.naming.directory.Attribute[])
for each value of the multivalued attribute.
The default implementation simply returns the same reference it
was passed.
- Overrides:
attrib2Property in class MultiValuedAttribHandler
- Parameters:
attrValue - An attribute value.
- Returns:
- The converted value.
- Throws:
JNDIBeanStoreException - If the value could not be converted.
property2Attrib
@Nullable
protected Object property2Attrib(Object propValue)
throws JNDIBeanStoreException
- Converts a single property value to an attribute value.
This is called by
MultiValuedAttribHandler.getAttributeValues(java.lang.Object)
for each element of the input Collection.
The default implementation simply returns the same reference it
was passed.
- Overrides:
property2Attrib in class MultiValuedAttribHandler
- Parameters:
propValue - A property value.
- Returns:
- The converted attribute value.
- Throws:
JNDIBeanStoreException - If the value could not be converted.
Created 2011-07-14 13:27 EST