private SerializedType getSerializedType(Object instance) { SerializedType serializedType; if (instance == null) { serializedType = SimpleSerializedType.emptyType(); } else { serializedType = new SimpleSerializedType(instance.getClass().getName(), revisionOf(instance.getClass())); } return serializedType; }
/** * Returns the {@link SerializedType} of the serialized token. * * @return the serialized type of the token */ protected SerializedType getTokenType() { return new SimpleSerializedType(tokenType, null); }
/** * Returns the type that represents an empty message, of undefined type. The type of such message is "empty" and * always has a {@code null} revision. * * @return the type representing an empty message */ static SerializedType emptyType() { return SimpleSerializedType.emptyType(); }
/** * Initializes a SimpleSerializedObject using given {@code data} and a serialized type identified by given * {@code type} and {@code revision}. * * @param data The data of the serialized object * @param dataType The type of data * @param type The type identifying the serialized object * @param revision The revision of the serialized object */ public SimpleSerializedObject(T data, Class<T> dataType, String type, String revision) { this(data, dataType, new SimpleSerializedType(type, revision)); }
@Override public Class classForType(SerializedType type) { if (SimpleSerializedType.emptyType().equals(type)) { return Void.class; } try { return classLoader.loadClass(resolveClassName(type)); } catch (ClassNotFoundException e) { return UnknownSerializedType.class; } }
@Override public SerializedType typeForClass(Class type) { if (type == null || Void.TYPE.equals(type) || Void.class.equals(type)) { return SimpleSerializedType.emptyType(); } return new SimpleSerializedType(type.getName(), revisionResolver.revisionOf(type)); }
@Override @SuppressWarnings("unchecked") public SerializedObject<T> getPayload() { return new SimpleSerializedObject<>(payload, (Class<T>) payload.getClass(), new SimpleSerializedType(payloadType, payloadRevision)); } }
/** * Returns the type that represents an empty message, of undefined type. The type of such message is "empty" and * always has a {@code null} revision. * * @return the type representing an empty message */ static SerializedType emptyType() { return SimpleSerializedType.emptyType(); }
@Override public SerializedType typeForClass(Class type) { if (type == null || Void.TYPE.equals(type) || Void.class.equals(type)) { return SimpleSerializedType.emptyType(); } return new SimpleSerializedType(typeIdentifierOf(type), revisionOf(type)); }
@Override public SerializedType typeForClass(Class type) { return new SimpleSerializedType(type.getName(), revisionOf(type)); }
/** * Returns the type that represents an empty message, of undefined type. The type of such message is "empty" and * always has a {@code null} revision. * * @return the type representing an empty message */ static SerializedType emptyType() { return SimpleSerializedType.emptyType(); }
private SerializedType getSerializedType(Object instance) { SerializedType serializedType; if (instance == null) { serializedType = SimpleSerializedType.emptyType(); } else { serializedType = new SimpleSerializedType(instance.getClass().getName(), revisionOf(instance.getClass())); } return serializedType; }
/** * Returns the {@link SerializedType} of the serialized token. * * @return the serialized type of the token */ protected SerializedType getTokenType() { return new SimpleSerializedType(tokenType, null); }
@Override public Class classForType(SerializedType type) { if (SimpleSerializedType.emptyType().equals(type)) { return Void.class; } try { return classLoader.loadClass(resolveClassName(type)); } catch (ClassNotFoundException e) { return UnknownSerializedType.class; } }
@Override public SerializedType typeForClass(Class type) { if (type == null || Void.TYPE.equals(type) || Void.class.equals(type)) { return SimpleSerializedType.emptyType(); } return new SimpleSerializedType(type.getName(), revisionResolver.revisionOf(type)); }
/** * Initializes a SimpleSerializedObject using given {@code data} and a serialized type identified by given * {@code type} and {@code revision}. * * @param data The data of the serialized object * @param dataType The type of data * @param type The type identifying the serialized object * @param revision The revision of the serialized object */ public SimpleSerializedObject(T data, Class<T> dataType, String type, String revision) { this(data, dataType, new SimpleSerializedType(type, revision)); }
@Override public Class classForType(SerializedType type) throws UnknownSerializedTypeException { if (SimpleSerializedType.emptyType().equals(type)) { return Void.class; } try { return classLoader.loadClass(resolveClassName(type)); } catch (ClassNotFoundException e) { throw new UnknownSerializedTypeException(type, e); } }
@Override public SerializedType typeForClass(Class type) { if (type == null || Void.TYPE.equals(type) || Void.class.equals(type)) { return SimpleSerializedType.emptyType(); } return new SimpleSerializedType(type.getName(), revisionResolver.revisionOf(type)); }
/** * Returns the {@link SerializedType} of the serialized token. * * @return the serialized type of the token */ protected SerializedType getTokenType() { return new SimpleSerializedType(tokenType, null); }
private SerializedType getSerializedType(Object instance) { SerializedType serializedType; if (instance == null) { serializedType = SimpleSerializedType.emptyType(); } else { serializedType = new SimpleSerializedType(instance.getClass().getName(), revisionOf(instance.getClass())); } return serializedType; }