/** * INTERNAL: * Convert the attribute value to a field value. * Process any converter if defined, and check for null values. */ public Object getFieldValue(Object attributeValue, CoreAbstractSession session, AbstractMarshalRecord record) { // Marshal // PERF: This method is a major performance code point, // so has been micro optimized and uses direct variable access. Object fieldValue = attributeValue; if ((this.nullValue != null) && (this.nullValue.equals(fieldValue)) && !this.isNullValueMarshalled && !((XMLField)field).isRequired()) { return null; } // Allow for user defined conversion to the object value. fieldValue = convertObjectValueToDataValue(fieldValue, (AbstractSession) session, (XMLMarshaller) record.getMarshaller()); if (fieldValue != null) { Class fieldClassification = getFieldClassification(field); // PERF: Avoid conversion if not required. if(fieldClassification != fieldValue.getClass()){ try { fieldValue = session.getPlatform(descriptor.getJavaClass()).convertObject(fieldValue, fieldClassification); } catch (ConversionException exception) { throw ConversionException.couldNotBeConverted(this, descriptor, exception); } } } return fieldValue; }
/** * INTERNAL: * Convert the attribute value to a field value. * Process any converter if defined, and check for null values. */ public Object getFieldValue(Object attributeValue, CoreAbstractSession session, AbstractMarshalRecord record) { // Marshal // PERF: This method is a major performance code point, // so has been micro optimized and uses direct variable access. Object fieldValue = attributeValue; if ((this.nullValue != null) && (this.nullValue.equals(fieldValue)) && !this.isNullValueMarshalled && !((XMLField)field).isRequired()) { return null; } // Allow for user defined conversion to the object value. fieldValue = convertObjectValueToDataValue(fieldValue, (AbstractSession) session, (XMLMarshaller) record.getMarshaller()); if (fieldValue != null) { Class fieldClassification = getFieldClassification(field); // PERF: Avoid conversion if not required. if(fieldClassification != fieldValue.getClass()){ try { fieldValue = session.getPlatform(descriptor.getJavaClass()).convertObject(fieldValue, fieldClassification); } catch (ConversionException exception) { throw ConversionException.couldNotBeConverted(this, descriptor, exception); } } } return fieldValue; }
Class fieldClassification = getFieldClassification(getField());