Package org.apache.schemas.yoko.bindings.corba

Examples of org.apache.schemas.yoko.bindings.corba.Enum


        return processPrimitiveType(qname);
    }

    private Enum createCorbaEnum(XmlSchemaSimpleTypeRestriction restrictionType, QName name,
                                 QName schematypeName) {
        Enum corbaEnum = new Enum();
        corbaEnum.setType(schematypeName);
        corbaEnum.setName(name.getLocalPart());
        corbaEnum.setQName(name);

        corbaEnum.setRepositoryID(repoString + name.getLocalPart().replace('.', '/') + idlversion);
        Iterator enums = restrictionType.getFacets().getIterator();

        while (enums.hasNext()) {
            XmlSchemaEnumerationFacet val = (XmlSchemaEnumerationFacet)enums.next();
            Enumerator enumerator = new Enumerator();
            enumerator.setValue(val.getValue().toString());
            corbaEnum.getEnumerator().add(enumerator);
        }
        return corbaEnum;
    }
View Full Code Here


        List fields = processContainerAsMembers(choice, defaultName, schematypeName);

        List<String> caselist = new ArrayList<String>();

        if (disctype instanceof Enum) {
            Enum corbaenum = (Enum)disctype;
            Iterator iterator = corbaenum.getEnumerator().iterator();

            while (iterator.hasNext()) {
                Enumerator enumerator = (Enumerator)iterator.next();
                caselist.add(enumerator.getValue());
            }
View Full Code Here

        scope.addToScope(idlType);
        return idlType;
    }

    private IdlType createEnum(CorbaTypeImpl ctype, IdlScopeBase scope, String local) {
        Enum e = (Enum)ctype;
        IdlEnum enum1 = IdlEnum.create(scope, local);
        Iterator it = e.getEnumerator().iterator();

        while (it.hasNext()) {
            // Enumerators are created in the same scope
            // as the enum, according to IDL grammar rules.
            String n = ((Enumerator)it.next()).getValue();
View Full Code Here

        oStream.write_long(1);
        InputStream iStream = oStream.create_input_stream();
        CorbaObjectReader reader = new CorbaObjectReader(iStream);
       
        String[] enums = {"RED", "GREEN", "BLUE" };
        Enum enumType = new Enum();
        Enumerator enumRed = new Enumerator();
        enumRed.setValue(enums[0]);
        Enumerator enumGreen = new Enumerator();
        enumGreen.setValue(enums[1]);
        Enumerator enumBlue = new Enumerator();
        enumBlue.setValue(enums[2]);
        enumType.getEnumerator().add(enumRed);
        enumType.getEnumerator().add(enumGreen);
        enumType.getEnumerator().add(enumBlue);
       
        // These values don't matter to the outcome of the test but are needed during construction
        QName enumName = new QName("TestEnum");
        QName enumIdlType = new QName("corbatm:TestEnum");
        TypeCode enumTC = orb.create_enum_tc("IDL:TestEnum:1.0", enumName.getLocalPart(), enums);
View Full Code Here

                                     getTypeCode(orb, arrayType.getElemtype(), typeMaps));
        } else if (obj instanceof Const) {
            Const constType = (Const)obj;
            tc = getTypeCode(orb, constType.getIdltype(), typeMaps);
        } else if (obj instanceof Enum) {
            Enum enumType = (Enum)obj;
            String name = enumType.getName();
            List enums = enumType.getEnumerator();
            String[] members = new String[enums.size()];

            for (int i = 0; i < members.length; ++i) {
                members[i] = ((Enumerator) enums.get(i)).getValue();
            }
            tc = orb.create_enum_tc(enumType.getRepositoryID(), name, members);
        } else if (obj instanceof Exception) {
            Exception exceptType = (Exception)obj;

            // TODO: check to see if this is a recursive type.
            List list = exceptType.getMember();
View Full Code Here

    }

    // -- complex types --
    public void writeEnum(CorbaObjectHandler obj) throws CorbaBindingException {
        CorbaEnumHandler enumHandler = (CorbaEnumHandler)obj;
        Enum enumType = (Enum)enumHandler.getType();
        String enumLabel = enumHandler.getValue();
        List<Enumerator> enumerators = enumType.getEnumerator();
       
        // We won't use an iterator here so that we have the index number of the enumerator string.
        // This is how CORBA references enums when reading and writing to streams.
        for (int i = 0; i < enumerators.size(); ++i) {
            if (enumerators.get(i).getValue().equals(enumLabel)) {
View Full Code Here

    }

    // -- complex types --
    public void readEnum(CorbaObjectHandler obj) throws CorbaBindingException {
        int enumIndex = stream.read_long();
        Enum enumType = (Enum) obj.getType();
        List<Enumerator> enumerators = enumType.getEnumerator();

        CorbaEnumHandler enumObj = (CorbaEnumHandler)obj;
        enumObj.setValue(enumerators.get(enumIndex).getValue());
    }
View Full Code Here

TOP

Related Classes of org.apache.schemas.yoko.bindings.corba.Enum

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.