Examples of MetadataField


Examples of org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataField

                    getDescriptor().addPKClassId(metadataMethod.getAttributeName(), metadataMethod.getRelationType());
                }
            }   
        } else {
            for (Field field : MetadataHelper.getFields(m_idClass)) {
                MetadataField metadataField = new MetadataField(field, getLogger());
               
                // The is valid check will throw an exception if needed.
                if (metadataField.isValidPersistenceField(getDescriptor())) {
                    getDescriptor().addPKClassId(field.getName(), field.getGenericType());
                }
            }
        }
    }
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataField

    /**
     * INTERNAL:
     */
    protected boolean havePersistenceAnnotationsDefined(Field[] fields) {
        for (Field field : fields) {
            MetadataField metadataField = new MetadataField(field, getLogger());
           
            if (metadataField.hasDeclaredAnnotations(getDescriptor())) {
                return true;
            }
        }
       
        return false;
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataField

     * INTERNAL:
     * Create mappings from the fields directly.
     */
    protected void processAccessorFields() {
        for (Field field : MetadataHelper.getFields(getJavaClass())) {
            MetadataField metadataField = new MetadataField(field, getLogger());
            if (metadataField.isAnnotationPresent(Transient.class)) {
                if (metadataField.hasMoreThanOneDeclaredAnnotation(getDescriptor())) {
                    throw ValidationException.mappingAnnotationsAppliedToTransientAttribute(field);
                }
            } else {
                // The is valid check will throw an exception if needed. If
                // we already have an accessor then we loaded one from XML
                // and we shouldn't re-process the accessor.
                if (metadataField.isValidPersistenceField(getDescriptor()) && ! getDescriptor().hasAccessorFor(metadataField.getAttributeName())) {
                    processAccessor(buildAccessor(metadataField));
                }
            }
        }
    }
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataField

                    Field field = MetadataHelper.getFieldForName(accessor.getName(), getJavaClass());
               
                    if (field == null) {
                        throw ValidationException.invalidFieldForClass(accessor.getName(), getJavaClass());
                    } else {
                        MetadataField metadataField = new MetadataField(field, getEntityMappings());
                   
                        // True will force an exception to be thrown if it is
                        // not a valid field. However, if it is a transient
                        // accessor, don't validate it and just let it through.
                        if (accessor.isTransient() || metadataField.isValidPersistenceField(getDescriptor(), true)) {
                            accessibleObject = metadataField;
                        }
                    }
                }
               
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataField

                    getDescriptor().addPKClassId(metadataMethod.getAttributeName(), metadataMethod.getRelationType());
                }
            }   
        } else {
            for (Field field : MetadataHelper.getFields(m_idClass)) {
                MetadataField metadataField = new MetadataField(field, getLogger());
               
                // The is valid check will throw an exception if needed.
                if (metadataField.isValidPersistenceField(false, getDescriptor())) {
                    getDescriptor().addPKClassId(field.getName(), field.getGenericType());
                }
            }
        }
    }
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataField

                    Field field = MetadataHelper.getFieldForName(accessor.getName(), getJavaClass());
               
                    if (field == null) {
                        throw ValidationException.invalidFieldForClass(accessor.getName(), getJavaClass());
                    } else {
                        MetadataField metadataField = new MetadataField(field, getEntityMappings());
                   
                        // True will force an exception to be thrown if it is
                        // not a valid field. However, if it is a transient
                        // accessor, don't validate it and just let it through.
                        if (accessor.isTransient() || metadataField.isValidPersistenceField(getDescriptor(), true)) {
                            accessibleObject = metadataField;
                        }
                    }
                }
               
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataField

    /**
     * INTERNAL:
     */
    protected boolean havePersistenceAnnotationsDefined(Field[] fields) {
        for (Field field : fields) {
            MetadataField metadataField = new MetadataField(field, getLogger());
           
            if (metadataField.hasDeclaredAnnotations(getDescriptor())) {
                return true;
            }
        }
       
        return false;
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataField

     * setting and for a field to be processed it must have a Access(FIELD)
     * setting.
     */
    protected void processAccessorFields(boolean processingInverse) {
        for (Field field : MetadataHelper.getFields(getJavaClass())) {
            MetadataField metadataField = new MetadataField(field, getLogger());
            if (metadataField.isAnnotationPresent(Transient.class)) {
                if (metadataField.hasMoreThanOneDeclaredAnnotation(getDescriptor())) {
                    throw ValidationException.mappingAnnotationsAppliedToTransientAttribute(field);
                }
            } else {
                // The is valid check will throw an exception if needed.
                if (metadataField.isValidPersistenceField(processingInverse, getDescriptor())) {
                    // If the accessor already exists, it may have come from XML
                    // or because of an explicit access type setting. E.G.
                    // Access type is property and we processed the access
                    // methods for this field, however the field has been tagged
                    // as access field. We must therefore overwrite the previous
                    // accessor with this explicit one.
                    if (! getDescriptor().hasAccessorFor(metadataField.getAttributeName()) || (getDescriptor().hasAccessorFor(metadataField.getAttributeName()) && processingInverse)) {
                        getDescriptor().addAccessor(buildAccessor(metadataField));
                    }
                }
            }
        }
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataField

     * INTERNAL:
     * Return the accessible field for the given mapping accessor. Validation is
     * performed on the existence of the field.
     */
    protected MetadataField getAccessibleField(MappingAccessor accessor) {
        MetadataField field = getJavaClass().getField(accessor.getName());
       
        if (field == null) {
            throw ValidationException.invalidFieldForClass(accessor.getName(), getJavaClass());
        } else {
            // True will force an exception to be thrown if it is not a valid
            // field. However, if it is a transient accessor, don't validate it
            // and return.
            if (accessor.isTransient() || field.isValidPersistenceField(this, true)) {
                return field;   
            }
           
            return null;
        }
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataField

    /**
     * Return the class which is the source of the attribute.
     * i.e. the class that defines the attribute in its class file.
     */
    private MetadataClass getAttributeDeclaringClass(MetadataClass metadataClass, String attributeName) {      
        MetadataField field = metadataClass.getField(attributeName);
        return field.getDeclaringClass();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.