Class ElementReflectionUtils

java.lang.Object
dev.getelements.elements.sdk.util.reflection.ElementReflectionUtils
All Implemented Interfaces:
ElementStandardBeanProperties

public class ElementReflectionUtils extends Object implements ElementStandardBeanProperties
Some basic utilities for accessing reflections within SDK code.
  • Constructor Details

    • ElementReflectionUtils

      public ElementReflectionUtils()
  • Method Details

    • getInstance

      public static ElementReflectionUtils getInstance()
      Gets the static shared instance.
      Returns:
      the ElementReflectionUtils
    • getPackageInfo

      public Class<?> getPackageInfo(String name)
      Gets the package-info Class for the supplied package name.
      Parameters:
      name - the package name
      Returns:
      the Package
    • getPackageInfo

      public Class<?> getPackageInfo(String name, ClassLoader classLoader)
      Gets the package-info Class for the supplied package name.
      Parameters:
      name - the package name
      classLoader - the ClassLoader to use
      Returns:
      the Package
    • getPackageForElementsAnnotations

      public Package getPackageForElementsAnnotations(String name)
      Gets the Package from the package-info class.
      Parameters:
      name - the package name
      Returns:
      the Package
    • getPackageForElementsAnnotations

      public Package getPackageForElementsAnnotations(String name, ClassLoader classLoader)
      Gets the Package from the package-info class.
      Parameters:
      name - the package name
      classLoader - the ClassLoader to use
      Returns:
      the Package
    • injectBeanProperties

      public <T> T injectBeanProperties(T target, Object... objects)
      Injects the standard bean properties into the supplied object. Standard bean property names are defined in ElementStandardBeanProperties.
      Type Parameters:
      T - the target type
      Parameters:
      target - the target
      objects - the beans
      Returns:
      the target object