Simple class wrapper featuring deep field invoking.
Wrapp is based on Java 8 MethodHandles
for maximum performance.
It allows you to wrap a whole class (and it's superclasses)
to one simple Wrapper<T>
class which is Serializable
.
That allows you to create Serializable
versions of classes, serialize them
and then deserialize them using existing object instance.
// Create reusable wrapper factory
WrapperFactory wrapperFactory = new WrapperFactory();
// Register (optionally) classes for faster field reading
wrapperFactory.register(TestClass.class);
// Create an instance (TestClass is NOT serializable)
TestClass testClass = new TestClass("Something");
// Write it! (Wrapper<T> IS serializable)
Wrapper<TestClass> wrapper = wrapperFactory.write(testClass);
// Then you can read it from existing wrapper
TestClass otherInstance = new TestClass("Nothing");
wrapperFactory.read(wrapper, otherInstance);
System.out.println(otherInstance.getTestString());
// Output: Something
Project requires JRE 8 and JDK 8 installed
<repositories>
<repository>
<id>socketbyte-repo</id>
<url>http://repo.socketbyte.pl/repository/nexus-releases</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>pl.socketbyte</groupId>
<artifactId>Wrapp</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
Project is based on MIT License.