|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--y.util.BeanSerializer
This class is a simple implementation for automatic object string conversion. It implements the ObjectStore interface and performs attribute string conversion using reflection mechanisms.
Constructor Summary | |
BeanSerializer(Class type)
Creates a new instance of BeanSerialization for the given classtype. |
Method Summary | |
void |
addSerializedField(String propertyName,
String mappedName)
Adds an attribute to the list of attributes which will be serialized by this instance. |
PropertyChangeListener |
createPropertyAdapter(Object object,
Map properties,
ObjectStringConverter osc)
constructs a PropertyChangeListener which can be registered with an instance that fires property change events, if one of the propertynames equals one of the keys, this listener will automatically store the value in the given object as the new attribute. |
void |
restore(Object object,
Map properties,
ObjectStringConverter conversion)
This method takes an object, uses the supplied converter to restore its attributes stored in the propertyMap using the converter to do the string to object conversion. |
void |
store(Object object,
Map properties,
ObjectStringConverter conversion)
This method takes an object, uses the supplied converter to transform the attributes of the object into string values and puts the attribute-name string-value pairs in the supplied propertyMap. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BeanSerializer(Class type)
BeanSerializer.addSerializedField(String, String)
have to
be made after the object has been instantiated.
type
- the class type this object can handleMethod Detail |
public void addSerializedField(String propertyName, String mappedName) throws IntrospectionException
IntrospectionException
- if this method was unable to find the corresponding bean setters and getters for
the attributepropertyName
- the bean name of the propertymappedName
- the name or path which will be used in the map as a key to store the property
to.public void store(Object object, Map properties, ObjectStringConverter conversion)
ObjectStore
store
in interface ObjectStore
object
- the object whose attributes will be stored in the propertyMapproperties
- the map, which contains the key value pairs, both keys and values must be
Strings.conversion
- the converter, which must be used to convert simple objects to corresponding
String formspublic void restore(Object object, Map properties, ObjectStringConverter conversion)
ObjectStore
restore
in interface ObjectStore
object
- the object whose attributes will be restored from the propertyMapproperties
- the map, which contains the key value pairs, both keys and values are
Strings.conversion
- the converter, which should be used to convert the string representations
to the object's attributes.public PropertyChangeListener createPropertyAdapter(Object object, Map properties, ObjectStringConverter osc)
object
- the instance which will be used to write the attribute changes toproperties
- unused for nowosc
- the string to object conversion which should be used to for the conversion
|
© Copyright 2000-2003, yWorks GmbH. All rights reserved. 2003 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |