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

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


        if (!boundedDecimal) {
            if (anonymous) {
                Anonfixed fixed = (Anonfixed)corbaTypeImpl;
                digits = Integer.parseInt(String.valueOf(fixed.getDigits()));
            } else {
                Fixed fixed = (Fixed)corbaTypeImpl;
                digits = Integer.parseInt(String.valueOf(fixed.getDigits()));
            }           
        }

        if (!boundedScale) {
            if (anonymous) {
                Anonfixed fixed = (Anonfixed)corbaTypeImpl;
                scale = Integer.parseInt(String.valueOf(fixed.getScale()));
            } else {
                Fixed fixed = (Fixed)corbaTypeImpl;
                scale = Integer.parseInt(String.valueOf(fixed.getScale()));
            }
        }

        if (boundedDecimal || boundedScale) {
            if (anonymous) {
View Full Code Here


        }
        return anonymous;
    }
   
    public static CorbaTypeImpl getFixedCorbaType(QName name, QName stype, int digits, int scale) {       
        Fixed fixed = new Fixed();
        fixed.setName(name.getLocalPart());
        fixed.setQName(name);
        fixed.setType(stype);
        fixed.setDigits(digits);
        fixed.setScale(scale);
        fixed.setRepositoryID(WSDLToCorbaHelper.REPO_STRING
                              + name.getLocalPart().replace('.', '/')
                              + WSDLToCorbaHelper.IDL_VERSION);      
        return fixed;
    }
View Full Code Here

        return idlType;
    }
   
    private IdlType createFixed(CorbaTypeImpl ctype, IdlScopeBase scope, String local) {
        IdlType idlType = null;
        Fixed f = (Fixed)ctype;    
        Long digits = f.getDigits();
        Long scale = f.getScale();       
        idlType = IdlFixed.create(scope, local, digits.intValue(),  
                                  scale.intValue());
        scope.addToScope(idlType);
        return idlType;
    }
View Full Code Here

                    // Fixed
                    //

                    nextSchemaType = duplicateXmlSchemaSimpleType(newScope);

                    Fixed oldFixed = (Fixed) getCorbaType();
                    Fixed newFixed = new Fixed();

                    newFixed.setQName(newQname);
                    newFixed.setDigits(oldFixed.getDigits());
                    newFixed.setScale(oldFixed.getScale());
                    newFixed.setType(oldFixed.getType());
                    newFixed.setRepositoryID(newScope.toIDLRepositoryID());

                    nextCorbaType = newFixed;
                } else {
                    System.err.println("[DeclaratorVisitor: Unexpected CORBA type error!]");
                    System.exit(1);
View Full Code Here

        // add xmlschema:fixed
        setSchemaType(fixedSimpleType);

       
        // corba:fixed
        Fixed corbaFixed = new Fixed();
        corbaFixed.setQName(new QName(typeMap.getTargetNamespace(), scopedName.toString()));
        corbaFixed.setDigits(digits);
        corbaFixed.setScale(scale);
        corbaFixed.setRepositoryID(scopedName.toIDLRepositoryID());
        //corbaFixed.setType(Constants.XSD_DECIMAL);
        corbaFixed.setType(fixedSimpleType.getQName());
       
        // add corba:fixed
        setCorbaType(corbaFixed);
    }
