Examples of MetadataMethod


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

        classDetails.setSuperClassName(superClassName);
        classDetails.setShouldWeaveValueHolders(weaveValueHolders);
        classDetails.setShouldWeaveChangeTracking(weaveChangeTracking);
        classDetails.setShouldWeaveFetchGroups(weaveFetchGroups);
        classDetails.setShouldWeaveInternal(weaveInternal);
        MetadataMethod method = metadataClass.getMethod("clone", new ArrayList());
        classDetails.setImplementsCloneMethod(method != null);
        return classDetails;
    }
View Full Code Here

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

     * 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 != 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;
            }
View Full Code Here

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

                    if (accessor.getAccessMethods() != null) {
                        // Can't rely on MappingAccessor's getGetMethodName
                        // methods as they could result in NPE if
                        // accessibleObject isn't set first
                        String getMethodName = accessor.getAccessMethods().getGetMethodName();
                        MetadataMethod getMethod = getJavaClass().getMethod(getMethodName, new String[]{});
                        String setMethodName = accessor.getAccessMethods().getSetMethodName();
                        MetadataMethod setMethod = getJavaClass().getMethod(setMethodName, Arrays.asList(new String[]{getMethod.getReturnType()}));
                        getMethod.setSetMethod(setMethod);
                        accessibleObject = getMethod;
                    } else {
                        MetadataMethod method = getJavaClass().getMethodForPropertyName(accessor.getName());

                        if (method == null) {
                            throw ValidationException.invalidPropertyForClass(accessor.getName(), getJavaClass());
                        } else {
                            // 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() || method.isValidPersistenceMethod(getDescriptor(), true)) {   
                                accessibleObject = method;
                            }
                        } 
                    }
                } else {
View Full Code Here

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

     * INTERNAL:
     * Visit an executable and create a MetadataMethod object.
     */
    @Override
    public MetadataMethod visitExecutable(ExecutableElement executableElement, MetadataClass metadataClass) {
        MetadataMethod method = new MetadataMethod(metadataClass.getMetadataFactory(), metadataClass);
       
        // Set the name.
        method.setName(executableElement.getSimpleName().toString());
       
        // Set the attribute name.
        method.setAttributeName(Helper.getAttributeNameFromMethodName(method.getName()));
       
        // Set the modifiers.
        method.setModifiers(getModifiers(executableElement.getModifiers()));

        // Visit executable element for the parameters, return type and generic type.
        executableElement.asType().accept(typeVisitor, method);
       
        // Set the annotations.
        buildMetadataAnnotations(method, executableElement.getAnnotationMirrors());

        // Handle multiple methods with the same name.
        MetadataMethod existing = metadataClass.getMethods().get(method.getName());
        if (existing == null) {
            metadataClass.addMethod(method);
        } else {
            while (existing.getNext() != null) {
                existing = existing.getNext();
            }
            existing.setNext(method);
        }
       
        return method;
    }
View Full Code Here

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

        classDetails.setSuperClassName(superClassName);
        classDetails.setShouldWeaveValueHolders(weaveValueHolders);
        classDetails.setShouldWeaveChangeTracking(weaveChangeTracking);
        classDetails.setShouldWeaveFetchGroups(weaveFetchGroups);
        classDetails.setShouldWeaveInternal(weaveInternal);
        MetadataMethod method = metadataClass.getMethod("clone", new ArrayList());
        classDetails.setImplementsCloneMethod(method != null);
        return classDetails;
    }
View Full Code Here

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

     * 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 != null && getterMethod != null) {
            MetadataMethod method = metadataClass.getMethod(getterMethod, new ArrayList(), checkSuperclass);
            if (method == null) {
                return null;
            }
            return method.getMetadataFactory().getMetadataClass(method.getReturnType());
        } else {
            MetadataField field = metadataClass.getField(attributeName, checkSuperclass);
            if (field == null) {
                return null;
            }
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 = getMetadataClass(method.getDeclaringClass()).getMethod(method.getName(), method.getParameterTypes());
            if (metadataMethod == null) {
                continue;
            }
            if (metadataMethod.isAnnotationPresent(PostLoad.class, descriptor)) {
                setPostLoad(method);
            }
           
            if (metadataMethod.isAnnotationPresent(PostPersist.class, descriptor)) {
                setPostPersist(method);
            }
           
            if (metadataMethod.isAnnotationPresent(PostRemove.class, descriptor)) {
                setPostRemove(method);
            }
           
            if (metadataMethod.isAnnotationPresent(PostUpdate.class, descriptor)) {
                setPostUpdate(method);
            }
           
            if (metadataMethod.isAnnotationPresent(PrePersist.class, descriptor)) {
                setPrePersist(method);
            }
           
            if (metadataMethod.isAnnotationPresent(PreRemove.class, descriptor)) {
                setPreRemove(method);
            }
           
            if (metadataMethod.isAnnotationPresent(PreUpdate.class, descriptor)) {
                setPreUpdate(method);
            }
        }
    }
View Full Code Here

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

        classDetails.setShouldWeaveValueHolders(weaveValueHolders);
        classDetails.setShouldWeaveChangeTracking(weaveChangeTracking);
        classDetails.setShouldWeaveFetchGroups(weaveFetchGroups);
        classDetails.setShouldWeaveInternal(weaveInternal);
        classDetails.setShouldWeaveREST(weaveRest);
        MetadataMethod method = metadataClass.getMethod("clone", new ArrayList(), false);
        classDetails.setImplementsCloneMethod(method != null);
        return classDetails;
    }
View Full Code Here

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

    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;
            }
View Full Code Here

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

        classDetails.setSuperClassName(superClassName);
        classDetails.setShouldWeaveValueHolders(weaveValueHolders);
        classDetails.setShouldWeaveChangeTracking(weaveChangeTracking);
        classDetails.setShouldWeaveFetchGroups(weaveFetchGroups);
        classDetails.setShouldWeaveInternal(weaveInternal);
        MetadataMethod method = metadataClass.getMethod("clone", new ArrayList());
        classDetails.setImplementsCloneMethod(method != null);
        return classDetails;
    }
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.