/** * Convert a byte array (of an xml) to an object. * @param val The byte array. * @param classloader The class loader. * @return The decoded object. */ public static Object objectFromByteArray(byte[] val, ClassLoader classloader, IErrorReporter rep) { return objectFromByteArray(val, classloader, null, null, rep); }
public void handleAttributeValue(Object object, QName xmlattrname, List attrpath, String attrval, Object attrinfo, AReadContext context) throws Exception { if (attrinfo != null) { super.handleAttributeValue(object, xmlattrname, attrpath, attrval, attrinfo, context); } } }, is, BpmnModelReader.class.getClassLoader(), new BpmnReadContext());
/** * Convert an xml to an object. * @param val The string value. * @return The decoded object. */ public static <T> T objectFromXML(String val, ClassLoader classloader) { return JavaReader.<T>objectFromXML(val, classloader, null, null); }
/** * Get the default Java reader. * @return The Java reader. */ public static IObjectReaderHandler getObjectHandler() { if(handler==null) { synchronized(JavaReader.class) { if(handler==null) { handler = new BeanObjectReaderHandler(getTypeInfos()); } } } return handler; } }
/** * Get the default Java reader. * @return The Java reader. */ public static IObjectWriterHandler getObjectHandler() { if(handler==null) { synchronized(JavaWriter.class) { if(handler==null) { handler = new BeanObjectWriterHandler(getTypeInfos(), true); } } } return handler; } }
/** * Convert to a string. */ public static String objectToXML(Object val, ClassLoader classloader) { return objectToXML(val, classloader, null); }
/** * Convert to a byte array. */ public static byte[] objectToByteArray(Object val, ClassLoader classloader) { return objectToByteArray(val, classloader, null); }
/** * Convert a byte array (of an xml) to an object. * @param val The input stream. * @param classloader The class loader. * @return The decoded object. */ public static Object objectFromInputStream(InputStream val, ClassLoader classloader, IErrorReporter rep) { return objectFromInputStream(val, classloader, null, null, rep); }
/** * Join sets of typeinfos. * @param typeinfos The user specific type infos. * @return The joined type infos. */ public static Set joinTypeInfos(Set typeinfos) { Set ret = getTypeInfos(); if(typeinfos!=null) ret.addAll(typeinfos); return ret; }
/** * Write to output stream. */ public static void objectToOutputStream(Object val, OutputStream os, ClassLoader classloader) { objectToOutputStream(val, os, classloader, null); }
/** * Convert to a byte array. */ public static byte[] objectToByteArray(Object val, ClassLoader classloader, IObjectWriterHandler handler) { return AWriter.objectToByteArray(getInstance(), val, classloader, handler==null? getObjectHandler(): handler); }
/** * Convert an xml to an object. * @param val The string value. * @return The decoded object. */ public static <T> T objectFromXML(String val, ClassLoader classloader, TypeInfoPathManager manager, IObjectReaderHandler handler) { return (T)AReader.objectFromXML(getInstance(), val, classloader, manager==null? getPathManager(): manager, handler==null? getObjectHandler(): handler); }
public Object convertObject(Object val, IContext context) { return ((MapEntry)val).getValue(); } };
/** * Fill in message values from string. */ public Map decodeMessage(String msg) { Map map = (Map)JavaReader.objectFromXML(msg, null); // Todo: classloader!? return map; }
/** * Convert message to a string. * @param message The message. */ public String encodeMessage(Map message) { String msg = JavaWriter.objectToXML(message, null); // Todo: classloader!? return msg; }
/** * Get the size of the result. */ public long getSize(Object t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return JavaWriter.objectToByteArray(t, Thread.currentThread().getContextClassLoader()).length; } }
/** * Write the object to the output stream. */ public void writeTo(Object t, Class<?> type, Type generictype, Annotation[] annotations, MediaType mediatype, MultivaluedMap<String, Object> httpheaders, OutputStream entityStream) throws IOException, WebApplicationException { JavaWriter.objectToOutputStream(t, entityStream, Thread.currentThread().getContextClassLoader()); }
/** * Write to output stream. */ public static void objectToOutputStream(Object val, OutputStream os, ClassLoader classloader, IObjectWriterHandler handler) { AWriter.objectToOutputStream(getInstance(), val, os, classloader, null, handler==null? getObjectHandler(): handler); }
/** * Fill in message values from string. */ public Map decodeMessage(String msg) { Map map = (Map)JavaReader.objectFromXML(msg, null); // Todo: classloader!? return map; }
/** * Convert message to a string. * @param message The message. */ public String encodeMessage(Map message) { String msg = JavaWriter.objectToXML(message, null); // Todo: classloader!? return msg; }