Examples of MetadataMethod


Examples of oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.objects.MetadataMethod

     * Create mappings via the class properties.
     */
    protected void processAccessorMethods() {
        for (Method method : MetadataHelper.getDeclaredMethods(getJavaClass())) {
            if (isValidPersistenceMethod(method)) {
                processAccessor(buildAccessor(new MetadataMethod(method)));
            }
        }
    }
View Full Code Here

Examples of oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.objects.MetadataMethod

           
            if (method == null) {
                m_validator.throwUnableToDetermineClassForProperty(attributeName, getJavaClass());
            }
           
            accessibleObject = new MetadataMethod(method);
        } else {
            Field field = MetadataHelper.getFieldForName(attributeName, getJavaClass());
           
            if (field == null) {
                m_validator.throwUnableToDetermineClassForField(attributeName, getJavaClass());
View Full Code Here

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

            setPreUpdate(getCallbackMethod(m_preUpdate, methods));
        }
       
        // 2 - Set any annotation defined methods second.
        for (Method method : methods) {
            MetadataMethod metadataMethod = new MetadataMethod(method, logger);
           
            if (metadataMethod.isAnnotationPresent(PostLoad.class)) {
                setPostLoad(method);
            }
           
            if (metadataMethod.isAnnotationPresent(PostPersist.class)) {
                setPostPersist(method);
            }
           
            if (metadataMethod.isAnnotationPresent(PostRemove.class)) {
                setPostRemove(method);
            }
           
            if (metadataMethod.isAnnotationPresent(PostUpdate.class)) {
                setPostUpdate(method);
            }
           
            if (metadataMethod.isAnnotationPresent(PrePersist.class)) {
                setPrePersist(method);
            }
           
            if (metadataMethod.isAnnotationPresent(PreRemove.class)) {
                setPreRemove(method);
            }
           
            if (metadataMethod.isAnnotationPresent(PreUpdate.class)) {
                setPreUpdate(method);
            }
        }
    }
View Full Code Here

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

       
        public void setValue(Object object, Object value) {
            try {
                if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
                    try {
                        AccessController.doPrivileged(new PrivilegedMethodInvoker(new MetadataMethod(method, object.getClass()).getSetMethod(), object, new Object[] {value}));
                    } catch (PrivilegedActionException exception) {
                        Exception throwableException = exception.getException();
                        if (throwableException instanceof IllegalAccessException) {
                            throw (IllegalAccessException)throwableException;
                        } else {
                            throw (java.lang.reflect.InvocationTargetException)throwableException;
                        }
                    }
                } else {
                    PrivilegedAccessHelper.invokeMethod(new MetadataMethod(method, object.getClass()).getSetMethod(), object, new Object[] {value});
                }
            } catch (Exception ex) {
                throw DescriptorException.errorUsingPrimaryKey(object, getDescriptor(), ex);
            }
        }
View Full Code Here

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

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

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

                        String getMethodName = accessor.getAccessMethods().getGetMethodName();
                        Method getMethod = MetadataHelper.getMethod(getMethodName, getJavaClass(), new Class[]{});
                        String setMethodName = accessor.getAccessMethods().getSetMethodName();
                        Method setMethod = MetadataHelper.getMethod(setMethodName, getJavaClass(), new Class[]{getMethod.getReturnType()});
                       
                        accessibleObject = new MetadataMethod(getMethod, setMethod, accessor.getName(), getEntityMappings());
                    } else {
                        Method method = MetadataHelper.getMethodForPropertyName(accessor.getName(), getJavaClass());
                       
                        if (method == null) {
                            throw ValidationException.invalidPropertyForClass(accessor.getName(), getJavaClass());
                        } else {
                            MetadataMethod metadataMethod = new MetadataMethod(method, getEntityMappings());
                           
                            // True will force an exception to be thrown if it
                            // is not a valid method. However, if it is a
                            // transient accessor, don't validate it and just
                            // let it through.
                            if (accessor.isTransient() || metadataMethod.isValidPersistenceMethod(getDescriptor(), true)) {   
                                accessibleObject = metadataMethod;
                            }
                        } 
                    }
                } else {
View Full Code Here

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

    /**
     * INTERNAL:
     */
    protected boolean havePersistenceAnnotationsDefined(Method[] methods) {
        for (Method method : methods) {
            MetadataMethod metadataMethod = new MetadataMethod(method, getLogger());
           
            if (metadataMethod.hasDeclaredAnnotations(getDescriptor())) {
                return true;
            }
        }
       
        return false;
View Full Code Here

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

     * setting and for a field to be processed it must have a Access(PROPERTY)
     * setting.
     */
    protected void processAccessorMethods(boolean processingInverse) {
        for (Method method : MetadataHelper.getDeclaredMethods(getJavaClass())) {
            MetadataMethod metadataMethod = new MetadataMethod(method, getLogger());
           
            if (metadataMethod.isAnnotationPresent(Transient.class)) {   
                if (metadataMethod.hasMoreThanOneDeclaredAnnotation(getDescriptor())) {
                    throw ValidationException.mappingAnnotationsAppliedToTransientAttribute(method);
                }
            } else {
                // The is valid check will throw an exception if needed.
                if (metadataMethod.isValidPersistenceMethod(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 field however the user indicated the we
                    // should use its access methods. We must therefore
                    // overwrite the previous accessor with this explicit one.
                    if (! getDescriptor().hasAccessorFor(metadataMethod.getAttributeName()) || (getDescriptor().hasAccessorFor(metadataMethod.getAttributeName()) && processingInverse)) {
                        getDescriptor().addAccessor(buildAccessor(metadataMethod));
                    }
                }
            }
        }
View Full Code Here

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

       
        public void setValue(Object object, Object value) {
            try {
                if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
                    try {
                        AccessController.doPrivileged(new PrivilegedMethodInvoker(new MetadataMethod(method, object.getClass()).getSetMethod(), object, new Object[] {value}));
                    } catch (PrivilegedActionException exception) {
                        Exception throwableException = exception.getException();
                        if (throwableException instanceof IllegalAccessException) {
                            throw (IllegalAccessException)throwableException;
                        } else {
                            throw (java.lang.reflect.InvocationTargetException)throwableException;
                        }
                    }
                } else {
                    PrivilegedAccessHelper.invokeMethod(new MetadataMethod(method, object.getClass()).getSetMethod(), object, new Object[] {value});
                }
            } catch (Exception ex) {
                throw DescriptorException.errorUsingPrimaryKey(object, getDescriptor(), ex);
            }
        }
View Full Code Here

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

            setPreUpdate(getCallbackMethod(m_preUpdate, methods));
        }
       
        // 2 - Set any annotation defined methods second.
        for (Method method : methods) {
            MetadataMethod metadataMethod = new MetadataMethod(method, logger);
           
            if (metadataMethod.isAnnotationPresent(PostLoad.class)) {
                setPostLoad(method);
            }
           
            if (metadataMethod.isAnnotationPresent(PostPersist.class)) {
                setPostPersist(method);
            }
           
            if (metadataMethod.isAnnotationPresent(PostRemove.class)) {
                setPostRemove(method);
            }
           
            if (metadataMethod.isAnnotationPresent(PostUpdate.class)) {
                setPostUpdate(method);
            }
           
            if (metadataMethod.isAnnotationPresent(PrePersist.class)) {
                setPrePersist(method);
            }
           
            if (metadataMethod.isAnnotationPresent(PreRemove.class)) {
                setPreRemove(method);
            }
           
            if (metadataMethod.isAnnotationPresent(PreUpdate.class)) {
                setPreUpdate(method);
            }
        }
    }
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.