Package org.exolab.castor.xml.schema.simpletypes.factory

Examples of org.exolab.castor.xml.schema.simpletypes.factory.Type


     * built in type which name is given as a parameter.
     * @param typeName Name of the simple type.
     * @return The {@link SimpleType} instance for the type name.
     */
    public SimpleType getBuiltInType(final String typeName) {
        Type type = getType(typeName);
        if (type == null) {
            return null;
        }
        return type.getSimpleType();
    }
View Full Code Here


   /**
     * Gets a built in type's name given its code.
     */
    public String getBuiltInTypeName(int builtInTypeCode) {
        Type type= getType(builtInTypeCode);
        if (type == null) return null;
        return type.getName();
    }
View Full Code Here

                Vector types= typeList.getTypes();
                _typesByName= new Hashtable();
                _typesByCode= new Hashtable();
            for( int index= 0; index < types.size(); index++)
            {
                    Type type= (Type)(types.elementAt(index));
                    _typesByName.put(type.getName(), type);
                    type.setSimpleType(createSimpleType(_builtInSchema, type));
                    _typesByCode.put(new Integer( type.getSimpleType().getTypeCode() ), type);
                }
          }
          catch (Exception except) {
                //Of course, this should not happen if the config files are there.
              String err = Messages.message("schema.cantLoadBuiltInTypes")
View Full Code Here

     * Creates the correct instance for the given type name.
     * Valid only for built in type names.
     */
    private SimpleType createInstance(Schema schema, String builtInTypeName)
    {
        Type type= getType(builtInTypeName);

       //If the type is derived by list, return a new ListType.
        String derivation= type.getDerivedBy();
        ListType resultList = null;
        if ( (derivation != null) && (derivation.equals(SchemaNames.LIST)) ) {
            try {
                resultList = new ListType(schema);
            }
            catch(SchemaException sx) {
                //-- This should not happen...but who knows!
                throw new SimpleTypesFactoryException(sx);
            }
        }

        //Finds the primitive ancestor (defines the class that represents it)
        Class implClass= null;
        while (type != null) {
            if (type.getImplClass() != null) {
                implClass= type.getImplClass();
                break;
            }
            type= getType(type.getBase());
        }

        if (implClass == null) return null;

        SimpleType result;
View Full Code Here

TOP

Related Classes of org.exolab.castor.xml.schema.simpletypes.factory.Type

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.