private void defineFromTypeDescriptor() { if (typeDescriptor instanceof ComplexTypeDescriptor) { List elements = ((ComplexTypeDescriptor) typeDescriptor) .getElements(); inputNames = new String[elements.size()]; inputTypes = new String[elements.size()]; Class[] types = new Class[elements.size()]; TypeDescriptor.retrieveSignature(elements, inputNames, types); for (int i = 0; i < types.length; i++) { inputTypes[i] = TypeDescriptor.translateJavaType(types[i]); } } else if (typeDescriptor instanceof ArrayTypeDescriptor) { inputNames = new String[] { typeDescriptor.getType() }; if (((ArrayTypeDescriptor) typeDescriptor).getElementType() instanceof BaseTypeDescriptor) { inputTypes = new String[] { "l('text/plain')" }; } else { inputTypes = new String[] { "l('text/xml')" }; } } }
private void defineFromTypeDescriptor() { if (typeDescriptor instanceof ComplexTypeDescriptor) { List elements = ((ComplexTypeDescriptor) typeDescriptor) .getElements(); outputNames = new String[elements.size()]; outputTypes = new String[elements.size()]; Class[] types = new Class[elements.size()]; TypeDescriptor.retrieveSignature(elements, outputNames, types); for (int i = 0; i < types.length; i++) { outputTypes[i] = TypeDescriptor.translateJavaType(types[i]); } } else if (typeDescriptor instanceof ArrayTypeDescriptor) { outputNames = new String[] { typeDescriptor.getName() }; if (((ArrayTypeDescriptor) typeDescriptor).getElementType() instanceof BaseTypeDescriptor) { outputTypes = new String[] { "l('text/plain')" }; } else { outputTypes = new String[] { "l('text/xml')" }; } } }
String[] names = new String[elements.size()]; Class<?>[] types = new Class<?>[elements.size()]; TypeDescriptor.retrieveSignature(elements, names, types); for (int i = 0; i < names.length; i++) { ActivityOutputPortDefinitionBean portBean = new ActivityOutputPortDefinitionBean(); String[] attributeNames = new String[attributes.size()]; Class<?>[] attributeTypes = new Class<?>[attributes.size()]; TypeDescriptor.retrieveSignature(attributes, attributeNames, attributeTypes); for (int i = 0; i < attributeNames.length; i++) { ActivityOutputPortDefinitionBean portBean = new ActivityOutputPortDefinitionBean();
String[] names = new String[elements.size()]; Class<?>[] types = new Class<?>[elements.size()]; TypeDescriptor.retrieveSignature(elements, names, types); for (int i = 0; i < names.length; i++) { ActivityInputPortDefinitionBean portBean = new ActivityInputPortDefinitionBean(); String[] attributeNames = new String[attributes.size()]; Class<?>[] attributeTypes = new Class<?>[attributes.size()]; TypeDescriptor.retrieveSignature(attributes, attributeNames, attributeTypes); for (int i = 0; i < attributeNames.length; i++) { ActivityInputPortDefinitionBean portBean = new ActivityInputPortDefinitionBean();
public void testComplex() { TypeDescriptor complex=new ComplexTypeDescriptor(); complex.setName("acomplex"); complex.setType("complextype"); List<TypeDescriptor> params=new ArrayList<TypeDescriptor>(); String [] names=new String[1]; Class<?> [] types=new Class[1]; params.add(complex); TypeDescriptor.retrieveSignature(params, names, types); assertEquals("should only be 1 type",1,types.length); assertEquals("should only be 1 name",1,names.length); assertEquals("name should be adecimal","acomplex",names[0]); assertEquals("type should be string",org.w3c.dom.Element.class,types[0]); }
public void testBaseTypeUnrecognisedSigniture() { TypeDescriptor date=new BaseTypeDescriptor(); date.setName("adate"); date.setType("date"); List<TypeDescriptor> params=new ArrayList<TypeDescriptor>(); String [] names=new String[1]; Class<?> [] types=new Class[1]; params.add(date); TypeDescriptor.retrieveSignature(params, names, types); assertEquals("should only be 1 type",1,types.length); assertEquals("should only be 1 name",1,names.length); assertEquals("name should be adecimal","adate",names[0]); assertEquals("type should be string",String.class,types[0]); }
public void testBaseTypeKnownSigniture() { TypeDescriptor decimal=new BaseTypeDescriptor(); decimal.setName("adecimal"); decimal.setType("decimal"); List<TypeDescriptor> params=new ArrayList<TypeDescriptor>(); String [] names=new String[1]; Class<?> [] types=new Class[1]; params.add(decimal); TypeDescriptor.retrieveSignature(params, names, types); assertEquals("should only be 1 type",1,types.length); assertEquals("should only be 1 name",1,names.length); assertEquals("name should be adecimal","adecimal",names[0]); assertEquals("type should be double",Double.TYPE,types[0]); }
outTypes = new Class[outputs.size()]; TypeDescriptor.retrieveSignature(inputs, inNames, inTypes); TypeDescriptor.retrieveSignature(outputs, outNames, outTypes);
public void testRetrieveSignitureForArrayDescriptor2() { ArrayTypeDescriptor desc = new ArrayTypeDescriptor(); desc.setName("AnArray"); desc.setType("complextype"); ComplexTypeDescriptor complex = new ComplexTypeDescriptor(); complex.setName("complex"); complex.setType("complextype"); desc.setElementType(complex); String[] names = new String[1]; Class<?>[] types = new Class[1]; List<TypeDescriptor> params = new ArrayList<TypeDescriptor>(); params.add(desc); TypeDescriptor.retrieveSignature(params, names, types); assertEquals("AnArray", names[0]); assertEquals(org.w3c.dom.Element.class, types[0]); }
public void testRetrieveSignitureForArrayDescriptor() { ArrayTypeDescriptor desc = new ArrayTypeDescriptor(); desc.setName("AnArray"); desc.setType("arrayofstring"); BaseTypeDescriptor base = new BaseTypeDescriptor(); base.setName(""); base.setType("string"); desc.setElementType(base); String[] names = new String[1]; Class<?>[] types = new Class[1]; List<TypeDescriptor> params = new ArrayList<TypeDescriptor>(); params.add(desc); TypeDescriptor.retrieveSignature(params, names, types); assertEquals("AnArray", names[0]); assertEquals(String[].class, types[0]); }
public void testRetrieveSignitureForArrayDescriptor3() { ArrayTypeDescriptor desc = new ArrayTypeDescriptor(); desc.setName("AnArray"); desc.setType("string"); BaseTypeDescriptor base = new BaseTypeDescriptor(); base.setName(""); base.setType("string"); desc.setElementType(base); String[] names = new String[1]; Class<?>[] types = new Class[1]; List<TypeDescriptor> params = new ArrayList<TypeDescriptor>(); params.add(desc); TypeDescriptor.retrieveSignature(params, names, types); assertEquals("AnArray", names[0]); assertEquals(String[].class, types[0]); }