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: * This is a helper method to get the object class from the value converter * if it is a TypeConversionConverter. * This returns null if not using a TypeConversionConverter value converter. */ public Class getValueClass() { if (!(getValueConverter() instanceof TypeConversionConverter)) { return null; } return ((TypeConversionConverter)getValueConverter()).getObjectClass(); }
/** * PUBLIC: * This is a helper method to get the object class from the value converter * if it is a TypeConversionConverter. * This returns null if not using a TypeConversionConverter value converter. */ public Class getValueClass() { if (!(getValueConverter() instanceof TypeConversionConverter)) { return null; } return ((TypeConversionConverter)getValueConverter()).getObjectClass(); }
/** * PUBLIC: * This is a helper method to get the object class from the value converter * if it is a TypeConversionConverter. * This returns null if not using a TypeConversionConverter value converter. */ public Class getValueClass() { 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(); }
/** * 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(); }
/** * PUBLIC: * This is a helper method to get the object class from the key converter * if it is a TypeConversionConverter. * This returns null if not using a TypeConversionConverter key converter. */ public Class getKeyClass() { if ((getKeyConverter() == null) || !(getKeyConverter() instanceof TypeConversionConverter)) { return null; } return ((TypeConversionConverter)getKeyConverter()).getObjectClass(); }
/** * PUBLIC: * This is a helper method to get the object class from the key converter * if it is a TypeConversionConverter. * This returns null if not using a TypeConversionConverter key converter. */ public Class getKeyClass() { if ((getKeyConverter() == null) || !(getKeyConverter() instanceof TypeConversionConverter)) { return null; } return ((TypeConversionConverter)getKeyConverter()).getObjectClass(); }
/** * PUBLIC: * This is a helper method to get the object class from the key converter * if it is a TypeConversionConverter. * This returns null if not using a TypeConversionConverter key converter. */ public Class getKeyClass() { if ((getKeyConverter() == null) || !(getKeyConverter() instanceof TypeConversionConverter)) { return null; } return ((TypeConversionConverter)getKeyConverter()).getObjectClass(); }
/** * INTERNAL: * Initialize the mapping. */ @Override public void initialize(AbstractSession session) throws DescriptorException { super.initialize(session); if (this.getField() instanceof XMLField && getValueConverter() instanceof TypeConversionConverter) { TypeConversionConverter converter = (TypeConversionConverter)getValueConverter(); this.getField().setType(converter.getObjectClass()); } }
/** * INTERNAL: * Initialize the mapping. */ @Override public void initialize(AbstractSession session) throws DescriptorException { super.initialize(session); if (this.getField() instanceof XMLField && getValueConverter() instanceof TypeConversionConverter) { TypeConversionConverter converter = (TypeConversionConverter)getValueConverter(); this.getField().setType(converter.getObjectClass()); } }
/** * INTERNAL: * Initialize the mapping. */ public void initialize(AbstractSession session) throws DescriptorException { super.initialize(session); if (this.getField() instanceof XMLField && getValueConverter() instanceof TypeConversionConverter) { TypeConversionConverter converter = (TypeConversionConverter)getValueConverter(); this.getField().setType(converter.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()); } }
/** * 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()); } } }
/** * 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: * Initialize the mapping. */ public void initialize(AbstractSession session) throws DescriptorException { super.initialize(session); if (this.getField() instanceof XMLField && getValueConverter() instanceof TypeConversionConverter) { TypeConversionConverter converter = (TypeConversionConverter) getValueConverter(); this.getField().setType(converter.getObjectClass()); } ContainerPolicy cp = getContainerPolicy(); if (cp != null) { if (cp.getContainerClass() == null) { Class cls = session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(cp.getContainerClassName()); cp.setContainerClass(cls); } } ((XMLField) this.getField()).setIsCDATA(this.isCDATA()); }