Examples of JDOField


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

     */
    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

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

        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

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

        // 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

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

    {
        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

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

    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

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

                   "cannot find class file for class: " + classPath);
            JavaField javaField = javaClass.getJavaField(fieldName);
            affirm(javaField != null,
                   "cannot find java field " + classPath + "." + fieldName);
            JavaType fieldType = javaField.getType();
            JDOField field = clazz.getField(fieldName);
            // if field not known by JDOClass (not specified in JDO XML),
            // create the field only if the model's method of default
            // calculation would yield a persistent field.  We must not
            // change the models state by newly created fields with
            // a persistence-modifier "none", because this would lead to
            // in a different annotation by isKnownNonManagedField().
            if (field == null
                && TypeSupport.isPersistenceFieldType(fieldType)) {
                field = clazz.createJDOField(fieldName);
                affirm(field != null,
                       "cannot create JDO field: "
                       + classPath + "." + fieldName);
            }
            field.setJavaField(javaField);
            affirm(fieldType == field.getType());
            affirm(field.getPersistenceModifier()
                   != PersistenceModifier.UNSPECIFIED,
                   "known, unspecified JDO field: " + classPath + "." + fieldName);
        } catch (ModelFatalException ex) {
            throw new EnhancerMetaDataUserException(ex);
        } catch (ModelException ex) {
View Full Code Here

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

                return true;
            }
           
            // check whether field is managed only if field's
            // persistence-modifier is known by the JDO model
            final JDOField field = clazz.getField(fieldName);
            if (field != null && (field.getPersistenceModifier()
                                  != PersistenceModifier.UNSPECIFIED)) {
                // only field's persistence-modifier known by model
                return !field.isManaged();
            }

            // field not known by JDOClass (not specified in JDO XML)
            // apply model's method of default calculation without
            // changing the model's state
View Full Code Here

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

     * Tests whether a field of a class is known to be Key.
     */
    public boolean isKeyField(String classPath, String fieldName)
        throws EnhancerMetaDataUserException, EnhancerMetaDataFatalError
    {
        final JDOField field = getJDOField(classPath, fieldName);
        if (field == null) {
            return false;
        }
        return field.isPrimaryKey();
    }
View Full Code Here

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

     * Default Fetch Group.
     */
    public boolean isDefaultFetchGroupField(String classPath, String fieldName)
        throws EnhancerMetaDataUserException, EnhancerMetaDataFatalError
    {
        final JDOField field = getJDOField(classPath, fieldName);
        if (field == null) {
            return false;
        }
        return field.isDefaultFetchGroup();
    }
View Full Code Here

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

     * class.
     */
    public int getFieldNumber(String classPath, String fieldName)
        throws EnhancerMetaDataUserException, EnhancerMetaDataFatalError
    {
        final JDOField field = getJDOField(classPath, fieldName);
        if (field == null) {
            return -1;
        }
        return field.getRelativeFieldNumber();
    }
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.