Reflection utility library

Utility library for basic reflection functionality.

License

License

GroupId

GroupId

nl.talsmasoftware
ArtifactId

ArtifactId

reflection
Last Version

Last Version

1.0.4
Release Date

Release Date

Type

Type

jar
Description

Description

Reflection utility library
Utility library for basic reflection functionality.
Project URL

Project URL

https://github.com/talsma-ict/reflection
Project Organization

Project Organization

Talsma ICT
Source Code Management

Source Code Management

https://github.com/talsma-ict/reflection.git

Download reflection

How to add to project

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

Dependencies

test (10)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter-engine jar 5.7.1
org.hamcrest : hamcrest jar 2.2
org.skyscreamer : jsonassert jar 1.5.0
org.xmlunit : xmlunit-matchers jar 2.8.2
org.hibernate.validator : hibernate-validator jar 7.0.1.Final
org.glassfish.web : javax.el jar 2.2.6
com.fasterxml.jackson.core : jackson-databind jar
org.slf4j : jul-to-slf4j jar 1.7.30
ch.qos.logback : logback-classic jar 1.2.3
nl.talsmasoftware : umldoclet Optional jar 2.0.12

Project Modules

There are no modules declared in this project.

CI build Coverage Status Maven Version JavaDoc

Java reflection utilities

This library contains utility classes related to reflection.
I found myself re-implementing these type of methods over and over again whenever I needed reflection in some project. As there seldom is enough time to do this properly and take things like caching into consideration, the solutions were always sub-optimal. That is why this library was created.

Contributing

Have you found a bug? Did you create new featue?
Please see the contributing page for more information.

Utility-class Classes

For getting or finding classes and interacting with them.
The difference between getting and finding is that a get operation throws exceptions if nothing is found, and find returns null.

Utility-class Methods

For getting or finding methods and invoking them.

Utility-class Constructors

For getting or finding constructors and invoking them.

Package 'beans'

Containing the BeanReflection class, this package provides access to Java's built-in Introspector.getBeanInfo but falls back to public field access when available.

Furthermore, the properties can be 'chained' safely concatenating them with dots inbetween ('.'). Array indices are also supported by square brackets ('[' and ']').

Package 'dto'

The AbstractDto superclass can be extended when your class is merely a Data Transfer Object. Such DTO's are all about simply representing a datastructure and normally don't need any methods. Subclasses merely need to provide public fields containing their datastructure and will be automatically provided with equals, hashCode, toString and clone implementations including all accessible fields from the subclass.

Package 'strings'

The ToStringBuilder is a convenient builder for toString() representations containing named field appenders. It is part of the reflection library because it can easily be instantiated for any bean by the static reflect method.

Package 'errorhandling'

Contains the exception types that can be thrown by this library, all subclasses of java.lang.RuntimeException.

Java 9 module concerns

If you're using the Java 9 module system (e.g. project jigsaw), you can still use this reflection library. Actually the library itself is neatly published as a java 9 module called nl.talsmasoftware.reflection even though the classes are still java 5 binary compatible.

However, out of the box, our module cannot reflect your classes if you haven't opened them up. So be sure to either declare your module as an open module or explicitly open up a package for reflection by this module.

Prepend your module with the open keyword to open it up for reflection like this:

open module com.example.myapp {
    requires nl.talsmasoftware.reflection;
}

Or you can define a specific package for reflection:

module com.example.myapp {
    opens com.example.myapp.dto to nl.talsmasoftware.reflection;
    requires nl.talsmasoftware.reflection;
}

License

Apache 2.0 license

nl.talsmasoftware

Talsma ICT

Versions

Version
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
0.1.16
0.1.15
0.1.14
0.1.13
0.1.12
0.1.11
0.1.10
0.1.9
0.1.9-alpha.9
0.1.9-alpha.8
0.1.9-alpha.7
0.1.9-alpha.6
0.1.9-alpha.5
0.1.9-alpha.1
0.1.8
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0