1 21 package oracle.toplink.essentials.mappings; 23 24 import oracle.toplink.essentials.descriptors.DescriptorEvent; 25 26 33 public class TypedAssociation extends Association { 34 protected Class keyType; 35 protected Class valueType; 36 37 40 public TypedAssociation() { 41 super(); 42 } 43 44 48 public TypedAssociation(Object key, Object value) { 49 super(key, value); 50 if (key != null) { 51 this.keyType = key.getClass(); 52 } 53 this.value = value; 54 if (value != null) { 55 this.valueType = value.getClass(); 56 } 57 } 58 59 63 public Class getKeyType() { 64 return keyType; 65 } 66 67 71 public Class getValueType() { 72 return valueType; 73 } 74 75 80 public void postBuild(DescriptorEvent event) { 81 setKey(event.getSession().getDatasourceLogin().getDatasourcePlatform().getConversionManager().convertObject(getKey(), getKeyType())); 82 setValue(event.getSession().getDatasourceLogin().getDatasourcePlatform().getConversionManager().convertObject(getValue(), getValueType())); 83 } 84 85 89 public void setKeyType(Class keyType) { 90 this.keyType = keyType; 91 } 92 93 97 public void setValueType(Class valueType) { 98 this.valueType = valueType; 99 } 100 } 101 | Popular Tags |