Skip to content

SocketByte/Wrapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wrapp version Build Status

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.

Usage

// 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

Installation

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>

License

Project is based on MIT License.

About

Simple class wrapper featuring deep field invoking

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages