/** * Sets the value of the instance variable in the object to the value. */ @Override public void setAttributeValueInObject(Object domainObject, Object attributeValue) throws DescriptorException { setAttributeValueInObject(domainObject, attributeValue, new Object[] {getAttributeName(), attributeValue}); }
/** * Gets the value of an instance variable in the object. */ @Override public Object getAttributeValueFromObject(Object anObject) throws DescriptorException { return getAttributeValueFromObject(anObject, new Object[] {getAttributeName()}); }
/** * Return the set method parameter types. */ @Override protected Class[] getSetMethodParameterTypes() { return new Class[] {String.class, getGetMethodReturnType()}; }
Mapping mapping = generateMapping(next, descriptor, descriptorJavaClass, namespaceInfo); if (next.isVirtual()) { VirtualAttributeAccessor accessor = new VirtualAttributeAccessor(); accessor.setAttributeName(mapping.getAttributeName()); getMethod = ((MethodAttributeAccessor) mapping.getAttributeAccessor()).getGetMethodName(); setMethod = ((MethodAttributeAccessor) mapping.getAttributeAccessor()).getSetMethodName(); accessor.setValueType(mapping.getAttributeClassification()); accessor.setGetMethodName(getMethod); accessor.setSetMethodName(setMethod);
/** * Update the targetMapping to have the same accessor as the originMapping * @param originMapping * @param targetMapping */ private static void copyAccessorToMapping(DatabaseMapping originMapping, DatabaseMapping targetMapping) { if (originMapping.getAttributeAccessor().isVirtualAttributeAccessor()) { VirtualAttributeAccessor accessor = new VirtualAttributeAccessor(); accessor.setGetMethodName(originMapping.getGetMethodName()); accessor.setSetMethodName(originMapping.getSetMethodName()); targetMapping.setAttributeAccessor(accessor); } if (originMapping.getAttributeAccessor().isValuesAccessor()) { ValuesAccessor accessor = new ValuesAccessor(originMapping); accessor.setAttributeName(originMapping.getAttributeAccessor().getAttributeName()); targetMapping.setAttributeAccessor(accessor); } else { targetMapping.setAttributeName(originMapping.getAttributeName()); targetMapping.setGetMethodName(originMapping.getGetMethodName()); targetMapping.setSetMethodName(originMapping.getSetMethodName()); } }
if (owningType.getXmlVirtualAccessMethods() == null) { XmlVirtualAccessMethods virtualAccessMethods = new XmlVirtualAccessMethods(); virtualAccessMethods.setGetMethod(jpaAccessor.getGetMethodName()); virtualAccessMethods.setSetMethod(jpaAccessor.getSetMethodName()); owningType.setXmlVirtualAccessMethods(virtualAccessMethods); } else if (!owningType.getXmlVirtualAccessMethods().getGetMethod().equals(jpaAccessor.getGetMethodName())) { XmlAccessMethods accessMethods = new XmlAccessMethods(); accessMethods.setGetMethod(jpaAccessor.getGetMethodName()); accessMethods.setSetMethod(jpaAccessor.getSetMethodName()); xmlElement.setXmlAccessMethods(accessMethods);
/** * INTERNAL: * Set the getter and setter access methods for this accessor. */ protected void setAccessorMethods(DatabaseMapping mapping) { if (usesPropertyAccess() || usesVirtualAccess()) { if (usesVirtualAccess()) { mapping.setAttributeAccessor(new VirtualAttributeAccessor()); } mapping.setGetMethodName(getGetMethodName()); mapping.setSetMethodName(getSetMethodName()); } }
/** * Set get and set method after creating these methods by using * get and set method names */ @Override public void initializeAttributes(Class theJavaClass) throws DescriptorException { initializeAttributes(theJavaClass, new Class[] { String.class }); }
/** * Return the set method parameter type. In a name access usage there must * be an extra String parameter along with the Object.class type so we must * check and return a different index from the parameter types. */ @Override public Class getSetMethodParameterType() { return getSetMethodParameterType(1); }
Mapping mapping = generateMapping(next, descriptor, descriptorJavaClass, namespaceInfo); if (next.isVirtual()) { VirtualAttributeAccessor accessor = new VirtualAttributeAccessor(); accessor.setAttributeName(mapping.getAttributeName()); getMethod = ((MethodAttributeAccessor) mapping.getAttributeAccessor()).getGetMethodName(); setMethod = ((MethodAttributeAccessor) mapping.getAttributeAccessor()).getSetMethodName(); accessor.setValueType(mapping.getAttributeClassification()); accessor.setGetMethodName(getMethod); accessor.setSetMethodName(setMethod);
/** * Update the targetMapping to have the same accessor as the originMapping * @param originMapping * @param targetMapping */ private static void copyAccessorToMapping(DatabaseMapping originMapping, DatabaseMapping targetMapping) { if (originMapping.getAttributeAccessor().isVirtualAttributeAccessor()) { VirtualAttributeAccessor accessor = new VirtualAttributeAccessor(); accessor.setGetMethodName(originMapping.getGetMethodName()); accessor.setSetMethodName(originMapping.getSetMethodName()); targetMapping.setAttributeAccessor(accessor); } if (originMapping.getAttributeAccessor().isValuesAccessor()) { ValuesAccessor accessor = new ValuesAccessor(originMapping); accessor.setAttributeName(originMapping.getAttributeAccessor().getAttributeName()); targetMapping.setAttributeAccessor(accessor); } else { targetMapping.setAttributeName(originMapping.getAttributeName()); targetMapping.setGetMethodName(originMapping.getGetMethodName()); targetMapping.setSetMethodName(originMapping.getSetMethodName()); } }
if (owningType.getXmlVirtualAccessMethods() == null) { XmlVirtualAccessMethods virtualAccessMethods = new XmlVirtualAccessMethods(); virtualAccessMethods.setGetMethod(jpaAccessor.getGetMethodName()); virtualAccessMethods.setSetMethod(jpaAccessor.getSetMethodName()); owningType.setXmlVirtualAccessMethods(virtualAccessMethods); } else if (!owningType.getXmlVirtualAccessMethods().getGetMethod().equals(jpaAccessor.getGetMethodName())) { XmlAccessMethods accessMethods = new XmlAccessMethods(); accessMethods.setGetMethod(jpaAccessor.getGetMethodName()); accessMethods.setSetMethod(jpaAccessor.getSetMethodName()); xmlElement.setXmlAccessMethods(accessMethods);
/** * Set get and set method after creating these methods by using * get and set method names */ @Override public void initializeAttributes(Class theJavaClass) throws DescriptorException { initializeAttributes(theJavaClass, new Class[] { String.class }); }
/** * Return the set method parameter type. In a name access usage there must * be an extra String parameter along with the Object.class type so we must * check and return a different index from the parameter types. */ @Override public Class getSetMethodParameterType() { return getSetMethodParameterType(1); }
/** * Sets the value of the instance variable in the object to the value. */ @Override public void setAttributeValueInObject(Object domainObject, Object attributeValue) throws DescriptorException { setAttributeValueInObject(domainObject, attributeValue, new Object[] {getAttributeName(), attributeValue}); }
/** * Gets the value of an instance variable in the object. */ @Override public Object getAttributeValueFromObject(Object anObject) throws DescriptorException { return getAttributeValueFromObject(anObject, new Object[] {getAttributeName()}); }
/** * Return the set method parameter types. */ @Override protected Class[] getSetMethodParameterTypes() { return new Class[] {String.class, getGetMethodReturnType()}; }