Package org.apache.jdo.model.java

Examples of org.apache.jdo.model.java.JavaType


    {
        affirm(classPath);
        affirm(fieldName);
        final String className = classPath.replace('/', '.');
        try {
            final JavaType javaType = javaModel.getJavaType(className);
            final JavaField javaField = javaType.getJavaField(fieldName);
            final JavaType declaringClass = javaField.getDeclaringClass();
            return declaringClass.getName().replace('.', '/');
        } catch (ModelFatalException ex) {
            throw new EnhancerMetaDataUserException(ex);
        }
    }
View Full Code Here


    {       
        affirm(classPath);
        affirm(fieldName);
        try {
            final JDOClass clazz = getJDOClass(classPath);
            JavaType javaClass = clazz.getJavaType();
            affirm(javaClass != null,
                   "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
View Full Code Here

     */
    public boolean isSerializableClass(String classPath)
        throws EnhancerMetaDataUserException, EnhancerMetaDataFatalError
    {
        final String className = classPath.replace('/', '.');
        final JavaType javaType = javaModel.getJavaType(className);
        return javaType.isCompatibleWith(serializableJavaType);
    }
View Full Code Here

            }

            // field not known by JDOClass (not specified in JDO XML)
            // apply model's method of default calculation without
            // changing the model's state
            JavaType fieldType = javaModel.getJavaType(javaModel.getTypeName(fieldSig));
            affirm(fieldType != null,
                   "cannot get java type for: " + fieldSig);
            return !TypeSupport.isPersistenceFieldType(fieldType);
        } catch (ModelFatalException ex) {
            throw new EnhancerMetaDataUserException(ex);
View Full Code Here

    public JavaField getJavaField() {
        if (javaField == null) {
            // not set => calculate
            // Please note, cannot call super.getJavaField, because it
            // returns a JavaField!
            JavaType javaType = getDeclaringClass().getJavaType();
            javaField = javaType.getJavaProperty(getName());
        }
        return javaField;
    }
View Full Code Here

     * <code>null</code> if it cannot be resolved.
     */
    public static JavaType resolveType(JDOModel jdoModel, String typeName,
                                       String packagePrefix)
    {
        JavaType type = null;
        JavaModel javaModel = jdoModel.getJavaModel();
        if (primitiveTypeNames.contains(typeName) ||
            (typeName.indexOf('.') != -1) ||
            (packagePrefix == null) || (packagePrefix.length() == 0)) {
            // Take the typeName as specified,
View Full Code Here

     * <code>false</code> otherwise.
     */
    public static boolean isValueArrayType(JavaType type)
    {
        if (type.isArray()) {
            JavaType elementType = type.getArrayComponentType();
            return elementType.isValue();
        }
        return false;
    }
View Full Code Here

     * <code>false</code> otherwise.
     */
    private static boolean isPersistenceArrayType(JavaType type)
    {
         if (type.isArray()) {
            JavaType elementType = type.getArrayComponentType();
            return elementType.isValue() ||
                   elementType.isPersistenceCapable();
        }
        return false;
    }
View Full Code Here

            // return java field, if explicitly set by the setter
            return javaField;
        }
       
        // not set => calculate
        JavaType javaType = getDeclaringClass().getJavaType();
        return javaType.getJavaProperty(getName());
    }
View Full Code Here

            // return embeddedElement, if explicitly set by the setter
            return embeddedElement.booleanValue();
        }
       
        // not set => calculate
        JavaType elementType = getElementType();
        return (elementType != null) ?
            TypeSupport.isEmbeddedElementType(elementType) : false;
    }
View Full Code Here

TOP

Related Classes of org.apache.jdo.model.java.JavaType

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.