try { CompositeType at = (CompositeType)((ArrayType)ct.getType("data")).getElementOpenType(); CompositeType rt = (CompositeType)at.getType("value"); CompositeData recordData = new CompositeDataSupport(rt, OpenType et = at.getElementOpenType(); if (value instanceof Map && et instanceof CompositeType) { CompositeType ct = (CompositeType) et;
public void updateButtonAction(Long id) throws Exception { mbsc.invoke(this.osgiON, "update", new Object[] {new Long [] {id}} , new String[]{new ArrayType(1, SimpleType.LONG).getTypeName()}); }
} else { try { innerTypeClass = Class.forName(getOpenType().getElementOpenType().getClassName()); } catch (ClassNotFoundException e) { throw new IllegalStateException("Unable to locate class for " + getOpenType().getElementOpenType().getClassName(), e); if (getOpenType().isPrimitiveArray()) { Class<?> primitiveType = getPrimitiveType(innerTypeClass); parsedArray = Array.newInstance(primitiveType, valueList.size()); final ArrayType<?> openType = new ArrayType<Object>(getOpenType().getDimension(), innerTypeResolvingStrategy.getOpenType()); setOpenType(openType); } catch (OpenDataException e) {
static Object getJavaTypeArray(ArrayType<?> atype, ClassLoader classLoader, int dimension) throws OpenDataException { Class<?> compType; OpenType<?> elementType = atype.getElementOpenType(); try { if (atype.isPrimitiveArray()) { compType = Class.forName(atype.getTypeName()).getComponentType(); } else { compType = classLoader.loadClass(elementType.getTypeName()); } } catch (ClassNotFoundException ex) { OpenDataException odex = new OpenDataException("Cannot load array type: " + atype); odex.initCause(ex); throw odex; } return Array.newInstance(compType, dimension); }
static ObjectNode serialize(final ArrayType<?> arrayType) { final ObjectNode node = ThreadLocalJsonFactory.getFactory().objectNode(); node.put(IS_PRIMITIVE_FIELD, arrayType.isPrimitiveArray()); node.put(DIMENSIONS_FIELD, arrayType.getDimension()); node.put(ARRAY_ELEMENT_FIELD, serialize(arrayType.getElementOpenType())); return node; }
OpenType elementType = arrayType.getElementOpenType(); int dimension = arrayType.getDimension(); Class<?> componentType = Class.forName(arrayType.getClassName()); return constructArray(elementType, componentType.getComponentType(), dimension, oldArray, context); Class<?> componentType = Class.forName(arrayType.getClassName()); return constructArray(elementType, componentType.getComponentType(), dimension, oldArray, context);
OpenType elementType = arrayType.getElementOpenType(); int dimension = arrayType.getDimension(); Object[] oldArray = (Object[]) value; if (type instanceof Class)
@Override public OpenType<?> getOpenType() { try { return ArrayType.getArrayType(getConverter(valueTypeNode, null).getOpenType()); } catch (OpenDataException e) { throw new RuntimeException(e); } }
public void uninstallButtonAction(Long id) throws Exception { mbsc.invoke(this.osgiON, "uninstall", new Object[] {new Long [] {id}} , new String[]{new ArrayType(1, SimpleType.LONG).getTypeName()}); }
static Object getJavaTypeArray(ArrayType<?> atype, ClassLoader classLoader, int dimension) throws OpenDataException { Class<?> compType; OpenType<?> elementType = atype.getElementOpenType(); try { if (atype.isPrimitiveArray()) { compType = Class.forName(atype.getTypeName()).getComponentType(); } else { compType = classLoader.loadClass(elementType.getTypeName()); } } catch (ClassNotFoundException ex) { OpenDataException odex = new OpenDataException("Cannot load array type: " + atype); odex.initCause(ex); throw odex; } return Array.newInstance(compType, dimension); }
OpenType elementType = arrayType.getElementOpenType(); int dimension = arrayType.getDimension(); Class<?> componentType = Class.forName(arrayType.getClassName()); return constructArray(elementType, componentType.getComponentType(), dimension, oldArray, context); Class<?> componentType = Class.forName(arrayType.getClassName()); return constructArray(elementType, componentType.getComponentType(), dimension, oldArray, context);
OpenType elementType = arrayType.getElementOpenType(); int dimension = arrayType.getDimension(); Object[] oldArray = (Object[]) value; if (type instanceof Class)
@Override public OpenType<?> getOpenType() { try { return ArrayType.getArrayType(getConverter(valueTypeNode, null).getOpenType()); } catch (OpenDataException e) { throw new RuntimeException(e); } }
public void startButtonAction(Long id) throws Exception { mbsc.invoke(this.osgiON, "startService", new Object[] {new Long [] {id}} , new String[]{new ArrayType(1, SimpleType.LONG).getTypeName()}); }
/** {@inheritDoc} */ @Override public Object convertToObject(ArrayType type, Object pFrom) { JSONAware value = toJSON(pFrom); // prepare each value in the array and then process the array of values if (!(value instanceof JSONArray)) { throw new IllegalArgumentException( "Can not convert " + value + " to type " + type + " because JSON object type " + value.getClass() + " is not a JSONArray"); } JSONArray jsonArray = (JSONArray) value; OpenType elementOpenType = type.getElementOpenType(); Object[] valueArray = createTargetArray(elementOpenType, jsonArray.size()); int i = 0; for (Object element : jsonArray) { valueArray[i++] = getDispatcher().convertToObject(elementOpenType, element); } return valueArray; }
static Object getOpenTypeArray(ArrayType<?> atype, ClassLoader classLoader, int dimension) throws OpenDataException { Class<?> compType; OpenType<?> elementType = atype.getElementOpenType(); try { if (atype.isPrimitiveArray()) { compType = Class.forName(atype.getTypeName()).getComponentType(); } else if (elementType instanceof CompositeType) { compType = CompositeData.class; } else if (elementType instanceof TabularType) { compType = TabularData.class; } else { compType = classLoader.loadClass(elementType.getTypeName()); } } catch (ClassNotFoundException ex) { OpenDataException odex = new OpenDataException("Cannot load array type: " + atype); odex.initCause(ex); throw odex; } return Array.newInstance(compType, dimension); }
@Override public OpenType<?> getOpenType() { try { return ArrayType.getArrayType(getConverter(valueTypeNode, null).getOpenType()); } catch (OpenDataException e) { throw new RuntimeException(e); } }
@Override protected void init() throws OpenDataException { super.init(); addItem(CompositeDataConstants.BODY_LENGTH, "Body length", SimpleType.LONG); addItem(CompositeDataConstants.BODY_PREVIEW, "Body preview", new ArrayType(1, SimpleType.BYTE)); }