FileDocCategorySizeDatePackage
TypedAssociation.javaAPI DocGlassfish v2 API3887Tue May 22 16:54:46 BST 2007oracle.toplink.essentials.mappings

TypedAssociation

public class TypedAssociation extends Association

Purpose: Generic association object. This can be used to map hashtable/map containers where the key and value are non-typed primitives.

author
James Sutherland
since
TOPLink/Java 3.0

Fields Summary
protected Class
keyType
protected Class
valueType
Constructors Summary
public TypedAssociation()
Default constructor.

        super();
    
public TypedAssociation(Object key, Object value)
PUBLIC: Create an association.

        super(key, value);
        if (key != null) {
            this.keyType = key.getClass();
        }
        this.value = value;
        if (value != null) {
            this.valueType = value.getClass();
        }
    
Methods Summary
public java.lang.ClassgetKeyType()
PUBLIC: Return the class of the key.

        return keyType;
    
public java.lang.ClassgetValueType()
PUBLIC: Return the class of the value.

        return valueType;
    
public voidpostBuild(oracle.toplink.essentials.descriptors.DescriptorEvent event)
INTERNAL: Handler for the descriptor post build event. Convert the key and values to their appropriate type.

        setKey(event.getSession().getDatasourceLogin().getDatasourcePlatform().getConversionManager().convertObject(getKey(), getKeyType()));
        setValue(event.getSession().getDatasourceLogin().getDatasourcePlatform().getConversionManager().convertObject(getValue(), getValueType()));
    
public voidsetKeyType(java.lang.Class keyType)
PUBLIC: Set the class of the key.

        this.keyType = keyType;
    
public voidsetValueType(java.lang.Class valueType)
PUBLIC: Set the class of the value.

        this.valueType = valueType;