/** * Use the database mapping for an attribute to find it's type. The type returned will either be * the field type of the field in the object or the type returned by the getter method. */ private MetadataClass getAttributeTypeFromClass(MetadataClass metadataClass, String attributeName, DatabaseMapping mapping, boolean checkSuperclass){ String getterMethod = mapping.getGetMethodName(); if (mapping.isAbstractDirectMapping() && mapping.getAttributeAccessor().isVirtualAttributeAccessor()){ return metadataClass.getMetadataClass(((AbstractDirectMapping)mapping).getAttributeClassificationName()); } else if (mapping != null && getterMethod != null) { MetadataMethod method = metadataClass.getMethod(getterMethod, new ArrayList(), checkSuperclass); if (method == null) { return null; } return method.getMetadataClass(method.getReturnType()); } else { MetadataField field = metadataClass.getField(attributeName, checkSuperclass); if (field == null) { return null; } return field.getMetadataClass(field.getType()); } }
AttributeDetails attributeDetails = new AttributeDetails(attribute, mapping); if (mapping.getAttributeAccessor().isVirtualAttributeAccessor()){ attributeDetails.setVirtualProperty(mapping.getAttributeAccessor().isVirtualAttributeAccessor()); if ((classDetails.getInfoForVirtualGetMethod(mapping.getGetMethodName()) == null) && (classDetails.getInfoForVirtualSetMethod(mapping.getSetMethodName()) == null)){ VirtualAttributeMethodInfo info = new VirtualAttributeMethodInfo(mapping.getGetMethodName(), mapping.getSetMethodName());
if (!mapping.getAttributeAccessor().isVirtualAttributeAccessor() && !isDynamic) { return null; xmlElement.setType(mapping.getAttributeClassification().getName()); if (mapping.getAttributeAccessor().isVirtualAttributeAccessor()) { VirtualAttributeAccessor jpaAccessor = (VirtualAttributeAccessor) mapping.getAttributeAccessor(); if (owningType.getXmlVirtualAccessMethods() == null) {
/** * 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()); } }
/** * 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 (!mapping.getAttributeAccessor().isVirtualAttributeAccessor() && !isDynamic) { return null; xmlElement.setType(mapping.getAttributeClassification().getName()); if (mapping.getAttributeAccessor().isVirtualAttributeAccessor()) { VirtualAttributeAccessor jpaAccessor = (VirtualAttributeAccessor) mapping.getAttributeAccessor(); if (owningType.getXmlVirtualAccessMethods() == null) {