/** * PUBLIC: * This is a very specific protocol which maps fieldValues "Y" and "N" * to "Yes" and "No" respectively. */ public void mapResponses() { addConversionValue("Y", "Yes"); addConversionValue("N", "No"); }
/** * INTERNAL: * Return the classifiction for the field contained in the mapping. * This is used to convert the row value to a consistent java value. * By default this is null which means unknown. */ public Class getFieldClassification(DatabaseField fieldToClassify) { return getFieldClassification(); }
/** * INTERNAL: * Set the mapping. */ public void initialize(DatabaseMapping mapping, Session session) { this.mapping = mapping; initializeFieldClassification(session); }
public void convertClassNamesToClasses(ClassLoader classLoader){ super.convertClassNamesToClasses(classLoader); if (valueConverter != null) { if (valueConverter instanceof TypeConversionConverter) { ((TypeConversionConverter)valueConverter).convertClassNamesToClasses(classLoader); } else if (valueConverter instanceof ObjectTypeConverter) { // To avoid 1.5 dependencies with the EnumTypeConverter check // against ObjectTypeConverter. ((ObjectTypeConverter) valueConverter).convertClassNamesToClasses(classLoader); } } }
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; }
/** * INTERNAL: * Convert the attribute value to a field value. * Process any converter if defined. */ public Object getFieldValue(Object attributeValue, AbstractSession session) { if (this.valueConverter != null) { return this.valueConverter.convertObjectValueToDataValue(attributeValue, session); } return attributeValue; }
/** * INTERNAL: * Convert all the class-name-based settings in this converter to actual * class-based settings. This method is used when converting a project * that has been built with class names to a project with classes. */ public void convertClassNamesToClasses(ClassLoader classLoader) { constructAttributeConverter(classLoader); constructFieldClassification(classLoader); }
/** * PUBLIC: * This is a very specific protocol which maps fieldValues "F" and "M" * to "Female" and "Male" respectively. */ public void mapGenders() { addConversionValue("F", "Female"); addConversionValue("M", "Male"); }
/** * INTERNAL: * Return the classifiction for the field contained in the mapping. * This is used to convert the row value to a consistent java value. * By default this is null which means unknown. */ public Class getFieldClassification(DatabaseField fieldToClassify) { return getFieldClassification(); }
/** * INTERNAL: * Set the mapping. */ public void initialize(DatabaseMapping mapping, Session session) { this.mapping = mapping; initializeFieldClassification(session); }
/** * INTERNAL: * Convert the attribute value to a field value. * Process any converter if defined. */ public Object getFieldValue(Object attributeValue, AbstractSession session) { if (this.valueConverter != null) { return this.valueConverter.convertObjectValueToDataValue(attributeValue, session); } return attributeValue; }
/** * PUBLIC: * This is a very specific protocol which maps fieldValues "Y" and "N" * to "Yes" and "No" respectively. */ public void mapResponses() { addConversionValue("Y", "Yes"); addConversionValue("N", "No"); }
/** * INTERNAL: * Return the classifiction for the field contained in the mapping. * This is used to convert the row value to a consistent java value. * By default this is null which means unknown. */ public Class getFieldClassification(DatabaseField fieldToClassify) { return getFieldClassification(); }
/** * INTERNAL: * Set the mapping. */ public void initialize(DatabaseMapping mapping, Session session) { this.mapping = mapping; initializeFieldClassification(session); }
/** * INTERNAL: * Convert the attribute value to a field value. * Process any converter if defined. */ public Object getFieldValue(Object attributeValue, AbstractSession session) { if (this.valueConverter != null) { return this.valueConverter.convertObjectValueToDataValue(attributeValue, session); } return attributeValue; }
/** * PUBLIC: * This is a very specific protocol which maps fieldValues "Y" and "N" * to "Yes" and "No" respectively. */ public void mapResponses() { addConversionValue("Y", "Yes"); addConversionValue("N", "No"); }
/** * PUBLIC: * This is a very specific protocol which maps fieldValues "T" and "F" * to true and false respectively. */ public void mapBooleans() { addConversionValue("F", Boolean.FALSE); addConversionValue("T", Boolean.TRUE); }
/** * PUBLIC: * This is a very specific protocol which maps fieldValues "F" and "M" * to "Female" and "Male" respectively. */ public void mapGenders() { addConversionValue("F", "Female"); addConversionValue("M", "Male"); }
/** * PUBLIC: * This is a very specific protocol which maps fieldValues "F" and "M" * to "Female" and "Male" respectively. */ public void mapGenders() { addConversionValue("F", "Female"); addConversionValue("M", "Male"); }
/** * PUBLIC: * This is a very specific protocol which maps fieldValues "T" and "F" * to true and false respectively. */ public void mapBooleans() { addConversionValue("F", Boolean.FALSE); addConversionValue("T", Boolean.TRUE); }