Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.openjpa.lib.util
Class ConcreteClassGenerator

    java.lang.Object
      org.apache.openjpa.lib.util.ConcreteClassGenerator

    public class ConcreteClassGenerator

extends Object

Dynamically generates concrete implementations of abstract classes.

Since:
  1.3.0
Author:
  Marc Prud'hommeaux, Pinaki Poddar

Constructor Summary
`ConcreteClassGenerator()`

Method Summary
`static
`<T> Constructor<T>`
` | `getConcreteConstructor(Class<T> abstractClass, Class<?>... argTypes)` Get the constructor of the concrete, dynamic wrapper class of the given abstract class with matching argument types.
`static
`<T> Class<? extends T>`
` | `makeConcrete(Class<T> abstractClass)` Takes an abstract class and returns a concrete implementation.
`static
`<T> T`
` | `newInstance(Class<T> c)`
`static
`<T> T`
` | `newInstance(Class<T> c, Class<?>[] paramTypes, Object[] params)` Utility method for safely invoking a constructor that we do not expect to throw exceptions.
`static
`<T,P> T`
` | `newInstance(Class<T> c, Class<? extends P> paramType, P param)`
`static
`<T,P1,P2> T`
` | `newInstance(Class<T> c, Class<? extends P1> paramType1, P1 param1, Class<? extends P2> paramType2, P2 param2)`
`static
`<T,P1,P2,P3> T`
` | `newInstance(Class<T> c, Class<? extends P1> paramType1, P1 param1, Class<? extends P2> paramType2, P2 param2, Class<? extends P3> paramType3, P3 param3)`
`static
`<T,P1,P2,P3,P4> T`
` | `newInstance(Class<T> c, Class<? extends P1> paramType1, P1 param1, Class<? extends P2> paramType2, P2 param2, Class<? extends P3> paramType3, P3 param3, Class<? extends P4> paramType4, P4 param4)`
`static
`<T> T`
` | `newInstance(Constructor<T> cons, Object... params)` Construct a new instance by the given constructor and its arguments.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ConcreteClassGenerator

    public ConcreteClassGenerator()

Method Detail

### getConcreteConstructor

    public static <T> Constructor<T> getConcreteConstructor(Class<T> abstractClass,
                                                            Class<?>... argTypes)
                                                 throws ClassNotFoundException

  Get the constructor of the concrete, dynamic wrapper class of the given abstract class with matching argument types.

  Parameters:
    `the` - argTypes of the constructor to look for. null signify default constructor.
  Throws:
    `ClassNotFoundException`

### makeConcrete

    public static <T> Class<? extends T> makeConcrete(Class<T> abstractClass)
                                           throws ClassNotFoundException

  Takes an abstract class and returns a concrete implementation. Note that it doesn't actually implement any abstract methods, it merely makes an abstract class loadable. Abstract methods will throw a `AbstractMethodError`.

  Parameters:
    `abstractClass` - the abstract class
  Returns:
    a concrete class
  Throws:
    `ClassNotFoundException`

### newInstance

    public static <T> T newInstance(Constructor<T> cons,
                                    Object... params)

  Construct a new instance by the given constructor and its arguments. Hopefully faster than looking for constructor in overloaded implementations.

### newInstance

    public static <T> T newInstance(Class<T> c,
                                    Class<?>[] paramTypes,
                                    Object[] params)

  Utility method for safely invoking a constructor that we do not expect to throw exceptions.

  Parameters:
    `c` - the class to construct
    `paramTypes` - the types of the parameters
    `params` - the parameter values
  Returns:
    the new instance

### newInstance

    public static <T> T newInstance(Class<T> c)

  See Also:
    `newInstance(java.lang.Class,java.lang.Class[],java.lang.Object[])`

### newInstance

    public static <T,P> T newInstance(Class<T> c,
                                      Class<? extends P> paramType,
                                      P param)

  See Also:
    `newInstance(java.lang.Class,java.lang.Class[],java.lang.Object[])`

### newInstance

    public static <T,P1,P2> T newInstance(Class<T> c,
                                          Class<? extends P1> paramType1,
                                          P1 param1,
                                          Class<? extends P2> paramType2,
                                          P2 param2)

  See Also:
    `newInstance(java.lang.Class,java.lang.Class[],java.lang.Object[])`

### newInstance

    public static <T,P1,P2,P3> T newInstance(Class<T> c,
                                             Class<? extends P1> paramType1,
                                             P1 param1,
                                             Class<? extends P2> paramType2,
                                             P2 param2,
                                             Class<? extends P3> paramType3,
                                             P3 param3)

  See Also:
    `newInstance(java.lang.Class,java.lang.Class[],java.lang.Object[])`

### newInstance

    public static <T,P1,P2,P3,P4> T newInstance(Class<T> c,
                                                Class<? extends P1> paramType1,
                                                P1 param1,
                                                Class<? extends P2> paramType2,
                                                P2 param2,
                                                Class<? extends P3> paramType3,
                                                P3 param3,
                                                Class<? extends P4> paramType4,
                                                P4 param4)

  See Also:
    `newInstance(java.lang.Class,java.lang.Class[],java.lang.Object[])`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.