/** * PUBLIC: * Indicates if there is a converter on the mapping. */ public boolean hasValueConverter() { return getValueConverter() != null; }
/** * PUBLIC: * Indicates if there is a converter on the mapping. */ public boolean hasValueConverter() { return getValueConverter() != null; }
/** * PUBLIC: * Indicates if there is a converter on the mapping. */ public boolean hasValueConverter() { return getValueConverter() != null; }
private Type getContainerType(final boolean isIndividual) { final XPathNodeWrapper currentNodeWrapper = getCurrentNodeWrapper(); if (currentNodeWrapper.nodeValue != null && currentNodeWrapper.nodeValue.isContainerValue()) { final DatabaseMapping mapping = currentNodeWrapper.nodeValue.getMapping(); Converter valueConverter = null; if (mapping != null) { if (isIndividual) { if (mapping instanceof AbstractCompositeDirectCollectionMapping) { valueConverter = ((AbstractCompositeDirectCollectionMapping) mapping).getValueConverter(); } else if (mapping instanceof XMLCompositeCollectionMapping) { valueConverter = ((XMLCompositeCollectionMapping) mapping).getConverter(); } } if (valueConverter instanceof TypeConversionConverter) { return ((TypeConversionConverter) valueConverter).getObjectClass(); } else if (mapping.getContainerPolicy() != null) { return mapping.getContainerPolicy().getContainerClass(); } } } return null; }
/** * 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 object's * collection should be converted to, before the collection * is inserted into the object. * This is optional - if left null, the elements will be added * to the object's collection unconverted. */ public Class getAttributeElementClass() { if (!(getValueConverter() instanceof TypeConversionConverter)) { return null; } return ((TypeConversionConverter)getValueConverter()).getObjectClass(); }
/** * 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 object's * collection should be converted to, before the collection * is inserted into the object. * This is optional - if left null, the elements will be added * to the object's collection unconverted. */ public Class getAttributeElementClass() { if (!(getValueConverter() instanceof TypeConversionConverter)) { return null; } return ((TypeConversionConverter)getValueConverter()).getObjectClass(); }
/** * PUBLIC: * Return the class each element in the object's * collection should be converted to, before the collection * is inserted into the object. * This is optional - if left null, the elements will be added * to the object's collection unconverted. */ public Class getAttributeElementClass() { if (!(getValueConverter() instanceof TypeConversionConverter)) { return null; } return ((TypeConversionConverter)getValueConverter()).getObjectClass(); }
/** * INTERNAL * Called when a DatabaseMapping is used to map the key in a collection. Returns the key. */ public Object createMapComponentFromRow(AbstractRecord dbRow, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected){ Object key = dbRow.get(getField()); if (getValueConverter() != null){ key = getValueConverter().convertDataValueToObjectValue(key, session); } return key; }
/** * INTERNAL * Called when a DatabaseMapping is used to map the key in a collection. Returns the key. */ public Object createMapComponentFromRow(AbstractRecord dbRow, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected){ Object key = dbRow.get(getField()); if (getValueConverter() != null){ key = getValueConverter().convertDataValueToObjectValue(key, session); } return key; }
/** * PUBLIC: * Set 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 void setFieldElementClass(Class fieldElementClass) { TypeConversionConverter converter; if (getValueConverter() instanceof TypeConversionConverter) { converter = (TypeConversionConverter)getValueConverter(); } else { converter = new TypeConversionConverter(); setValueConverter(converter); } converter.setDataClass(fieldElementClass); }
/** * PUBLIC: * Set the class each element in the object's * collection should be converted to, before the collection * is inserted into the object. * This is optional - if left null, the elements will be added * to the object's collection unconverted. */ public void setAttributeElementClass(Class attributeElementClass) { TypeConversionConverter converter; if (getValueConverter() instanceof TypeConversionConverter) { converter = (TypeConversionConverter)getValueConverter(); } else { converter = new TypeConversionConverter(); setValueConverter(converter); } converter.setObjectClass(attributeElementClass); }
/** * PUBLIC: * Set 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 void setFieldElementClass(Class fieldElementClass) { TypeConversionConverter converter; if (getValueConverter() instanceof TypeConversionConverter) { converter = (TypeConversionConverter)getValueConverter(); } else { converter = new TypeConversionConverter(); setValueConverter(converter); } converter.setDataClass(fieldElementClass); }
/** * PUBLIC: * Set the class each element in the object's * collection should be converted to, before the collection * is inserted into the object. * This is optional - if left null, the elements will be added * to the object's collection unconverted. */ public void setAttributeElementClassName(String attributeElementClass) { TypeConversionConverter converter; if (getValueConverter() instanceof TypeConversionConverter) { converter = (TypeConversionConverter)getValueConverter(); } else { converter = new TypeConversionConverter(); setValueConverter(converter); } converter.setObjectClassName(attributeElementClass); }
/** * PUBLIC: * Set the class each element in the object's * collection should be converted to, before the collection * is inserted into the object. * This is optional - if left null, the elements will be added * to the object's collection unconverted. */ public void setAttributeElementClass(Class attributeElementClass) { TypeConversionConverter converter; if (getValueConverter() instanceof TypeConversionConverter) { converter = (TypeConversionConverter)getValueConverter(); } else { converter = new TypeConversionConverter(); setValueConverter(converter); } converter.setObjectClass(attributeElementClass); }
/** * INTERNAL: * Initialize the mapping. */ public void initialize(AbstractSession session) throws DescriptorException { super.initialize(session); if (getField() == null) { throw DescriptorException.fieldNameNotSetInMapping(this); } setField(getDescriptor().buildField(getField())); setFields(collectFields()); if (getValueConverter() != null) { getValueConverter().initialize(this, session); } }
/** * INTERNAL: * Initialize the mapping. */ public void initialize(AbstractSession session) throws DescriptorException { super.initialize(session); if (getField() == null) { throw DescriptorException.fieldNameNotSetInMapping(this); } setField(getDescriptor().buildField(getField())); setFields(collectFields()); if (getValueConverter() != null) { getValueConverter().initialize(this, session); } }
/** * INTERNAL: * Initialize the mapping. */ public void initialize(AbstractSession session) throws DescriptorException { super.initialize(session); if (getField() == null) { throw DescriptorException.fieldNameNotSetInMapping(this); } setField(getDescriptor().buildField(getField())); setFields(collectFields()); if (getValueConverter() != null) { getValueConverter().initialize(this, session); } }