View Full Code Here

    public void testReadWriteStaxFixed() {       
        QName objName = new QName("object");
        QName objIdlType = new QName(staxTestNamespaceURI, "TestFixed", staxTestPrefix);
        CorbaTypeImpl type = CorbaUtils.getCorbaType(objIdlType, staxObject.getTypeMaps());
        assertTrue(type instanceof Fixed);
        Fixed fixedType = (Fixed)type;
        TypeCode objTypeCode = CorbaUtils.getTypeCode(orb, objIdlType, staxObject.getTypeMaps());
        CorbaFixedHandler obj = new CorbaFixedHandler(objName, objIdlType, objTypeCode, fixedType);
        assertNotNull(obj);

        java.math.BigDecimal fixedValue = new java.math.BigDecimal("12345.67");
View Full Code Here

        // fixed<5,2>
        oStream.write_fixed(new java.math.BigDecimal("12345.67").movePointRight((int)2));
        InputStream iStream = oStream.create_input_stream();
        CorbaObjectReader reader = new CorbaObjectReader(iStream);
       
        Fixed fixedType = new Fixed();
        fixedType.setDigits(5);
        fixedType.setScale(2);
       
        // These values don't matter to the outcome of the test but are needed during construction
        QName fixedName = new QName("TestFixed");
        QName fixedIdlType = new QName("corbatm:TestFixed");
        TypeCode fixedTC = orb.create_fixed_tc((short)fixedType.getDigits(), (short)fixedType.getScale());
        CorbaFixedHandler obj = new CorbaFixedHandler(fixedName, fixedIdlType, fixedTC, fixedType);
       
        reader.readFixed(obj);
       
        assertTrue(obj.getValue().equals(new java.math.BigDecimal("12345.67")));
View Full Code Here

                                              getTypeCode(orb, member.getIdltype(), typeMaps), null);
            }
            String name = exceptType.getName();
            tc = orb.create_exception_tc(exceptType.getRepositoryID(), name, members);
        } else if (obj instanceof Fixed) {
            Fixed fixedType = (Fixed) obj;
            tc = orb.create_fixed_tc((short) fixedType.getDigits(), (short) fixedType.getScale());
        } else if (obj instanceof org.apache.schemas.yoko.bindings.corba.Object) {
            org.apache.schemas.yoko.bindings.corba.Object objType =
                (org.apache.schemas.yoko.bindings.corba.Object)obj;
            if (objType.getName().equals("CORBA.Object")) {
                tc = orb.create_interface_tc(objType.getRepositoryID(), "Object");
View Full Code Here

            }
        }
    }
   
    public void testCorbaFixedHandler() {
        Fixed fixedType = new Fixed();
        fixedType.setName("FixedType");
        fixedType.setDigits((long)3);
        fixedType.setScale((long)2);
       
        QName fixedName = new QName(fixedType.getName());
        QName fixedIdlType =
            new QName(CorbaConstants.NU_WSDL_CORBA, "FixedType", CorbaConstants.NP_WSDL_CORBA);
        TypeCode fixedTC = orb.create_fixed_tc((short)fixedType.getDigits(), (short)fixedType.getScale());
        CorbaFixedHandler obj = new CorbaFixedHandler(fixedName, fixedIdlType, fixedTC, fixedType);
        assertNotNull(obj);
       
        java.math.BigDecimal value = new java.math.BigDecimal(123.45);
        obj.setValue(value);
       
        assertTrue(value.equals(obj.getValue()));
       
        String valueData = obj.getValueData();
        assertTrue(valueData.equals(value.toString()));
       
        assertTrue(fixedType.getDigits() == obj.getDigits());
        assertTrue(fixedType.getScale() == obj.getScale());
    }
View Full Code Here

                OperationType corbaOpType = (OperationType)extElement;
                assertEquals(corbaOpType.getName(), "op_k");
                assertEquals(3, corbaOpType.getParam().size());
                assertEquals("fixed_1", corbaOpType.getParam().get(0).getIdltype().getLocalPart());
                assertEquals("fixed_1", corbaOpType.getReturn().getIdltype().getLocalPart());
                Fixed fixed = (Fixed)mapType.getStructOrExceptionOrUnion().get(0);

                assertNotNull("Could not find the decimal type", fixed.getType());
                assertEquals("Fixed digits is incorrect for the return corba parameter", 31, fixed
                    .getDigits());
                assertEquals("Fixed scale is incorrect for the return corba parameter", 6, fixed.getScale());

            }
        }
    }
View Full Code Here

TOP

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

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.