meanmirror

meanmirror provides reflection utilities.

License

License

Categories

Categories

Mirror Application Layer Libs Introspection
GroupId

GroupId

com.github.meanbeanlib
ArtifactId

ArtifactId

meanmirror
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

meanmirror
meanmirror provides reflection utilities.
Project URL

Project URL

http://github.com/meanbeanlib/meanmirror/
Project Organization

Project Organization

meanbean
Source Code Management

Source Code Management

http://github.com/meanbeanlib/meanmirror/tree/master

Download meanmirror

How to add to project

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

Dependencies

test (1)

Group / Artifact Type Version
junit : junit jar 4.13

Project Modules

There are no modules declared in this project.

meanmirror

Maven Central Java CI

Usage

Simply pass a method reference to Executables class. This will provide you with a java.lang.reflect.Method or a java.lang.reflect.Constructor.

// Get method
Method isEmptyMethod = Executables.findMethod(String::isEmpty);

// Get method
Method getPropertyMethod = Executables.findMethod(MyBean::getProperty);

// Get method that throws checked exception
Method exceptionThrowingMethod = Executables.findMethod(BufferedReader::readLine);

// to get vararg method you must specify parameters in generics
Method varargMethod = Executables.<Method, String, Class<?>[]> findMethod(getClass()::getDeclaredMethod)

Notice that you have to provide the method parameters in generics under certain circumstances (When the method is overloaded, or if the method has a varargs parameter).

The project requires Java 8 or above.

Dependency Management

Since this project is not in any Maven repo you must use JitPack to add the dependency.

History

This is a fork of safety-mirror project.

License

This code is released under the Apache 2.0 license. ​​​​​​

meanmirror

Copyright (C) 2020 the original author or authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Versions

Version
1.0.0