Package org.openquark.cal.internal.javamodel

Examples of org.openquark.cal.internal.javamodel.JavaTypeName


           
            for (int j = 0, k = dc.getArity(); j < k; ++j) {
                FieldName fn = dc.getNthFieldName(j);
                allFieldNames.add(fn);
               
                JavaTypeName jtn = typeExprToTypeName(fieldTypes[j], typeToClassMappings, moduleToPackageMappings, targetPackage);
                Set<JavaTypeName> javaTypeNames = (Set<JavaTypeName>)allFieldTypes.get(fn);
               
                if (javaTypeNames == null) {
                    javaTypeNames = new LinkedHashSet<JavaTypeName>();
                    allFieldTypes.put(fn, javaTypeNames);
View Full Code Here


            FieldName fn = dataConstructor.getNthFieldName(i);
            if (!typeConstructorInfo.commonFieldNames.contains(fn)) {
                containsFields = true;
            }
           
            JavaTypeName javaType = typeExprToTypeName(fieldTypes[i], typeToClassMappings, moduleToPackageMappings, targetPackage);
            fieldTypeNames.put(fn, javaType);
           
            String accessorName = (String)typeConstructorInfo.fieldJavaAccessorMethodNames.get(fn);
            fieldJavaAccessorMethodNames.put(fn, accessorName);
        }
View Full Code Here

            ForeignTypeInfo fti = tc.getForeignTypeInfo();
            if (fti == null) {
                continue;
            }
           
            JavaTypeName foreignType = JavaTypeName.make(fti.getForeignType());
            if (javaType.equals(foreignType)) {
                return tc;
            }
        }
       
View Full Code Here

                    return JavaTypeName.make (fti.getForeignType());
                }

                TypeConstructor typeConstructor = typeConsApp.getRoot();

                JavaTypeName typeName = (JavaTypeName)typeToClassMappings.get(typeConstructor.getName());
                if (typeName != null) {
                    return typeName;
                }

                String unqualifiedTypeConstructorName = typeConstructor.getName().getUnqualifiedName();
                if (unqualifiedTypeConstructorName.equals("Function")) {
                    return CAL_VALUE;
                }

                // We are going to build up a JavaTypeName based on our naming convention for generated
                // I/O classes.
               
                // Check to see if the CAL module is mapped to a Java package.
                String referencedPackage = moduleToPackageMappings.get(typeConstructor.getName().getModuleName());
                if (referencedPackage == null) {
                    // If not use the target package.
                    referencedPackage = targetPackage;
                }
                if (referencedPackage.endsWith(".")) {
                    referencedPackage = referencedPackage.substring(0, referencedPackage.lastIndexOf('.'));
                }
                if (referencedPackage.lastIndexOf('.') > 0) {
                    referencedPackage = referencedPackage.substring(0, referencedPackage.lastIndexOf('.')+1);
                } else {
                    referencedPackage = referencedPackage + ".";
                }
               
                // Create a Java class name.
                JavaTypeName typeConstructorClassName =
                    JavaTypeName.make(referencedPackage + typeConstructor.getName().getModuleName().getLastComponent() + "." + getClassName(typeConstructor), false);
                return typeConstructorClassName;
            }
        }
       
View Full Code Here

            for (FieldName fn : typeConstructorInfo.commonFieldNames) {
                Set<JavaTypeName> fieldTypes = typeConstructorInfo.allFieldTypeNames.get(fn);
               
                // There will only be one type for common fields.
                Iterator<JavaTypeName> types = fieldTypes.iterator();
                JavaTypeName fieldType = types.next();
               
                String foreignFieldTypeSting = typeConstructorInfo.calFieldForeignTypes.get(fn).get(fieldType);
               
                generateFieldAccessor (
                        typeConstructorInfo.calForeignTypeName,
                        fn,
                        fieldType,
                        foreignFieldTypeSting,
                        typeConstructor.getNthDataConstructor(0),
                        topLevelDefnsList);
            }
           
            // Create accessors for the fields in the inner classes.
            for (int i = 0, n = typeConstructor.getNDataConstructors(); i < n; ++i) {
                DataConstructor dc = typeConstructor.getNthDataConstructor(i);
                DataConstructorInfo dcInfo = (DataConstructorInfo)typeConstructorInfo.dataConstructorInfo.get(dc);
               
                for (FieldName fn : dcInfo.allFieldNames) {
                    if (typeConstructorInfo.commonFieldNames.contains(fn)) {
                        continue;
                    }
                   
                    JavaTypeName fieldType = (JavaTypeName)dcInfo.fieldTypeNames.get(fn);
                    String foreignFieldTypeSting = typeConstructorInfo.calFieldForeignTypes.get(fn).get(fieldType);
                    generateFieldAccessor (
                            dcInfo.calForeignTypeName,
                            fn,
                            fieldType,
View Full Code Here

            }
           
           
            for (int i = 0, n = dc.getArity(); i < n; ++i) {
                FieldName fn = dc.getNthFieldName(i);
                JavaTypeName fieldType = (JavaTypeName)dcInfo.fieldTypeNames.get(fn);
                String fieldAccessorName = typeConstructorInfo.calFieldAccessorFunctionNames.get(fn).get(dc);
               
                // If the type of the retrieved field matches the type of the dc field
                // we can simply use the field accessor.  Otherwise we need to apply input to
                // resulting value.
View Full Code Here

        }
       
       
        private SourceModel.FunctionDefn importJavaConstructor (JavaConstructor constructor, boolean innerClass) throws UnableToResolveForeignEntityException {
            int nArgs = constructor.getNParams();
            JavaTypeName argTypes[] = new JavaTypeName[nArgs + 1];
            for (int i = 0; i < nArgs; ++i) {
                argTypes[i] = constructor.getParamType(i);
            }
            argTypes[nArgs] = javaClass.getClassName();
               
View Full Code Here

                ForeignTypeInfo fti = tc.getForeignTypeInfo();
                if (fti == null) {
                    continue;
                }
               
                JavaTypeName foreignType = JavaTypeName.make(fti.getForeignType());
                for (int j = 0, k = javaTypes.length; j < k; ++j) {
                    if (typeConstructors[j] != null) {
                        continue;
                    }
                    if (foreignType.equals(javaTypes[j])) {
                        typeConstructors[j] = tc;
                    }
                }
            }
           
View Full Code Here

                    classModifiers |= Modifier.FINAL;
                } else {
                    classModifiers |= Modifier.ABSTRACT;
                }
       
                JavaTypeName superClassTypeName = JavaTypeName.OBJECT;
       
                // No interfaces are implemented
                JavaTypeName[] interfaces = IO_Source_Generator.EMPTY_TYPE_NAME_ARRAY;
       
                JavaClassRep javaClassRep =
View Full Code Here

                for (FieldName fieldName : typeConstructorInfo.commonFieldNames) {
                    Set<JavaTypeName> javaTypeNames = typeConstructorInfo.allFieldTypeNames.get(fieldName);
                    assert (javaTypeNames.size() == 1);
                   
                    Iterator<JavaTypeName> types = javaTypeNames.iterator();
                    JavaTypeName type = types.next();
                    String javaFieldName = typeConstructorInfo.fieldJavaNames.get(fieldName);
       
                    int modifiers = Modifier.FINAL;
                   
                    JavaFieldDeclaration fieldDec = new JavaFieldDeclaration (modifiers, type, javaFieldName, null);
View Full Code Here

TOP

Related Classes of org.openquark.cal.internal.javamodel.JavaTypeName

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.