tigase.util.reflection

## Class ReflectionHelper

- java.lang.Object
- - tigase.util.reflection.ReflectionHelper

-     public class ReflectionHelper
      extends Object

  Utility class with useful methods to work with reflections
  Author:
    andrzej

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `ReflectionHelper.Handler<A extends Annotation,T>`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ReflectionHelper()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `boundMatch(Class c1, TypeVariable t2)`
    `static boolean` | `boundMatch(TypeVariable t1, TypeVariable t2)`
    `static boolean` | `classMatchesClassWithParameters(Class clazz, Class requiredType, Type[] requiredTypeParams)`
    `static boolean` | `classMatchesType(Class clazz, Type required)`
    `static <A extends Annotation,T> Collection<T>` | `collectAnnotatedMethods(Object consumer, Class<A> annotationCls, ReflectionHelper.Handler<A,T> handler)` This method collects every method of consumer class annotated with passed annotation and for each of them executes implementation of Handler.
    `static boolean` | `compareTypes(Type expectedType, Type actualType, Map<TypeVariable<?>,Type> ownerExpectedTypesMap, Map<TypeVariable<?>,Type> ownerActualTypesMap)`
    `static Map<TypeVariable<?>,Type>` | `createGenericsTypeMap(Class<?> cls)`
    `static Type` | `getCollectionParamter(Type genericType, Class clazz)`
    `static Class<?>` | `getItemClassOfGenericCollection(Field f)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ReflectionHelper

          public ReflectionHelper()

  - ### Method Detail

    - #### boundMatch

          public static boolean boundMatch(Class c1,
                                           TypeVariable t2)

    - #### boundMatch

          public static boolean boundMatch(TypeVariable t1,
                                           TypeVariable t2)

    - #### classMatchesClassWithParameters

          public static boolean classMatchesClassWithParameters(Class clazz,
                                                                Class requiredType,
                                                                Type[] requiredTypeParams)

    - #### classMatchesType

          public static boolean classMatchesType(Class clazz,
                                                 Type required)

    - #### collectAnnotatedMethods

          public static <A extends Annotation,T> Collection<T> collectAnnotatedMethods(Object consumer,
                                                                                       Class<A> annotationCls,
                                                                                       ReflectionHelper.Handler<A,T> handler)

      This method collects every method of consumer class annotated with passed annotation and for each of them executes implementation of Handler.

    - #### compareTypes

          public static boolean compareTypes(Type expectedType,
                                             Type actualType,
                                             Map<TypeVariable<?>,Type> ownerExpectedTypesMap,
                                             Map<TypeVariable<?>,Type> ownerActualTypesMap)

    - #### createGenericsTypeMap

          public static Map<TypeVariable<?>,Type> createGenericsTypeMap(Class<?> cls)

    - #### getCollectionParamter

          public static Type getCollectionParamter(Type genericType,
                                                   Class clazz)

    - #### getItemClassOfGenericCollection

          public static Class<?> getItemClassOfGenericCollection(Field f)

Copyright © 2004–2021 "Tigase, Inc.". All rights reserved.