All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.revenj.serialization.Serialization Maven / Gradle / Ivy

The newest version!
package org.revenj.serialization;

import org.revenj.Utils;

import java.io.IOException;
import java.lang.reflect.Type;

public interface Serialization {
	TFormat serialize(Type type, Object value) throws IOException;

	default TFormat serialize(Object value) throws IOException {
		return serialize(null, value);
	}

	Object deserialize(Type type, TFormat data) throws IOException;

	@SuppressWarnings("unchecked")
	default  T deserialize(TFormat data, Class manifest) throws IOException {
		return (T) deserialize(manifest, data);
	}

	@SuppressWarnings("unchecked")
	default  T deserialize(TFormat data, Class container, Type argument, Type... arguments) throws IOException {
		return (T) deserialize(Utils.makeGenericType(container, argument, arguments), data);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy