/** * INTERNAL: * Return the attribute transformer's class. * This is used to map to XML. */ public Class getAttributeTransformerClass() { if ((getAttributeTransformer() == null) || (getAttributeTransformer() instanceof MethodBasedAttributeTransformer)) { return null; } return getAttributeTransformer().getClass(); }
/** * INTERNAL: * Return if the transformation has no attribute, is write only. */ public boolean isWriteOnly() { return (getAttributeName() == null) && ((getAttributeTransformer() == null) && (getAttributeTransformerClassName() == null)); }
/** * PUBLIC: * Return the attribute transformation method name. */ public String getAttributeMethodName() { if (getAttributeTransformer() instanceof MethodBasedAttributeTransformer) { return ((MethodBasedAttributeTransformer)getAttributeTransformer()).getMethodName(); } return null; }
/** * INTERNAL: * Validate mapping declaration */ public void validateBeforeInitialization(AbstractSession session) throws DescriptorException { super.validateBeforeInitialization(session); if (isWriteOnly()) { return; } if ((getAttributeTransformer() == null) && (getAttributeTransformerClassName() == null)) { session.getIntegrityChecker().handleError(DescriptorException.noAttributeTransformationMethod(this)); } if (getAttributeAccessor() instanceof InstanceVariableAttributeAccessor) { Class attributeType = ((InstanceVariableAttributeAccessor)getAttributeAccessor()).getAttributeType(); getIndirectionPolicy().validateDeclaredAttributeType(attributeType, session.getIntegrityChecker()); } else if (getAttributeAccessor().isMethodAttributeAccessor()) { Class returnType = ((MethodAttributeAccessor)getAttributeAccessor()).getGetMethodReturnType(); getIndirectionPolicy().validateGetMethodReturnType(returnType, session.getIntegrityChecker()); Class parameterType = ((MethodAttributeAccessor)getAttributeAccessor()).getSetMethodParameterType(); getIndirectionPolicy().validateSetMethodParameterType(parameterType, session.getIntegrityChecker()); } }
/** * INTERNAL: * Invoke the buildAttributeValue method on the AttributeTransformer */ public Object invokeAttributeTransformer(AbstractRecord record, Object domainObject, AbstractSession session) throws DescriptorException { return getAttributeTransformer().buildAttributeValue(record, domainObject, session); }
/** * INTERNAL: * Return the value to be stored in the object's attribute. * This value is determined by invoking the appropriate * method on the object and passing it the row and session. * In this case, wrap the row in a ValueHolder for later use. */ public Object valueFromMethod(Object object, AbstractRecord row, AbstractSession session) { return new TransformerBasedValueHolder(this.getTransformationMapping().getAttributeTransformer(), object, row, session); }
/** * INTERNAL: * Convert the attribute transformer class name into an AttributeTransformer * If the old-style method name in set, then use a MethodBasedAttributeTRansformer */ protected void initializeAttributeTransformer(AbstractSession databaseSession) throws DescriptorException { if (isWriteOnly()) { return; } getAttributeTransformer().initialize(this); }
/** * INTERNAL: * Return the value to be stored in the object's attribute. * This value is determined by invoking the appropriate * method on the object and passing it the row and session. * In this case, wrap the row in a ValueHolder for later use. */ public Object valueFromMethod(Object object, AbstractRecord row, AbstractSession session) { return new TransformerBasedValueHolder(this.getTransformationMapping().getAttributeTransformer(), object, row, session); }
/** * INTERNAL: * Return the value to be stored in the object's attribute. * This value is determined by invoking the appropriate * method on the object and passing it the row and session. * In this case, wrap the row in a ValueHolder for later use. */ public Object valueFromMethod(Object object, AbstractRecord row, AbstractSession session) { return new TransformerBasedValueHolder(this.getTransformationMapping().getAttributeTransformer(), object, row, session); }
/** * INTERNAL: * Return the value to be stored in the object's attribute. * This value is determined by invoking the appropriate method on the object and passing it the * row and session. */ public Object valueFromMethod(Object object, AbstractRecord row, AbstractSession session) { ValueHolderInterface valueHolder = new TransformerBasedValueHolder(this.getTransformationMapping().getAttributeTransformer(), object, row, session); return ProxyIndirectionHandler.newProxyInstance(object.getClass(), targetInterfaces, valueHolder); }
/** * INTERNAL: * Return the value to be stored in the object's attribute. * This value is determined by invoking the appropriate method on the object and passing it the * row and session. */ public Object valueFromMethod(Object object, AbstractRecord row, AbstractSession session) { ValueHolderInterface valueHolder = new TransformerBasedValueHolder(this.getTransformationMapping().getAttributeTransformer(), object, row, session); return ProxyIndirectionHandler.newProxyInstance(object.getClass(), targetInterfaces, valueHolder); }
/** * INTERNAL: * Return the value to be stored in the object's attribute. * This value is determined by invoking the appropriate method on the object and passing it the * row and session. */ public Object valueFromMethod(Object object, AbstractRecord row, AbstractSession session) { ValueHolderInterface valueHolder = new TransformerBasedValueHolder(this.getTransformationMapping().getAttributeTransformer(), object, row, session); return ProxyIndirectionHandler.newProxyInstance(object.getClass(), targetInterfaces, valueHolder); }