reflection

Reflection utils

Лицензия

Лицензия

Группа

Группа

com.mercateo
Идентификатор

Идентификатор

reflection
Последняя версия

Последняя версия

1.2.14
Дата

Дата

Тип

Тип

jar
Описание

Описание

reflection
Reflection utils
Ссылка на сайт

Ссылка на сайт

https://github.com/Mercateo/reflection
Организация-разработчик

Организация-разработчик

Mercateo AG
Система контроля версий

Система контроля версий

https://github.com/Mercateo/reflection.git

Скачать reflection

Как подключить последнюю версию

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

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
net.bytebuddy : byte-buddy jar 1.7.11
org.objenesis : objenesis jar 2.6
org.cache2k : cache2k-core jar 1.0.2.Final

provided (1)

Идентификатор библиотеки Тип Версия
com.mercateo : default-immutables jar 1.2.1

test (5)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12
org.assertj : assertj-core jar 3.9.1
org.mockito : mockito-core jar 2.13.0
org.openjdk.jmh : jmh-core jar 1.20
org.openjdk.jmh : jmh-generator-annprocess jar 1.20

Модули Проекта

Данный проект не имеет модулей.

Build Status Coverage Status MavenCentral

com.mercateo:reflection

ProxyFactory — create an intercepting proxy

    InvocationHandler interceptor = ...
    TestClass proxy = ProxyFactory.createProxy(TestClass.class, interceptor);

Call — A type safe variant for examination of method calls

Given an arbitrary class

class TestClass {
    public Integer testMethod(String name, Long counter) {
        return 42;
    }
}

Call can record a given method call

Method method = Call.of(TestClass.class, c -> c.testMethod("foo", 1234l)).method();

and returns all relevant parameters like

  • Method
  • Call Arguments
  • Object of Method

There is an additional shortcut to get the called method with Call.methodOf(...):

Method method = Call.methodOf(TestClass.class, c -> c.testMethod(null, 0));

Which replaces using reflection to get the method:

Method method = TestClass.class.getDeclaredMethod("testMethod", String.class, Long.class);

The latter can throw a NoSuchMethodException. Using Call.of(...)/Call.methodOf(...) with an unknown method just leads to a compile error.

com.mercateo
the procurement platform for your business

Версии библиотеки

Версия
1.2.14
1.2.13
1.2.12
1.2.11
1.2.10
1.2.9
1.2.8
1.2.7
1.2.6
1.2.5
1.2.3