@Override public Metadata unmarshall(final InputStream input) throws IOException { Metadata result = (Metadata) ServerMarshalling.fromJSON(input); return result; }
@Override public String marshall(final Metadata metadata) throws IOException { String result = ServerMarshalling.toJSON(metadata); return result; } }
@Override public boolean isReadable(final Class<?> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType) { return ServerMarshalling.canHandle(type); }
private void check(final Issue original, final Issue secondOne) { final String json = ServerMarshalling.toJSON(original); final Issue newVersion = (Issue) ServerMarshalling.fromJSON(json); assertEquals(original.hashCode(), newVersion.hashCode()); assertNotEquals(secondOne.hashCode(), newVersion.hashCode()); } }
public final Class<?> demarshall(final Class<?> targetType, final EJValue o, final MarshallingSession ctx) { if (o.isNull() || o.isObject() == null) { return null; } final EJValue className = o.isObject().get(SerializationParts.QUALIFIED_VALUE); return ServerMarshalling.getMarshaller(className.isString().stringValue()) .getEmptyArray().getClass().getComponentType(); }
private void check(final Issue original, final Issue secondOne) { final String json = ServerMarshalling.toJSON(original); final Issue newVersion = (Issue) ServerMarshalling.fromJSON(json); assertEquals(original.hashCode(), newVersion.hashCode()); assertNotEquals(secondOne.hashCode(), newVersion.hashCode()); } }
public final Class<?> demarshall(final Class<?> targetType, final EJValue o, final MarshallingSession ctx) { if (o.isNull() || o.isObject() == null) { return null; } final EJValue className = o.isObject().get(SerializationParts.QUALIFIED_VALUE); return ServerMarshalling.getMarshaller(className.isString().stringValue()) .getEmptyArray().getClass().getComponentType(); }
@Override @SuppressWarnings("unchecked") public Graph unmarshall(final Metadata metadata, final InputStream input) throws IOException { Graph result = (Graph) ServerMarshalling.fromJSON(input); return result; }
String securityContextJson(final User user) { final String userJson = ServerMarshalling.toJSON(user); return "{\"" + SecurityConstants.DICTIONARY_USER + "\": " + userJson + "}"; }
@Override public boolean isWriteable(final Class<?> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType) { return ServerMarshalling.canHandle(type); }
public static Object fromJSON(final InputStream inputStream) throws IOException { return fromJSON(inputStream, Object.class); } }
String toJSON(Object event) { return ServerMarshalling.toJSON(event); }
public static Object fromJSON(final InputStream inputStream) throws IOException { return fromJSON(inputStream, Object.class); } }
String toJSON(Object event) { return ServerMarshalling.toJSON(event); }
@Override public Object readFrom(final Class<Object> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType, final MultivaluedMap<String, String> httpHeaders, final InputStream entityStream) throws IOException, WebApplicationException { if (type.isInterface()) { return ServerMarshalling.fromJSON(entityStream); } return ServerMarshalling.fromJSON(entityStream, type); } }
@Override public void writeTo(final Object t, final Class<?> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType, final MultivaluedMap<String, Object> httpHeaders, final OutputStream entityStream) throws IOException, WebApplicationException { entityStream.write(ServerMarshalling.toJSON(t).getBytes(Charset.forName("UTF-8"))); }
Object fromJSON(ClusterSerializedCDIMessageWrapper message) { return ServerMarshalling.fromJSON(message.getJson()); }
@Override @SuppressWarnings("unchecked") public String marshall(final Diagram<Graph, Metadata> diagram) throws IOException { String result = ServerMarshalling.toJSON(diagram.getGraph()); return result; }
Object fromJSON(ClusterSerializedCDIMessageWrapper message) { return ServerMarshalling.fromJSON(message.getJson()); }
@Override public <T> void write(final String path, final T value) { try { ioService.startBatch(fileSystem); Path fsPath = fileSystem.getPath(path); String content = ServerMarshalling.toJSON(value); ioService.write(fsPath, content); } catch (final Exception e) { throw new RuntimeException(e); } finally { ioService.endBatch(); } }