Package org.apache.jdo.model.java

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


        // return true if obj is this
        if (obj == this) return  true;
        // return false if obj does not have the correct type
        if ((obj == null) || !(obj instanceof JavaType)) return false;

        JavaType other = (JavaType)obj;
        // compare names
        String name = getName();
        if (name == null) return other.getName() == null;
        return name.equals(other.getName());
    }
View Full Code Here


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

            // return elementType, if explicitly set by the setter
            return elementType;
        }
   
        // 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,
View Full Code Here

     * Get the JDOClass corresponding to the type or element of this
     * relationship.
     * @return the related class
     */
    public JDOClass getRelatedJDOClass() {
        JavaType relatedType = getRelatedJavaType();

        if (relatedType != null) {
            JDOClass myClass = getDeclaringField().getDeclaringClass();
            String relatedTypeName = relatedType.getName();

            if (relatedTypeName.equals(myClass.getName()))
                return myClass;
       
            return myClass.getDeclaringModel().getJDOClass(relatedTypeName);
View Full Code Here

        if (field != null) {
            return new BaseReflectionJavaField(field, this);
        }
       
        // check superclass, if available and other than Object
        JavaType superclass = getSuperclass();
        if ((superclass != null) && (superclass != PredefinedType.objectType)) {
            return superclass.getJavaField(fieldName);
        }
       
        return null;
    }
View Full Code Here

     * <code>null</code> if not present in this model instance.
     */
    public JavaType getJavaType(String name)
    {
        synchronized (types) {
            JavaType javaType = (JavaType)types.get(name);
            if (javaType == null) {
                try {
                    final boolean initialize = false;
                    Class clazz = ReflectionJavaModelFactory.forNamePrivileged(
                        name, initialize, classLoader);
View Full Code Here

     */
    public JavaType getJavaTypeInternal(Class clazz)
    {
        String name = clazz.getName();
        synchronized (types) {
            JavaType javaType = (JavaType)types.get(name);
            if (javaType == null) {
                javaType = newJavaTypeInstance(clazz);
                types.put(name, javaType);
            }
            return javaType;
View Full Code Here

    {
        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

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.