org.hibernate.search.util.impl

## Class ReflectionHelper

- java.lang.Object
- - org.hibernate.search.util.impl.ReflectionHelper

-     public abstract class ReflectionHelper
      extends Object

  Author:
    Emmanuel Bernard, Hardy Ferentschik

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `containsSearchAnnotations(org.hibernate.annotations.common.reflection.XClass mappedClass)` Checks whether the specified class contains any Search-specific annotations.
    `static Object` | `createInstance(Class<?> clazz, boolean checkForFactoryAnnotation)` Creates an instance of the specified class and returns it.
    `static List<org.hibernate.annotations.common.reflection.XClass>` | `createXClassHierarchy(org.hibernate.annotations.common.reflection.XClass clazz)` Creates the class hierarchy for a given `XClass`.
    `static String` | `getAttributeName(org.hibernate.annotations.common.reflection.XMember member, String name)` Get attribute name out of member unless overridden by `name`.
    `static Object` | `getMemberValue(Object bean, org.hibernate.annotations.common.reflection.XMember getter)`
    `static boolean` | `isFloatingPointType(Class<?> type)` Checks whether the specified type is a floating point type.
    `static boolean` | `isIntegerType(Class<?> type)` Checks whether the specified type is a integer type.
    `static boolean` | `isSearchAnnotation(Annotation annotation)` Checks if the annotation is a Search annotation by comparing the package of the annotation.
    `static void` | `setAccessible(AccessibleObject member)` Always use this method to set accessibility regardless of the visibility.
    `static void` | `setAccessible(org.hibernate.annotations.common.reflection.XMember member)` Always use this method to set accessibility regardless of the visibility.

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

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

- - ### Method Detail

    - #### getAttributeName

          public static String getAttributeName(org.hibernate.annotations.common.reflection.XMember member,
                                                String name)

      Get attribute name out of member unless overridden by `name`.
      Parameters:
        `member` - `XMember` from which to extract the name.
        `name` - Override value which will be returned in case it is not empty.
      Returns:
        attribute name out of member unless overridden by `name`.

    - #### setAccessible

          public static void setAccessible(org.hibernate.annotations.common.reflection.XMember member)

      Always use this method to set accessibility regardless of the visibility.
      Parameters:
        `member` - the `XMember` to check

    - #### setAccessible

          public static void setAccessible(AccessibleObject member)

      Always use this method to set accessibility regardless of the visibility.
      Parameters:
        `member` - the `AccessibleObject` to change

    - #### getMemberValue

          public static Object getMemberValue(Object bean,
                                              org.hibernate.annotations.common.reflection.XMember getter)

    - #### createXClassHierarchy

          public static List<org.hibernate.annotations.common.reflection.XClass> createXClassHierarchy(org.hibernate.annotations.common.reflection.XClass clazz)

      Creates the class hierarchy for a given `XClass`.
      Parameters:
        `clazz` - the class for which to create the hierarchy
      Returns:
        the list of classes in the hierarchy starting at `java.lang.Object`

    - #### containsSearchAnnotations

          public static boolean containsSearchAnnotations(org.hibernate.annotations.common.reflection.XClass mappedClass)

      Checks whether the specified class contains any Search-specific annotations.

      This method will return `true` if such an annotation is detected in the class itself or in one of its superclass, either applied directly on the class, on a field, or on a method.

      Parameters:
        `mappedClass` - the `XClass` to check for Search annotations
      Returns:
        Returns `true` if the class contains at least one Search annotation, `false` otherwise

    - #### isSearchAnnotation

          public static boolean isSearchAnnotation(Annotation annotation)

      Checks if the annotation is a Search annotation by comparing the package of the annotation.
      Parameters:
        `annotation` - the annotation to check
      Returns:
        Returns `true` if the annotation is a Search annotation, `false` otherwise

    - #### createInstance

          public static Object createInstance(Class<?> clazz,
                                              boolean checkForFactoryAnnotation)

      Creates an instance of the specified class and returns it. If `checkForFactoryAnnotation == true`, the created instance is checked for a `@Factory` annotated method. If one exists the factory method is invoked and the return value returns as expected instances.
      Parameters:
        `clazz` - the class to instantiate
        `checkForFactoryAnnotation` - whether to check for `@Factory` annotated methods
      Returns:
        the created instance

    - #### isFloatingPointType

          public static boolean isFloatingPointType(Class<?> type)

      Checks whether the specified type is a floating point type.
      Parameters:
        `type` - the type to check
      Returns:
        `true` if the specified type is an floating point type or a wrapper thereof. `false` otherwise.

    - #### isIntegerType

          public static boolean isIntegerType(Class<?> type)

      Checks whether the specified type is a integer type.
      Parameters:
        `type` - the type to check
      Returns:
        `true` if the specified type is an primitive integer type or a wrapper thereof. `false` otherwise.

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved