Trespass

> inspect beyond barriers

View project onGitHub

What it Trespass?

A simple yet powerful Java library that allows on-the-fly inspection of classes' and objects' contents at runtime, regardless of declared visibility.

The implementation is based on Java dynamic proxies but that's a detail that the library will keep hidden from consumers.

Using Trespass will basically involve 2 components:

  1. a custom interface extending trespass.Trespasser and declaring methods that will map to constructors, methods and/or properties, static or not, in a target class or object

  2. class trespass.Factory to dynamically create objects that will implement the declared interface and proxy calls to its target

    the target class must be annotated with @ProxyClass

    a method can be mapped by simply declaring a signature that's identical to target's

    annotation @Cast is provided to allow mapping of target methods that receive arguments of types that are not accessible from the proxy interface
    

    a property or constant can be mapped by declaring accessor methods (getter and setter) using standard Java Beans naming conventions

    annotation @ProxyField can be used to explicitly specify the name of the target property
    

    a constructor or static factory method can be mapped by annotating a method in the proxy interface with @DefaultInstanceProvider

$ cd your_repo_root/repo_name
$ git fetch origin
$ git checkout gh-pages