Package org.apache.jdo.model.java

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


     */
    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,
            // if typeName denotes a primitive type or is a qualified name
            // or if there is no packagePrefix (default package)
            type = javaModel.getJavaType(typeName);
        }
        else {
            // Not a primitive type and not qualified and packagePrefix
            // specified => qualify using packagePrefix
            type = javaModel.getJavaType(packagePrefix + typeName);
            if (type == null) {
                // If type could not be resolved =>
                // use java.lang. package prefix as qualifier
                type = javaModel.getJavaType("java.lang." + typeName); //NOI18N
            }
        }
        return type;
    }
View Full Code Here


     * Returns the parent JDOModel instance of this JDOModel.
     * @return the parent JDOModel
     */
    public JDOModel getParent() {
        if (javaModel != null) {
            JavaModel parentJavaModel = javaModel.getParent();
            if (parentJavaModel != null)
                return parentJavaModel.getJDOModel();
        }
        return null;
    }
View Full Code Here

        // not set => try to resolve ObjectId class
        JavaType type = null;
        String name = getDeclaredObjectIdClassName();
        if (name != null) {
            JavaModel javaModel = getDeclaringModel().getJavaModel();
            type = javaModel.getJavaType(name);
            if (Modifier.isAbstract(type.getModifiers()))
                // do not return ObjectId class if abstract
                type = null;
        }
        else {
View Full Code Here

            // return java type, if explicitly set by the setter
            return javaType;
        }
       
        // not set => calculate
        JavaModel javaModel = declaringModel.getJavaModel();
        return javaModel.getJavaType(getName());
    }
View Full Code Here

     * support <code>null</code> keys.
     */
    public JavaModel getJavaModel(Object key)
    {
        synchronized (modelCache) {
            JavaModel javaModel = (JavaModel)modelCache.get(key);
            if (javaModel == null) {
                // create new model and store it using the specified key
                try {
                    javaModel = createJavaModel(key);
                    modelCache.put(key, javaModel);
View Full Code Here

        if ((key != null) && (!(key instanceof ClassLoader)))
            throw new ModelException(msg.msg("EXC_InvalidJavaModelKey", //NOI18N
                                             key.getClass().getName()));
       
        ClassLoader classLoader = (ClassLoader)key;
        JavaModel javaModel = newJavaModelInstance(classLoader);

        // check parent <-> child relationship
        if (classLoader != null) {
            // if the specified classLoader is not null,
            // try to get the parent class loader and update the parent property
            try {
                ClassLoader parentClassLoader = classLoader.getParent();
                if (parentClassLoader != null) {
                    javaModel.setParent(getJavaModel(parentClassLoader));
                }
            }
            catch (SecurityException ex) {
                // ignore => parentClassLoader and parent JavaModel are null
            }
View Full Code Here

        if ((key != null) && (!(key instanceof ClassLoader)))
            throw new ModelException(msg.msg("EXC_InvalidJavaModelKey", //NOI18N
                                             key.getClass().getName()));
       
        ClassLoader classLoader = (ClassLoader)key;
        JavaModel javaModel = newJavaModelInstance(classLoader);

        // check parent <-> child relationship
        if (classLoader != null) {
            // if the specified classLoader is not null,
            // try to get the parent class loader and update the parent property
            try {
                ClassLoader parentClassLoader = classLoader.getParent();
                if (parentClassLoader != null) {
                    javaModel.setParent(getJavaModel(parentClassLoader));
                }
            }
            catch (SecurityException ex) {
                // ignore => parentClassLoader and parent JavaModel are null
            }
View Full Code Here

        // not set => try to resolve ObjectId class
        JavaType type = null;
        String name = getDeclaredObjectIdClassName();
        if (name != null) {
            JavaModel javaModel = getDeclaringModel().getJavaModel();
            type = javaModel.getJavaType(name);
            if (Modifier.isAbstract(type.getModifiers()))
                // do not return ObjectId class if abstract
                type = null;
        }
        else {
View Full Code Here

            // return java type, if explicitly set by the setter
            return javaType;
        }
       
        // not set => calculate
        JavaModel javaModel = declaringModel.getJavaModel();
        return javaModel.getJavaType(getName());
    }
View Full Code Here

     * Returns the parent JDOModel instance of this JDOModel.
     * @return the parent JDOModel
     */
    public JDOModel getParent() {
        if (javaModel != null) {
            JavaModel parentJavaModel = javaModel.getParent();
            if (parentJavaModel != null)
                return parentJavaModel.getJDOModel();
        }
        return null;
    }
View Full Code Here

TOP

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

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.