Package org.apache.jdo.model.jdo

Examples of org.apache.jdo.model.jdo.JDOField


        }
   
        // not set => calculate
        JavaType type = null;
        if (keyTypeName != null) {
            JDOField jdoField = getDeclaringField();
            JDOClass jdoClass = jdoField.getDeclaringClass();
            JDOModel jdoModel = jdoClass.getDeclaringModel();
            type = TypeSupport.resolveType(jdoModel, keyTypeName,
                                           jdoClass.getPackagePrefix());
            if (type == null) {
                throw new ModelFatalException(
                    msg.msg("EXC_CannotResolveKeyType", keyTypeName, //NOI18N
                            jdoField.getName(), jdoClass.getName()));
            }
        }
       
        return type;
    }
View Full Code Here


        }
   
        // not set => calculate
        JavaType type = null;
        if (valueTypeName != null) {
            JDOField jdoField = getDeclaringField();
            JDOClass jdoClass = jdoField.getDeclaringClass();
            JDOModel jdoModel = jdoClass.getDeclaringModel();
            type = TypeSupport.resolveType(jdoModel, valueTypeName,
                                           jdoClass.getPackagePrefix());
            if (type == null) {
                throw new ModelFatalException(
                    msg.msg("EXC_CannotResolveValueType", valueTypeName, //NOI18N
                            jdoField.getName(), jdoClass.getName()));
            }
        }
       
        return type;
    }
View Full Code Here

        }
   
        // not set => calculate
        JavaType type = null;
        if (elementTypeName != null) {
            JDOField jdoField = getDeclaringField();
            JDOClass jdoClass = jdoField.getDeclaringClass();
            JDOModel jdoModel = jdoClass.getDeclaringModel();
            type = TypeSupport.resolveType(jdoModel, elementTypeName,
                                           jdoClass.getPackagePrefix());
            if (type == null) {
                throw new ModelFatalException(
                    msg.msg("EXC_CannotResolveElementType", elementTypeName, //NOI18N
                            jdoField.getName(), jdoClass.getName())); //NOI18N
            }
        }
       
        return type;
    }
View Full Code Here

     * @param jdoClass the declaring JDOClass of the field to be returned.
     * @return a JDOField declared by the specified jdoClass using the
     * specified mappedByName as its mappedBy name.
     */
    public synchronized JDOField resolve(String mappedByName, JDOClass jdoClass) {
        JDOField field = null;
        Map fieldMap = (Map) get(mappedByName);
        if (fieldMap != null) {
            // Get JDOField instance for specified JDOClass instance and
            // remove it directly since it is resolved.
            // Please note, remove returns the removed entry, so we do not
View Full Code Here

            // return mappedBy relationship, if explicitly set by the setter
            return mappedBy;
        }
       
        // not set => check mappedByName of declaring field
        JDOField field = getDeclaringField();
        String mappedByName = field.getMappedByName();
        if (mappedByName != null) {
            // return a JDORelationship instance for the mappedBy field name
            // as stored in the declaring field
            return getInverseRelationship();
        }
View Full Code Here

     */
    public void setMappedBy(JDORelationship mappedBy) throws ModelException {
        this.mappedBy = mappedBy;
        String mappedByName = null;
        if (mappedBy != null) {
            JDOField declaringField = mappedBy.getDeclaringField();
            if (declaringField != null) {
                mappedByName = declaringField.getName();
            }
        }
        getDeclaringField().setMappedByName(mappedByName);
        setInverseRelationship(mappedBy);
    }
View Full Code Here

        if (inverseName != null) {
            // return inverseName, if explicitly set
            return inverseName;
        }
       
        JDOField declaringField = getDeclaringField();
        String mappedByName = declaringField.getMappedByName();
        if (mappedByName != null) {
            // return mappedByName, if explicitly set on the declaring field
            return mappedByName;
        }

        // try to resolve relationship info from mappedByName of the field on
        // the other side
        UnresolvedRelationshipHelper info = getUnresolvedRelationshipHelper();
        // look for an unresolved relationship entry where the name of this
        // field is used as the mappedByName
        JDOField inverseField =
            info.resolve(declaringField.getName(), getRelatedJDOClass());
        if (inverseField != null) {
            // found inverse => update inverseName and return it
            inverseName = inverseField.getName();
            return inverseName;
        }

        // no inverse name available => return null
        return null;
View Full Code Here

        // not set => check inverse name
        String fieldName = getInverseRelationshipName();
        if (fieldName != null) {
            JDOClass relatedClass = getRelatedJDOClass();
            JDOField relatedField = relatedClass.getField(fieldName);
            if (relatedField != null)
                return relatedField.getRelationship();
        }
        return null;
    }
View Full Code Here

    {
        final JDOClass clazz = getJDOClass(classPath);
        if (clazz == null) {
            return null;
        }
        final JDOField field = clazz.getDeclaredField(fieldName);
        affirm(field == null || field.getDeclaringClass() == clazz,
               "field not declared in class: " + classPath + "." + fieldName);
        return field;
    }
View Full Code Here

    private boolean hasFieldModifier(String classPath,
                                     String fieldName,
                                     int fieldModifier)
        throws EnhancerMetaDataUserException, EnhancerMetaDataFatalError
    {
        final JDOField field = getJDOField(classPath, fieldName);
        if (field == null) {
            return false;
        }
        final int pm = field.getPersistenceModifier();
        affirm(pm != PersistenceModifier.UNSPECIFIED,
               "field modifier 'UNSPECIFIED': " + classPath + "." + fieldName);
        return (pm & fieldModifier) != 0;
    }
View Full Code Here

TOP

Related Classes of org.apache.jdo.model.jdo.JDOField

Copyright © 2018 www.massapicom. 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.