public class TypeUtil extends Object
| Constructor and Description |
|---|
TypeUtil() |
| Modifier and Type | Method and Description |
|---|---|
static IMethodDeclaration |
findMethod(String name,
String[] paramTypes,
boolean isConstructor,
boolean isDestructor,
ICElement type)
Finds a method in a type.
|
static IMethodDeclaration |
findMethod(String name,
String[] paramTypes,
boolean isConstructor,
boolean isDestructor,
IMethodDeclaration[] methods)
Finds a method by name.
|
static ICElement[] |
getAllTypes(ITranslationUnit tu)
Returns all types declared in the given translation unit in the order
in which they appear in the source.
|
static ICElement |
getDeclaringClass(ICElement type) |
static ICElement |
getDeclaringType(ICElement elem)
Returns the type in which this member is declared, or
null
if this member is not declared in a type (for example, a top-level type). |
static ICElement[] |
getFields(ICElement elem) |
static IQualifiedTypeName |
getFullyQualifiedName(ICElement type) |
static IMethodDeclaration[] |
getMethods(ICElement elem) |
static ITranslationUnit |
getTranslationUnit(ICElement elem) |
static ICElement[] |
getTypes(ICElement elem)
Returns the immediate member types declared by the given element.
|
static ICElement[] |
getTypes(ITranslationUnit tu)
Returns the top-level types declared in the given translation unit
in the order in which they appear in the source.
|
static boolean |
isClass(ICElement type) |
static boolean |
isClassOrStruct(ICElement type) |
static boolean |
isDeclaringType(ICElement elem) |
static boolean |
isMemberType(ICElement elem) |
static boolean |
isNamespace(ICElement type) |
static boolean |
isSameMethodSignature(String name,
String[] paramTypes,
boolean isConstructor,
boolean isDestructor,
IMethodDeclaration curr)
Tests if a method equals to the given signature.
|
public static boolean isDeclaringType(ICElement elem)
public static boolean isMemberType(ICElement elem)
public static ICElement getDeclaringType(ICElement elem)
null
if this member is not declared in a type (for example, a top-level type).
This is a handle-only method.null
if this member is not declared in a type (for example, a top-level type)public static boolean isClassOrStruct(ICElement type)
public static boolean isClass(ICElement type)
public static boolean isNamespace(ICElement type)
public static ICElement[] getTypes(ITranslationUnit tu) throws CModelException
tu - the translation unitCModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resourcepublic static ICElement[] getAllTypes(ITranslationUnit tu) throws CModelException
CModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resourcepublic static ICElement[] getTypes(ICElement elem) throws CModelException
elem - the elementCModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.public static ITranslationUnit getTranslationUnit(ICElement elem)
public static IQualifiedTypeName getFullyQualifiedName(ICElement type)
public static IMethodDeclaration[] getMethods(ICElement elem)
public static IMethodDeclaration findMethod(String name, String[] paramTypes, boolean isConstructor, boolean isDestructor, IMethodDeclaration[] methods) throws CModelException
name - The name of the method to findparamTypes - The type signatures of the parameters e.g. {"QString;","I"}isConstructor - If the method is a constructormethods - The methods to search innull, if nothing foundCModelExceptionpublic static boolean isSameMethodSignature(String name, String[] paramTypes, boolean isConstructor, boolean isDestructor, IMethodDeclaration curr) throws CModelException
name - Name of the methodparamTypes - The type signatures of the parameters e.g. {"QString;","I"}isConstructor - Specifies if the method is a constructortrue if the method has the given name and parameter types and constructor state.CModelExceptionpublic static IMethodDeclaration findMethod(String name, String[] paramTypes, boolean isConstructor, boolean isDestructor, ICElement type) throws CModelException
name - The name of the method to findparamTypes - The type signatures of the parameters e.g. {"QString;","I"}isConstructor - If the method is a constructornull, if nothing foundCModelExceptionCopyright (c) IBM Corp. and others 2004, 2020. All Rights Reserved.