Package gap

Examples of gap.Primitive


            Class childClass = FieldClass(PackageName(pkg),childClassName,imports);

            switch(listType){
            case ListPrimitive:{
                Primitive child = Primitive.For(childClassName,childClass);
                if (null != child){
                    DefineClass(PackageFor(child,childClass),child,ImportsFor(child,parent,imports),top,TemplateNames.PrefixChild);

                    top.setVariable(TemplateNames.ListClassName,listClassName);
                    top.setVariable(TemplateNames.ListType,"Primitive");
View Full Code Here


            Class childClass = FieldClass(PackageName(pkg),mapChild.childValueClassName,imports);

            switch (mapType){
            case MapPrimitive:{
                Primitive child = Primitive.For(mapChild.childValueClassName,childClass);
                if (null != child){
                    DefineClass(PackageFor(child,childClass),child,ImportsFor(child,parent,imports),top,TemplateNames.PrefixChild);

                    top.setVariable(TemplateNames.MapClassName,mapClassName);
                    top.setVariable(TemplateNames.MapKeyType,mapChild.childKeyFieldType);
View Full Code Here

                    isBigTableInterface = false;

                final boolean isCollection = IsTypeClassCollection(field,fieldTypeClass);

                final boolean isEnumerated = IsFieldEnumerated(field,fieldTypeClassDescriptor,fieldTypeClass);
                final Primitive fieldTypePrimitive = Primitive.For(fieldTypeClass,isEnumerated,isBigTable,isCollection);
                final String[] fieldTypeParameters = FieldTypeParameters(ToString(field.getType()));

                final gap.data.List.Type listType;
                if (IsTypeClassList(fieldTypeClass))
                    listType = gap.data.List.Type.For(fieldTypeClean);
                else
                    listType = null;

                final OD.MapChild mapChild;
                if (IsTypeClassMap(fieldTypeClass))
                    mapChild = new OD.MapChild(field);
                else
                    mapChild = null;

                final boolean isNumber = (null != fieldTypePrimitive && fieldTypePrimitive.isNumber());

                TemplateDataDictionary dataField = null;
                boolean isPersistent = false;
                boolean isInheritable = true;
                boolean isRelation = false;
                boolean isTransient = false;
                boolean isUnique = false;



                if (IsFieldDefaultSortBy(field))
                    defaultSortBy = fieldName;

                /*
                 * Create dataField section with field kind booleans
                 */
                if (IsFieldPersistent(field,fieldTypeClass)){
                    isPersistent = true;

                    dataField = top.addSection(new TemplateName(prefix,"pfield"));
                    top.addSection(new TemplateName(prefix,"field"), dataField);

                    /*
                     * Populate 'pfield' section
                     */
                    if (IsFieldUnique(field)){
                        if (isCollection)
          throw new ODStateException(field,"Unique field '"+fieldName+"' of collection type.");
                        else {
                            isUnique = true;

                            isInheritable = false;

                            defaultSortByOpt = fieldName;

                            dataField.addSection(TemplateNames.FieldIsUnique);
                            dataField.addSection(TemplateNames.FieldIsNotCollection);
                            dataField.addSection(TemplateNames.FieldIsNotPrimitiveCollection);
                            /*
                             * Global section 'field_unique'
                             */
                            if (null == field_unique){

                                top.addSection(new TemplateName(prefix,"field_unique"), dataField);
                            }
                        }
                    }
                    else {
                        dataField.addSection(TemplateNames.FieldIsNotUnique);

                        if (isCollection){
                            dataField.addSection(TemplateNames.FieldIsCollection);
                            if (null != listType){

                                if (ListPrimitive == listType){
                                    dataField.addSection(TemplateNames.FieldIsPrimitiveCollection);
                                }
                                else {
                                    dataField.addSection(TemplateNames.FieldIsNotPrimitiveCollection);
                                    dataField.addSection(TemplateNames.FieldIsCollectionNotPrimitive);
                                }
                            }
                            else if (null != mapChild){

                                if (MapPrimitive == mapChild.mapType){
                                    dataField.addSection(TemplateNames.FieldIsPrimitiveCollection);
                                }
                                else {
                                    dataField.addSection(TemplateNames.FieldIsNotPrimitiveCollection);
                                    dataField.addSection(TemplateNames.FieldIsCollectionNotPrimitive);
                                }
                            }
                            else
                                throw new ODStateException(field,"Collection field '"+fieldName+"' is neither list nor map.");
                        }
                        else {
                            dataField.addSection(TemplateNames.FieldIsNotCollection);
                            dataField.addSection(TemplateNames.FieldIsNotPrimitiveCollection);
                        }
                    }
                    dataField.addSection(TemplateNames.FieldIsNotTransient);
                    dataField.addSection(TemplateNames.FieldIsNotRelation);
                }
                else if (isCollection){

                    dataField = top.addSection(new TemplateName(prefix,"cfield"));
                    top.addSection(new TemplateName(prefix,"field"), dataField);
                    /*
                     * Populate 'cfield' section
                     */
                    dataField.addSection(TemplateNames.FieldIsCollection);
                    dataField.addSection(TemplateNames.FieldIsNotUnique);
                    dataField.addSection(TemplateNames.FieldIsNotTransient);
                    dataField.addSection(TemplateNames.FieldIsNotRelation);

                    if (null != listType){

                        if (ListPrimitive == listType){
                            dataField.addSection(TemplateNames.FieldIsPrimitiveCollection);
                        }
                        else {
                            dataField.addSection(TemplateNames.FieldIsNotPrimitiveCollection);
                            dataField.addSection(TemplateNames.FieldIsCollectionNotPrimitive);
                        }
                    }
                    else if (null != mapChild){

                        if (MapPrimitive == mapChild.mapType){
                            dataField.addSection(TemplateNames.FieldIsPrimitiveCollection);
                        }
                        else {
                            dataField.addSection(TemplateNames.FieldIsNotPrimitiveCollection);
                            dataField.addSection(TemplateNames.FieldIsCollectionNotPrimitive);
                        }
                    }
                    else
                        throw new ODStateException(field,"Collection field '"+fieldName+"' is neither list nor map.");
                }
                else if (IsFieldRelation(field)){
                    isRelation = true;

                    dataField = top.addSection(new TemplateName(prefix,"rfield"));
                    top.addSection(new TemplateName(prefix,"field"), dataField);
                    /*
                     * Populate 'rfield' section
                     */
                    if ((!IsTypeClassKey(fieldTypeClass)) && null != fieldTypeClass && IsNotTypeClassBigTable(fieldTypeClass))
                        throw new ODStateException(field,"Relation field '"+fieldName+"' is not a subclass of 'gap.data.BigTable'.");
                    else {
                        dataField.addSection(TemplateNames.FieldIsNotCollection);
                        dataField.addSection(TemplateNames.FieldIsNotPrimitiveCollection);
                        dataField.addSection(TemplateNames.FieldIsNotUnique);
                        dataField.addSection(TemplateNames.FieldIsNotTransient);
                        dataField.addSection(TemplateNames.FieldIsNotRelation);
                    }
                }
                else {
                    isTransient = true;

                    dataField = top.addSection(new TemplateName(prefix,"tfield"));
                    top.addSection(new TemplateName(prefix,"field"), dataField);
                    /*
                     * Populate 'tfield' section
                     */
                    dataField.addSection(TemplateNames.FieldIsNotCollection);
                    dataField.addSection(TemplateNames.FieldIsNotPrimitiveCollection);
                    dataField.addSection(TemplateNames.FieldIsNotUnique);
                    dataField.addSection(TemplateNames.FieldIsTransient);
                    dataField.addSection(TemplateNames.FieldIsNotRelation);
                }

                /*
                 * Field common properties
                 */
                dataField.setVariable(TemplateNames.FieldName,fieldName);
                dataField.setVariable(TemplateNames.FieldNameCamel,fieldNameCamel);
                dataField.setVariable(TemplateNames.FieldClass,fieldType);
                dataField.setVariable(TemplateNames.FieldClassClean,fieldTypeClean);
                dataField.setVariable(TemplateNames.FieldClassCleanClean,fieldTypeCleanClean);

                /*
                 * I/O functions ToString, FromString, FromObject
                 * and Is/IsNot selectors
                 */
                if (null != fieldTypePrimitive){

                    dataField.addSection(TemplateNames.FieldIsPrimitive);
                    dataField.addSection(TemplateNames.FieldIsNotBigTable);
                    dataField.addSection(TemplateNames.FieldIsNotBigTableInterface);

                    dataField.addSection(TemplateNames.FieldIsNotMap);
                    dataField.addSection(TemplateNames.FieldIsNotMapPrimitive);
                    dataField.addSection(TemplateNames.FieldIsNotMapLong);
                    dataField.addSection(TemplateNames.FieldIsNotMapLongOrShort);
                    dataField.addSection(TemplateNames.FieldIsNotMapShort);
                    dataField.addSection(TemplateNames.FieldIsNotList);
                    dataField.addSection(TemplateNames.FieldIsNotListPrimitive);
                    dataField.addSection(TemplateNames.FieldIsNotListLongOrShort);
                    dataField.addSection(TemplateNames.FieldIsNotListLong);
                    dataField.addSection(TemplateNames.FieldIsNotListShort);

                    if (isNumber){
                        dataField.addSection(TemplateNames.FieldIsNumber);
                        switch(fieldTypePrimitive){
                        case Short:
                            dataField.setVariable(TemplateNames.FieldNumberValue,"shortValue");
                            break;
                        case Integer:
                            dataField.setVariable(TemplateNames.FieldNumberValue,"intValue");
                            break;
                        case Long:
                            dataField.setVariable(TemplateNames.FieldNumberValue,"longValue");
                            break;
                        case Float:
                            dataField.setVariable(TemplateNames.FieldNumberValue,"floatValue");
                            break;
                        case Double:
                            dataField.setVariable(TemplateNames.FieldNumberValue,"doubleValue");
                            break;
                        default:
                            throw new ODStateException(field,"Number field '"+fieldName+"' type not recognized.");
                        }
                    }
                    else
                        dataField.addSection(TemplateNames.FieldIsNotNumber);

                    switch(fieldTypePrimitive){
                    case Key:
                        isInheritable = false;
                        dataField.setVariable(TemplateNames.FieldToStringPrefix,"gap.Strings.KeyToString(");
                        dataField.setVariable(TemplateNames.FieldToStringSuffix,")");

                        dataField.setVariable(TemplateNames.FieldFromStringPrefix,"gap.Strings.KeyFromString(");
                        dataField.setVariable(TemplateNames.FieldFromStringSuffix,")");

                        dataField.setVariable(TemplateNames.FieldFromObjectPrefix,"gap.Objects.KeyFromObject(");
                        dataField.setVariable(TemplateNames.FieldFromObjectSuffix,")");

                        dataField.addSection(TemplateNames.FieldIsKey);
                        dataField.addSection(TemplateNames.FieldIsNotBoolean);
                        dataField.addSection(TemplateNames.FieldIsNotCharacter);
                        dataField.addSection(TemplateNames.FieldIsNotEnum);
                        dataField.addSection(TemplateNames.FieldIsNotBigInteger);
                        dataField.addSection(TemplateNames.FieldIsNotBigDecimal);
                        dataField.addSection(TemplateNames.FieldIsNotSerializable);
                        break;
                    case Enum:
                        dataField.setVariable(TemplateNames.FieldToStringPrefix,"gap.Strings.EnumToString(");
                        dataField.setVariable(TemplateNames.FieldToStringSuffix,")");

                        dataField.setVariable(TemplateNames.FieldFromStringPrefix,"("+fieldType+")gap.Strings.EnumFromString(");
                        dataField.setVariable(TemplateNames.FieldFromStringSuffix,")");

                        dataField.setVariable(TemplateNames.FieldFromObjectPrefix,"("+fieldType+")gap.Objects.EnumFromObject(");
                        dataField.setVariable(TemplateNames.FieldFromObjectSuffix,")");

                        dataField.addSection(TemplateNames.FieldIsNotKey);
                        dataField.addSection(TemplateNames.FieldIsNotBoolean);
                        dataField.addSection(TemplateNames.FieldIsNotCharacter);
                        dataField.addSection(TemplateNames.FieldIsEnum);
                        dataField.addSection(TemplateNames.FieldIsNotBigInteger);
                        dataField.addSection(TemplateNames.FieldIsNotBigDecimal);
                        dataField.addSection(TemplateNames.FieldIsNotSerializable);
                        break;
                    case Boolean:
                        dataField.setVariable(TemplateNames.FieldToStringPrefix,"gap.Strings.BooleanToString(");
                        dataField.setVariable(TemplateNames.FieldToStringSuffix,")");

                        dataField.setVariable(TemplateNames.FieldFromStringPrefix,"gap.Strings.BooleanFromString(");
                        dataField.setVariable(TemplateNames.FieldFromStringSuffix,")");

                        dataField.setVariable(TemplateNames.FieldFromObjectPrefix,"gap.Objects.BooleanFromObject(");
                        dataField.setVariable(TemplateNames.FieldFromObjectSuffix,")");

                        dataField.addSection(TemplateNames.FieldIsNotKey);
                        dataField.addSection(TemplateNames.FieldIsBoolean);
                        dataField.addSection(TemplateNames.FieldIsNotCharacter);
                        dataField.addSection(TemplateNames.FieldIsNotEnum);
                        dataField.addSection(TemplateNames.FieldIsNotBigInteger);
                        dataField.addSection(TemplateNames.FieldIsNotBigDecimal);
                        dataField.addSection(TemplateNames.FieldIsNotSerializable);
                        break;
                    case Character:
                        dataField.setVariable(TemplateNames.FieldToStringPrefix,"gap.Strings.CharacterToString(");
                        dataField.setVariable(TemplateNames.FieldToStringSuffix,")");

                        dataField.setVariable(TemplateNames.FieldFromStringPrefix,"gap.Strings.CharacterFromString(");
                        dataField.setVariable(TemplateNames.FieldFromStringSuffix,")");

                        dataField.setVariable(TemplateNames.FieldFromObjectPrefix,"gap.Objects.CharacterFromObject(");
                        dataField.setVariable(TemplateNames.FieldFromObjectSuffix,")");

                        dataField.addSection(TemplateNames.FieldIsNotKey);
                        dataField.addSection(TemplateNames.FieldIsNotBoolean);
                        dataField.addSection(TemplateNames.FieldIsCharacter);
                        dataField.addSection(TemplateNames.FieldIsNotEnum);
                        dataField.addSection(TemplateNames.FieldIsNotBigInteger);
                        dataField.addSection(TemplateNames.FieldIsNotBigDecimal);
                        dataField.addSection(TemplateNames.FieldIsNotSerializable);
                        break;
                    case String:
                        dataField.setVariable(TemplateNames.FieldToStringPrefix,"");
                        dataField.setVariable(TemplateNames.FieldToStringSuffix,"");

                        dataField.setVariable(TemplateNames.FieldFromStringPrefix,"");
                        dataField.setVariable(TemplateNames.FieldFromStringSuffix,"");

                        dataField.setVariable(TemplateNames.FieldFromObjectPrefix,"gap.Objects.StringFromObject(");
                        dataField.setVariable(TemplateNames.FieldFromObjectSuffix,")");

                        dataField.addSection(TemplateNames.FieldIsNotKey);
                        dataField.addSection(TemplateNames.FieldIsNotBoolean);
                        dataField.addSection(TemplateNames.FieldIsNotCharacter);
                        dataField.addSection(TemplateNames.FieldIsNotEnum);
                        dataField.addSection(TemplateNames.FieldIsNotBigInteger);
                        dataField.addSection(TemplateNames.FieldIsNotBigDecimal);
                        dataField.addSection(TemplateNames.FieldIsNotSerializable);
                        break;
                    case BigInteger:
                        dataField.setVariable(TemplateNames.FieldToStringPrefix,"gap.Strings.BigIntegerToString(");
                        dataField.setVariable(TemplateNames.FieldToStringSuffix,")");

                        dataField.setVariable(TemplateNames.FieldFromStringPrefix,"gap.Strings.BigIntegerFromString(");
                        dataField.setVariable(TemplateNames.FieldFromStringSuffix,")");

                        dataField.setVariable(TemplateNames.FieldFromObjectPrefix,"gap.Objects.BigIntegerFromObject(");
                        dataField.setVariable(TemplateNames.FieldFromObjectSuffix,")");

                        dataField.addSection(TemplateNames.FieldIsNotKey);
                        dataField.addSection(TemplateNames.FieldIsNotBoolean);
                        dataField.addSection(TemplateNames.FieldIsNotCharacter);
                        dataField.addSection(TemplateNames.FieldIsNotEnum);
                        dataField.addSection(TemplateNames.FieldIsBigInteger);
                        dataField.addSection(TemplateNames.FieldIsNotBigDecimal);
                        dataField.addSection(TemplateNames.FieldIsNotSerializable);
                        break;
                    case BigDecimal:
                        dataField.setVariable(TemplateNames.FieldToStringPrefix,"gap.Strings.BigDecimalToString(");
                        dataField.setVariable(TemplateNames.FieldToStringSuffix,")");

                        dataField.setVariable(TemplateNames.FieldFromStringPrefix,"gap.Strings.BigDecimalFromString(");
                        dataField.setVariable(TemplateNames.FieldFromStringSuffix,")");

                        dataField.setVariable(TemplateNames.FieldFromObjectPrefix,"gap.Objects.BigDecimalFromObject(");
                        dataField.setVariable(TemplateNames.FieldFromObjectSuffix,")");

                        dataField.addSection(TemplateNames.FieldIsNotKey);
                        dataField.addSection(TemplateNames.FieldIsNotBoolean);
                        dataField.addSection(TemplateNames.FieldIsNotCharacter);
                        dataField.addSection(TemplateNames.FieldIsNotEnum);
                        dataField.addSection(TemplateNames.FieldIsNotBigInteger);
                        dataField.addSection(TemplateNames.FieldIsBigDecimal);
                        dataField.addSection(TemplateNames.FieldIsNotSerializable);
                        break;
                    case Serializable:
                        dataField.setVariable(TemplateNames.FieldToStringPrefix,"gap.Strings.SerializableToString(");
                        dataField.setVariable(TemplateNames.FieldToStringSuffix,")");

                        dataField.setVariable(TemplateNames.FieldFromStringPrefix,"("+fieldType+")gap.Strings.SerializableFromString(");
                        dataField.setVariable(TemplateNames.FieldFromStringSuffix,")");

                        dataField.setVariable(TemplateNames.FieldFromObjectPrefix,"("+fieldType+")gap.Objects.SerializableFromObject(");
                        dataField.setVariable(TemplateNames.FieldFromObjectSuffix,")");

                        dataField.addSection(TemplateNames.FieldIsNotKey);
                        dataField.addSection(TemplateNames.FieldIsNotBoolean);
                        dataField.addSection(TemplateNames.FieldIsNotCharacter);
                        dataField.addSection(TemplateNames.FieldIsNotEnum);
                        dataField.addSection(TemplateNames.FieldIsNotBigInteger);
                        dataField.addSection(TemplateNames.FieldIsNotBigDecimal);
                        dataField.addSection(TemplateNames.FieldIsSerializable);
                        break;
                    default:
                        dataField.setVariable(TemplateNames.FieldToStringPrefix,"gap.Strings."+fieldTypeCleanClean+"ToString(");
                        dataField.setVariable(TemplateNames.FieldToStringSuffix,")");

                        dataField.setVariable(TemplateNames.FieldFromStringPrefix,"gap.Strings."+fieldTypeCleanClean+"FromString(");
                        dataField.setVariable(TemplateNames.FieldFromStringSuffix,")");

                        dataField.setVariable(TemplateNames.FieldFromObjectPrefix,"gap.Objects."+fieldTypeCleanClean+"FromObject(");
                        dataField.setVariable(TemplateNames.FieldFromObjectSuffix,")");

                        dataField.addSection(TemplateNames.FieldIsNotKey);
                        dataField.addSection(TemplateNames.FieldIsNotBoolean);
                        dataField.addSection(TemplateNames.FieldIsNotCharacter);
                        dataField.addSection(TemplateNames.FieldIsNotEnum);
                        dataField.addSection(TemplateNames.FieldIsNotBigInteger);
                        dataField.addSection(TemplateNames.FieldIsNotBigDecimal);
                        dataField.addSection(TemplateNames.FieldIsNotSerializable);
                        break;
                    }
                }
                else {

                    if (isBigTable){
                        dataField.setVariable(TemplateNames.FieldToStringPrefix,"gap.Strings.KeyToString(");
                        dataField.setVariable(TemplateNames.FieldToStringSuffix,")");

                        dataField.setVariable(TemplateNames.FieldFromStringPrefix,"gap.Strings.KeyFromString(");
                        dataField.setVariable(TemplateNames.FieldFromStringSuffix,")");

                        dataField.setVariable(TemplateNames.FieldFromObjectPrefix,FullClassName(fieldTypeClassDescriptor,fieldTypeClass)+".FromObject(");
                        dataField.setVariable(TemplateNames.FieldFromObjectSuffix,")");
                        /*
                         */
                        dataField.addSection(TemplateNames.FieldIsBigTable);
                        if (isBigTableInterface)
                            dataField.addSection(TemplateNames.FieldIsBigTableInterface);
                        else
                            dataField.addSection(TemplateNames.FieldIsNotBigTableInterface);

                        if (IsFieldShort(cd,field,fieldTypeClassDescriptor))
                            dataField.addSection(TemplateNames.FieldIsShort);
                        else
                            dataField.addSection(TemplateNames.FieldIsLong);

                        dataField.addSection(TemplateNames.FieldIsNotPrimitive);
                        dataField.addSection(TemplateNames.FieldIsNotKey);
                        dataField.addSection(TemplateNames.FieldIsNotEnum);
                        dataField.addSection(TemplateNames.FieldIsNotBoolean);
                        dataField.addSection(TemplateNames.FieldIsNotNumber);
                        dataField.addSection(TemplateNames.FieldIsNotCharacter);
                        dataField.addSection(TemplateNames.FieldIsNotBigInteger);
                        dataField.addSection(TemplateNames.FieldIsNotBigDecimal);
                        dataField.addSection(TemplateNames.FieldIsNotSerializable);

                        dataField.addSection(TemplateNames.FieldIsNotMap);
                        dataField.addSection(TemplateNames.FieldIsNotMapPrimitive);
                        dataField.addSection(TemplateNames.FieldIsNotMapLong);
                        dataField.addSection(TemplateNames.FieldIsNotMapLongOrShort);
                        dataField.addSection(TemplateNames.FieldIsNotMapShort);
                        dataField.addSection(TemplateNames.FieldIsNotList);
                        dataField.addSection(TemplateNames.FieldIsNotListPrimitive);
                        dataField.addSection(TemplateNames.FieldIsNotListLongOrShort);
                        dataField.addSection(TemplateNames.FieldIsNotListLong);
                        dataField.addSection(TemplateNames.FieldIsNotListShort);
                    }
                    else {
                        dataField.addSection(TemplateNames.FieldIsNotBigTable);
                        dataField.addSection(TemplateNames.FieldIsNotBigTableInterface);
                        /*
                         */
                        if (null != listType){
                            dataField.addSection(TemplateNames.FieldIsNotMap);

                            dataField.setVariable(TemplateNames.FieldFromObjectPrefix,"("+fieldType+')');
                            dataField.setVariable(TemplateNames.FieldFromObjectSuffix,"");

                            dataField.addSection(TemplateNames.FieldIsNotPrimitive);
                            dataField.addSection(TemplateNames.FieldIsNotKey);
                            dataField.addSection(TemplateNames.FieldIsNotEnum);
                            dataField.addSection(TemplateNames.FieldIsNotBoolean);
                            dataField.addSection(TemplateNames.FieldIsNotNumber);
                            dataField.addSection(TemplateNames.FieldIsNotCharacter);
                            dataField.addSection(TemplateNames.FieldIsNotBigInteger);
                            dataField.addSection(TemplateNames.FieldIsNotBigDecimal);
                            dataField.addSection(TemplateNames.FieldIsNotSerializable);

                            dataField.addSection(TemplateNames.FieldIsNotMap);
                            dataField.addSection(TemplateNames.FieldIsNotMapPrimitive);
                            dataField.addSection(TemplateNames.FieldIsNotMapLong);
                            dataField.addSection(TemplateNames.FieldIsNotMapLongOrShort);
                            dataField.addSection(TemplateNames.FieldIsNotMapShort);

                            if (1 == fieldTypeParameters.length){

                                dataField.addSection(TemplateNames.FieldIsList);

                                switch(listType){
                                case ListPrimitive:
                                    dataField.addSection(TemplateNames.FieldIsListPrimitive);
                                    dataField.addSection(TemplateNames.FieldIsNotListLongOrShort);
                                    dataField.addSection(TemplateNames.FieldIsNotListLong);
                                    dataField.addSection(TemplateNames.FieldIsNotListShort);
                                    break;
                                case ListShort:
                                    dataField.addSection(TemplateNames.FieldIsNotListPrimitive);
                                    dataField.addSection(TemplateNames.FieldIsListLongOrShort);
                                    dataField.addSection(TemplateNames.FieldIsNotListLong);
                                    dataField.addSection(TemplateNames.FieldIsListShort);
                                    break;
                                case ListLong:
                                    dataField.addSection(TemplateNames.FieldIsNotListPrimitive);
                                    dataField.addSection(TemplateNames.FieldIsListLongOrShort);
                                    dataField.addSection(TemplateNames.FieldIsListLong);
                                    dataField.addSection(TemplateNames.FieldIsNotListShort);
                                    break;
                                default:
                                    throw new ODStateException(field,"List field '"+fieldName+"' has list type '"+listType+"'.");
                                }

                                String typeParameter = fieldTypeParameters[0];
                                dataField.setVariable(TemplateNames.FieldListComponent,typeParameter);

                                if (IsTypeOf(typeParameter,"HasName"))
                                    dataField.addSection(TemplateNames.FieldListComponentNamed);

                                ClassDescriptor component = Classes.For(typeParameter);
                                if (null != component){
                                    String componentKind = ClassKind(component);
                                    if (null != componentKind)
                                        dataField.setVariable(TemplateNames.FieldListComponentKind,componentKind);

                                    dataField.setVariable(TemplateNames.FieldImplClassName,ListImplClassName(fieldTypeClean,className,component));
                                }
                                else if (ListPrimitive == listType){

                                    Class componentClass = FieldClass(pkg,typeParameter,imports);
                                    if (null != componentClass){
                                        Primitive componentPrimitive = Primitive.For(componentClass);

                                        dataField.setVariable(TemplateNames.FieldImplClassName,ListPrimitiveClassName(componentPrimitive));
                                    }
                                    else
                                        throw new ODStateException(field,"In field '"+fieldType+" "+fieldName+"', require pre-compilation for class analysis of component type '"+typeParameter+"'.");
View Full Code Here

        String packageName = Classes.PackageName(pkg);
        return Classes.FieldClass(packageName,typeName,imports);
    }
    public final static Class FieldClass(String pkg, String fieldType, lxl.List<ImportDescriptor> imports){
        String cleanTypeName = CleanTypeName(fieldType);
        Primitive primitive = Primitive.For(cleanTypeName);
        if (null != primitive)
            return primitive.type;
        else {
            gap.data.List.Type listType = gap.data.List.Type.For(cleanTypeName);
            if (null != listType)
View Full Code Here

TOP

Related Classes of gap.Primitive

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.