org.jboss.jca.core.util

## Class Injection

- java.lang.Object
- - org.jboss.jca.core.util.Injection

-     public class Injection
      extends java.lang.Object

  Injection utility which can inject values into objects. This file is a copy of the `com.github.fungal.api.util.Injection` class.
  Author:
    Jesper Pedersen

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Injection()` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected java.lang.reflect.Field` | `findField(java.lang.Class<?> clz, java.lang.String fieldName, java.lang.String fieldType)` Find a field
    `protected java.lang.reflect.Method` | `findMethod(java.lang.Class<?> clz, java.lang.String methodName, java.lang.String propertyType)` Find a method
    `protected java.lang.String` | `getSubstitutionValue(java.lang.String input)` System property substitution
    `protected java.lang.Object` | `getValue(java.lang.String name, java.lang.Class<?> clz, java.lang.Object v, java.lang.ClassLoader cl)` Get the value
    `void` | `inject(java.lang.Object object, java.lang.String propertyName, java.lang.Object propertyValue)` Inject a value into an object property
    `void` | `inject(java.lang.Object object, java.lang.String propertyName, java.lang.Object propertyValue, java.lang.String propertyType)` Inject a value into an object property
    `void` | `inject(java.lang.Object object, java.lang.String propertyName, java.lang.Object propertyValue, java.lang.String propertyType, boolean includeFields)` Inject a value into an object property

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

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

- - ### Constructor Detail

    - #### Injection

          public Injection()

      Constructor

  - ### Method Detail

    - #### inject

          public void inject(java.lang.Object object,
                             java.lang.String propertyName,
                             java.lang.Object propertyValue)
                      throws java.lang.NoSuchMethodException,
                             java.lang.IllegalAccessException,
                             java.lang.reflect.InvocationTargetException

      Inject a value into an object property
      Parameters:
        `object` - The object
        `propertyName` - The property name
        `propertyValue` - The property value
      Throws:
        `java.lang.NoSuchMethodException` - If the property method cannot be found
        `java.lang.IllegalAccessException` - If the property method cannot be accessed
        `java.lang.reflect.InvocationTargetException` - If the property method cannot be executed

    - #### inject

          public void inject(java.lang.Object object,
                             java.lang.String propertyName,
                             java.lang.Object propertyValue,
                             java.lang.String propertyType)
                      throws java.lang.NoSuchMethodException,
                             java.lang.IllegalAccessException,
                             java.lang.reflect.InvocationTargetException

      Inject a value into an object property
      Parameters:
        `object` - The object
        `propertyName` - The property name
        `propertyValue` - The property value
        `propertyType` - The property type as a fully quilified class name
      Throws:
        `java.lang.NoSuchMethodException` - If the property method cannot be found
        `java.lang.IllegalAccessException` - If the property method cannot be accessed
        `java.lang.reflect.InvocationTargetException` - If the property method cannot be executed

    - #### inject

          public void inject(java.lang.Object object,
                             java.lang.String propertyName,
                             java.lang.Object propertyValue,
                             java.lang.String propertyType,
                             boolean includeFields)
                      throws java.lang.NoSuchMethodException,
                             java.lang.IllegalAccessException,
                             java.lang.reflect.InvocationTargetException

      Inject a value into an object property
      Parameters:
        `object` - The object
        `propertyName` - The property name
        `propertyValue` - The property value
        `propertyType` - The property type as a fully quilified class name
        `includeFields` - Should fields be included for injection if a method can't be found
      Throws:
        `java.lang.NoSuchMethodException` - If the property method cannot be found
        `java.lang.IllegalAccessException` - If the property method cannot be accessed
        `java.lang.reflect.InvocationTargetException` - If the property method cannot be executed

    - #### findMethod

          protected java.lang.reflect.Method findMethod(java.lang.Class<?> clz,
                                                        java.lang.String methodName,
                                                        java.lang.String propertyType)

      Find a method
      Parameters:
        `clz` - The class
        `methodName` - The method name
        `propertyType` - The property type; can be `null`
      Returns:
        The method; `null` if not found

    - #### findField

          protected java.lang.reflect.Field findField(java.lang.Class<?> clz,
                                                      java.lang.String fieldName,
                                                      java.lang.String fieldType)

      Find a field
      Parameters:
        `clz` - The class
        `fieldName` - The field name
        `fieldType` - The field type; can be `null`
      Returns:
        The field; `null` if not found

    - #### getValue

          protected java.lang.Object getValue(java.lang.String name,
                                              java.lang.Class<?> clz,
                                              java.lang.Object v,
                                              java.lang.ClassLoader cl)
                                       throws java.lang.Exception

      Get the value
      Parameters:
        `name` - The value name
        `clz` - The value class
        `v` - The value
        `cl` - The class loader
      Returns:
        The substituted value
      Throws:
        `java.lang.Exception` - Thrown in case of an error

    - #### getSubstitutionValue

          protected java.lang.String getSubstitutionValue(java.lang.String input)

      System property substitution
      Parameters:
        `input` - The input string
      Returns:
        The output

Copyright © 2014 IronJacamar (http://www.ironjacamar.org)