|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.codehaus.groovy.ast.tools.GenericsUtils
public class GenericsUtils
Utility methods to deal with generic types.
| Field Summary | |
|---|---|
static GenericsType[] |
EMPTY_GENERICS_ARRAY
|
| Constructor Summary | |
|---|---|
GenericsUtils()
|
|
| Method Summary | |
|---|---|
static GenericsType[] |
alignGenericTypes(GenericsType[] redirectGenericTypes,
GenericsType[] parameterizedTypes,
GenericsType[] alignmentTarget)
Given a parameterized type and a generic type information, aligns actual type parameters. |
static GenericsType |
buildWildcardType(ClassNode... types)
Generates a wildcard generic type in order to be used for checks against class nodes. |
static java.util.Map<java.lang.String,GenericsType> |
extractPlaceholders(ClassNode cn)
|
static void |
extractPlaceholders(ClassNode node,
java.util.Map<java.lang.String,GenericsType> map)
For a given classnode, fills in the supplied map with the parameterized types it defines. |
static ClassNode |
parameterizeInterfaceGenerics(ClassNode hint,
ClassNode target)
Deprecated. Use #parameterizeType instead |
static ClassNode |
parameterizeType(ClassNode hint,
ClassNode target)
Interface class nodes retrieved from ClassNode.getInterfaces()
or ClassNode.getAllInterfaces() are returned with generic type
arguments. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final GenericsType[] EMPTY_GENERICS_ARRAY
| Constructor Detail |
|---|
public GenericsUtils()
| Method Detail |
|---|
public static GenericsType[] alignGenericTypes(GenericsType[] redirectGenericTypes,
GenericsType[] parameterizedTypes,
GenericsType[] alignmentTarget)
<T,U,V>(redirectGenericTypes), is used with actual type parameters
<java.lang.String, U,V>, then a class or interface using generic types
<T,V>will be aligned to
<java.lang.String,V>
redirectGenericTypes - the type arguments or the redirect class nodeparameterizedTypes - the actual type arguments used on this class nodealignmentTarget - the generic type arguments to which we want to align to
public static GenericsType buildWildcardType(ClassNode... types)
GenericsType.isCompatibleWith(org.codehaus.groovy.ast.ClassNode).
types - the type to be used as the wildcard upper bound
public static java.util.Map<java.lang.String,GenericsType> extractPlaceholders(ClassNode cn)
public static void extractPlaceholders(ClassNode node,
java.util.Map<java.lang.String,GenericsType> map)
node - map -
public static ClassNode parameterizeInterfaceGenerics(ClassNode hint,
ClassNode target)
ClassNode.getInterfaces()
or ClassNode.getAllInterfaces() are returned with generic type
arguments. This method allows returning a parameterized interface given the parameterized class
node which implements this interface.
hint - the class node where generics types are parameterizedtarget - the interface we want to parameterize generics types
public static ClassNode parameterizeType(ClassNode hint,
ClassNode target)
ClassNode.getInterfaces()
or ClassNode.getAllInterfaces() are returned with generic type
arguments. This method allows returning a parameterized interface given the parameterized class
node which implements this interface.
hint - the class node where generics types are parameterizedtarget - the interface we want to parameterize generics types
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||