Reflector

Java Reflection Utility

This project is maintained by zabawaba99

Reflector


Build Status Coverage Status Maven Central


Making reflective programming simpler.

Under Development

The API may or may not change radically within the next upcoming weeks.

Usage

With Maven

Add the snapshot repository and the dependency to you pom.xml file

<repositories>
    <repository>
        <id>sonatype-snapshot</id>
        <url>https://oss.sonatype.org/content/groups/public</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.zabawaba99</groupId>
        <artifactId>reflector</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </dependency>
</dependencies>

Gradle

compile 'com.github.zabawaba99:reflector:0.1.0'

Manual install

You can go to the sonatype repository and download the version of reflector that you're interested in using.


After adding Reflector to your project, just import the package and start using.

package com.example

import com.zabawaba.reflector;

public static void main(String[] args){
    SomeObject obj = new SomeObject();
    Object fieldValue = Fields.forObj(obj).get("foo").getValue();
    // ... do something with the field's value
}

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b new-feature)
  3. Commit your changes (git commit -am 'Some cool reflection')
  4. Push to the branch (git push origin new-feature)
  5. Create new Pull Request