reflection-utils

Reflection Utils adds a few but essential missing methods in Java default Reflection API.

License

License

GroupId

GroupId

xyz.luan
ArtifactId

ArtifactId

reflection-utils
Last Version

Last Version

0.8.0
Release Date

Release Date

Type

Type

jar
Description

Description

reflection-utils
Reflection Utils adds a few but essential missing methods in Java default Reflection API.
Project URL

Project URL

https://github.com/luanpotter/reflection-utils
Source Code Management

Source Code Management

https://github.com/luanpotter/reflection-utils

Download reflection-utils

How to add to project

<!-- https://jarcasting.com/artifacts/xyz.luan/reflection-utils/ -->
<dependency>
    <groupId>xyz.luan</groupId>
    <artifactId>reflection-utils</artifactId>
    <version>0.8.0</version>
</dependency>
// https://jarcasting.com/artifacts/xyz.luan/reflection-utils/
implementation 'xyz.luan:reflection-utils:0.8.0'
// https://jarcasting.com/artifacts/xyz.luan/reflection-utils/
implementation ("xyz.luan:reflection-utils:0.8.0")
'xyz.luan:reflection-utils:jar:0.8.0'
<dependency org="xyz.luan" name="reflection-utils" rev="0.8.0">
  <artifact name="reflection-utils" type="jar" />
</dependency>
@Grapes(
@Grab(group='xyz.luan', module='reflection-utils', version='0.8.0')
)
libraryDependencies += "xyz.luan" % "reflection-utils" % "0.8.0"
[xyz.luan/reflection-utils "0.8.0"]

Dependencies

compile (1)

Group / Artifact Type Version
com.fasterxml : classmate jar 1.1.0

test (1)

Group / Artifact Type Version
junit : junit-dep jar 4.8.2

Project Modules

There are no modules declared in this project.

Reflection Utils

Build Status Maven Central

Simple library that changes the base Reflection API on Java, making it easier to work with. It uses cowtowncoder/java-classmate for type parsing.

Features

ReflectionUtils

Utility class with common functions not found on Class<?> API

  • isInnerClass(Class<?> clazz) : returns true if this class is an inner class, that is, if it is a non-static nested class (either annonymous, method local or class local)
  • getImmediateFields(Class<?> clazz) : returns all the fields (all visibilities) immediate from this class, excluding static and synthetic fields
  • getFieldsRecursively(Class<?> clazz) : like getImmediateFields, but goes up class hierarchy adding parent classes fields as well, except for Java classes fields
  • getFieldsRecursivelyIncludingJavaClasses(Class<?> clazz) : like getFieldsRecursively, but add Java classes fields, like the array inside String class

TypedClass

You can now convert your classes to this convenient wrapper. Call TypedClass.create using a Field object.
The returned TypedClass is like a class, but with tons of neat features, allowing for easy access to the new TYPE_USE Java 8's annotation target annotations.

Versions

Version
0.8.0
0.7.1
0.6.0
0.5.0
0.4.0
0.3.0