/** * PUBLIC: * Return the class each element in the database row's * collection should be converted to, before the collection * is inserted into the database. * This is optional - if left null, the elements will be added * to the database row's collection unconverted. */ public Class getFieldElementClass() { if (!(getValueConverter() instanceof TypeConversionConverter)) { return null; } return ((TypeConversionConverter)getValueConverter()).getDataClass(); }
/** * PUBLIC: * Return the class each element in the database row's * collection should be converted to, before the collection * is inserted into the database. * This is optional - if left null, the elements will be added * to the database row's collection unconverted. */ public Class getFieldElementClass() { if (!(getValueConverter() instanceof TypeConversionConverter)) { return null; } return ((TypeConversionConverter)getValueConverter()).getDataClass(); }
/** * PUBLIC: * Return the class each element in the database row's * collection should be converted to, before the collection * is inserted into the database. * This is optional - if left null, the elements will be added * to the database row's collection unconverted. */ public Class getFieldElementClass() { if (!(getValueConverter() instanceof TypeConversionConverter)) { return null; } return ((TypeConversionConverter)getValueConverter()).getDataClass(); }
/** * INTERNAL: * Convert to the field class. */ public Object convertObjectValueToDataValue(Object attributeValue, Session session) { try { return ((AbstractSession)session).getDatasourcePlatform().convertObject(attributeValue, getDataClass()); } catch (ConversionException e) { throw ConversionException.couldNotBeConverted(mapping, mapping.getDescriptor(), e); } }
/** * INTERNAL: * Convert to the field class. */ public Object convertObjectValueToDataValue(Object attributeValue, Session session) { try { return ((AbstractSession)session).getDatasourcePlatform().convertObject(attributeValue, getDataClass()); } catch (ConversionException e) { throw ConversionException.couldNotBeConverted(mapping, mapping.getDescriptor(), e); } }
/** * INTERNAL: * Convert to the field class. */ public Object convertObjectValueToDataValue(Object attributeValue, Session session) { try { return ((AbstractSession)session).getDatasourcePlatform().convertObject(attributeValue, getDataClass()); } catch (ConversionException e) { throw ConversionException.couldNotBeConverted(mapping, mapping.getDescriptor(), e); } }
/** * INTERNAL: * Set the mapping. */ public void initialize(DatabaseMapping mapping, Session session) { this.mapping = mapping; // CR#... Mapping must also have the field classification. if (getMapping().isDirectToFieldMapping()) { AbstractDirectMapping directMapping = (AbstractDirectMapping)getMapping(); // Allow user to specify field type to override computed value. (i.e. blob, nchar) if (directMapping.getFieldClassification() == null) { directMapping.setFieldClassification(getDataClass()); } // Set the object class from the attribute, if null. if (getObjectClass() == null) { setObjectClass(directMapping.getAttributeClassification()); } } }
/** * INTERNAL: * The field value must first be converted to the field type, then the attribute type. */ public Object convertDataValueToObjectValue(Object fieldValue, Session session) { Object attributeValue = fieldValue; if (attributeValue != null) { try { attributeValue = ((AbstractSession)session).getDatasourcePlatform().convertObject(attributeValue, getDataClass()); } catch (ConversionException e) { throw ConversionException.couldNotBeConverted(mapping, mapping.getDescriptor(), e); } try { attributeValue = ((AbstractSession)session).getDatasourcePlatform().convertObject(attributeValue, getObjectClass()); } catch (ConversionException e) { throw ConversionException.couldNotBeConverted(mapping, mapping.getDescriptor(), e); } } return attributeValue; }
/** * INTERNAL: * The field value must first be converted to the field type, then the attribute type. */ public Object convertDataValueToObjectValue(Object fieldValue, Session session) { Object attributeValue = fieldValue; if (attributeValue != null) { try { attributeValue = ((AbstractSession)session).getDatasourcePlatform().convertObject(attributeValue, getDataClass()); } catch (ConversionException e) { throw ConversionException.couldNotBeConverted(mapping, mapping.getDescriptor(), e); } try { attributeValue = ((AbstractSession)session).getDatasourcePlatform().convertObject(attributeValue, getObjectClass()); } catch (ConversionException e) { throw ConversionException.couldNotBeConverted(mapping, mapping.getDescriptor(), e); } } return attributeValue; }
/** * INTERNAL: * The field value must first be converted to the field type, then the attribute type. */ public Object convertDataValueToObjectValue(Object fieldValue, Session session) { Object attributeValue = fieldValue; if (attributeValue != null) { try { attributeValue = ((AbstractSession)session).getDatasourcePlatform().convertObject(attributeValue, getDataClass()); } catch (ConversionException e) { throw ConversionException.couldNotBeConverted(mapping, mapping.getDescriptor(), e); } try { attributeValue = ((AbstractSession)session).getDatasourcePlatform().convertObject(attributeValue, getObjectClass()); } catch (ConversionException e) { throw ConversionException.couldNotBeConverted(mapping, mapping.getDescriptor(), e); } } return attributeValue; }
/** * INTERNAL: * Set the mapping. */ public void initialize(DatabaseMapping mapping, Session session) { this.mapping = mapping; // CR#... Mapping must also have the field classification. if (getMapping().isDirectToFieldMapping()) { AbstractDirectMapping directMapping = (AbstractDirectMapping)getMapping(); // Allow user to specify field type to override computed value. (i.e. blob, nchar) if (directMapping.getFieldClassification() == null) { directMapping.setFieldClassification(getDataClass()); } // Set the object class from the attribute, if null. if (getObjectClass() == null) { setObjectClass(directMapping.getAttributeClassification()); } } else if (getMapping().isDirectCollectionMapping()) { ((DirectCollectionMapping) getMapping()).setAttributeClassification(getObjectClass()); } }
/** * INTERNAL: * Set the mapping. */ public void initialize(DatabaseMapping mapping, Session session) { this.mapping = mapping; // CR#... Mapping must also have the field classification. if (getMapping().isDirectToFieldMapping()) { AbstractDirectMapping directMapping = (AbstractDirectMapping)getMapping(); // Allow user to specify field type to override computed value. (i.e. blob, nchar) if (directMapping.getFieldClassification() == null) { directMapping.setFieldClassification(getDataClass()); } // Set the object class from the attribute, if null. if (getObjectClass() == null) { setObjectClass(directMapping.getAttributeClassification()); } } else if (getMapping().isDirectCollectionMapping()) { ((DirectCollectionMapping) getMapping()).setAttributeClassification(getObjectClass()); } }