public class CtClassImpl<T> extends CtTypeImpl<T> implements CtClass<T>
CtClass
.ERROR_MESSAGE_TO_STRING, factory, LOGGER, parent
INNERTTYPE_SEPARATOR, NAME_UNKNOWN
Constructor and Description |
---|
CtClassImpl() |
Modifier and Type | Method and Description |
---|---|
void |
accept(CtVisitor v)
Accepts a visitor
|
<C extends CtClass<T>> |
addAnonymousExecutable(CtAnonymousExecutable e)
Add an anonymous block to this class.
|
<C extends CtClass<T>> |
addConstructor(CtConstructor<T> constructor)
Adds a constructor to this class.
|
CtClass<T> |
clone()
Clone the element which calls this method in a new object.
|
java.util.Collection<CtExecutableReference<?>> |
getAllExecutables()
adding the constructors and static executables
|
java.util.List<CtAnonymousExecutable> |
getAnonymousExecutables()
Returns the anonymous blocks of this class.
|
CtConstructor<T> |
getConstructor(CtTypeReference<?>... parameterTypes)
Returns the constructor of the class that takes the given argument types.
|
java.util.Set<CtConstructor<T>> |
getConstructors()
Returns the constructors of this class.
|
java.util.Collection<CtExecutableReference<?>> |
getDeclaredExecutables()
Gets the executables declared by this type if applicable.
|
java.lang.String |
getLabel()
Gets the label of this statement if defined.
|
CtTypeReference<?> |
getSuperclass()
Returns the class type directly extended by this class.
|
<C extends CtStatement> |
insertAfter(CtStatement statement)
Inserts a statement after the current statement.
|
<C extends CtStatement> |
insertAfter(CtStatementList statements)
Inserts a statement list before the current statement.
|
<C extends CtStatement> |
insertBefore(CtStatement statement)
Inserts a statement given as parameter before the current statement
(this).
|
<C extends CtStatement> |
insertBefore(CtStatementList statements)
Inserts a statement list before the current statement.
|
boolean |
isAnonymous()
Return
true if the referenced type is a anonymous type |
boolean |
isClass()
Returns true if this type is a class.
|
boolean |
isSubtypeOf(CtTypeReference<?> type)
Returns true if the referenced type is a sub-type of the given type.
|
T |
newInstance()
Creates an instance of this class.
|
<R extends CtCodeElement> |
partiallyEvaluate()
Partially evaluates an element and all its sub-elements.
|
boolean |
removeAnonymousExecutable(CtAnonymousExecutable e)
Remove an anonymous block to this class.
|
void |
removeConstructor(CtConstructor<T> constructor)
Removes a constructor from this class.
|
<C extends CtClass<T>> |
setAnonymousExecutables(java.util.List<CtAnonymousExecutable> anonymousExecutables)
Sets the anonymous blocks of this class.
|
<C extends CtClass<T>> |
setConstructors(java.util.Set<CtConstructor<T>> constructors)
Sets the constructors for this class.
|
<C extends CtStatement> |
setLabel(java.lang.String label)
Sets the label of this statement.
|
<C extends CtType<T>> |
setSuperclass(CtTypeReference<?> superClass)
Sets the superclass type.
|
addField, addField, addFieldAtTop, addFormalCtTypeParameter, addMethod, addModifier, addNestedType, addSuperInterface, addTypeMember, addTypeMemberAt, compileAndReplaceSnippets, copyType, getActualClass, getAllFields, getAllMethods, getDeclaredField, getDeclaredFields, getDeclaredOrInheritedField, getDeclaringType, getExtendedModifiers, getField, getFields, getFormalCtTypeParameters, getMethod, getMethod, getMethods, getMethodsAnnotatedWith, getMethodsByName, getModifiers, getNestedType, getNestedTypes, getPackage, getQualifiedName, getReference, getSuperInterfaces, getTopLevelType, getTypeErasure, getTypeMembers, getUsedTypes, getVisibility, hasMethod, hasModifier, hasSameParameters, isAbstract, isAnnotationType, isArray, isEnum, isFinal, isGenerics, isInterface, isLocalType, isNative, isParameterized, isPrimitive, isPrivate, isProtected, isPublic, isShadow, isStatic, isStrictfp, isSynchronized, isTopLevel, isTransient, isVolatile, removeField, removeFormalCtTypeParameter, removeMethod, removeModifier, removeNestedType, removeSuperInterface, removeTypeMember, setExtendedModifiers, setFields, setFormalCtTypeParameters, setMethods, setModifiers, setNestedTypes, setShadow, setSuperInterfaces, setTypeMembers, setVisibility, toStringWithImports
getSimpleName, setSimpleName
addAnnotation, addComment, asIterable, comment, delete, descendantIterator, emptyList, emptySet, equals, filterChildren, getAllMetadata, getAnnotatedChildren, getAnnotation, getAnnotation, getAnnotations, getComments, getDirectChildren, getDocComment, getElements, getFactory, getMetadata, getMetadataKeys, getOriginalSourceFragment, getParent, getParent, getParent, getPath, getPosition, getReferencedTypes, getRoleInParent, getShortRepresentation, getValueByRole, hasAnnotation, hashCode, hasParent, isImplicit, isParentInitialized, map, map, prettyprint, putMetadata, removeAnnotation, removeComment, replace, replace, setAllMetadata, setAnnotations, setComments, setDocComment, setFactory, setImplicit, setParent, setPosition, setPositions, setValueByRole, toString, toStringDebug, unmodifiableList, updateAllParentsBelow
finalize, getClass, notify, notifyAll, wait, wait, wait
addField, addField, addFieldAtTop, addMethod, addNestedType, addSuperInterface, addTypeMember, addTypeMemberAt, compileAndReplaceSnippets, copyType, getActualClass, getAllMethods, getField, getFields, getMethod, getMethod, getMethods, getMethodsAnnotatedWith, getMethodsByName, getNestedType, getNestedTypes, getPackage, getReference, getSimpleName, getTypeMembers, getUsedTypes, hasMethod, isTopLevel, removeField, removeMethod, removeNestedType, removeSuperInterface, removeTypeMember, setFields, setMethods, setNestedTypes, setSuperInterfaces, setTypeMembers, toStringWithImports
getAllFields, getDeclaredField, getDeclaredFields, getDeclaredOrInheritedField, getModifiers, getQualifiedName, getSuperInterfaces, getTypeErasure, isAnnotationType, isArray, isEnum, isGenerics, isInterface, isLocalType, isParameterized, isPrimitive
addFormalCtTypeParameter, getFormalCtTypeParameters, removeFormalCtTypeParameter, setFormalCtTypeParameters
getDeclaringType, getTopLevelType
addModifier, getExtendedModifiers, getModifiers, getVisibility, hasModifier, isAbstract, isFinal, isNative, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile, removeModifier, setExtendedModifiers, setModifiers, setVisibility
setSimpleName
addAnnotation, addComment, asIterable, delete, descendantIterator, getAllMetadata, getAnnotatedChildren, getAnnotation, getAnnotation, getAnnotations, getComments, getDirectChildren, getDocComment, getElements, getMetadata, getMetadataKeys, getOriginalSourceFragment, getParent, getParent, getParent, getPath, getPosition, getReferencedTypes, getRoleInParent, getShortRepresentation, getValueByRole, hasAnnotation, hasParent, isImplicit, isParentInitialized, prettyprint, putMetadata, removeAnnotation, removeComment, replace, replace, setAllMetadata, setAnnotations, setComments, setDocComment, setImplicit, setParent, setPosition, setPositions, setValueByRole, toString, toStringDebug, updateAllParentsBelow
getFactory, setFactory
filterChildren, map, map
isShadow, setShadow
comment
public void accept(CtVisitor v)
CtVisitable
accept
in interface CtVisitable
public java.util.List<CtAnonymousExecutable> getAnonymousExecutables()
CtClass
CtType.getTypeMembers()
getAnonymousExecutables
in interface CtClass<T>
public CtConstructor<T> getConstructor(CtTypeReference<?>... parameterTypes)
CtClass
CtType.getTypeMembers()
getConstructor
in interface CtClass<T>
public java.util.Set<CtConstructor<T>> getConstructors()
CtClass
CtType.getTypeMembers()
getConstructors
in interface CtClass<T>
public <C extends CtClass<T>> C addAnonymousExecutable(CtAnonymousExecutable e)
CtClass
addAnonymousExecutable
in interface CtClass<T>
public boolean removeAnonymousExecutable(CtAnonymousExecutable e)
CtClass
removeAnonymousExecutable
in interface CtClass<T>
public CtTypeReference<?> getSuperclass()
CtTypeInformation
getSuperclass
in interface CtTypeInformation
getSuperclass
in class CtTypeImpl<T>
public <C extends CtClass<T>> C setAnonymousExecutables(java.util.List<CtAnonymousExecutable> anonymousExecutables)
CtClass
setAnonymousExecutables
in interface CtClass<T>
public <C extends CtClass<T>> C setConstructors(java.util.Set<CtConstructor<T>> constructors)
CtClass
setConstructors
in interface CtClass<T>
public <C extends CtClass<T>> C addConstructor(CtConstructor<T> constructor)
CtClass
addConstructor
in interface CtClass<T>
public void removeConstructor(CtConstructor<T> constructor)
CtClass
removeConstructor
in interface CtClass<T>
public <C extends CtType<T>> C setSuperclass(CtTypeReference<?> superClass)
CtType
setSuperclass
in interface CtType<T>
setSuperclass
in class CtTypeImpl<T>
public boolean isClass()
CtTypeInformation
isClass
in interface CtTypeInformation
isClass
in class CtTypeImpl<T>
public boolean isAnonymous()
CtTypeInformation
true
if the referenced type is a anonymous typeisAnonymous
in interface CtClass<T>
isAnonymous
in interface CtTypeInformation
isAnonymous
in class CtTypeImpl<T>
public boolean isSubtypeOf(CtTypeReference<?> type)
CtTypeInformation
isSubtypeOf
in interface CtTypeInformation
public <C extends CtStatement> C insertAfter(CtStatement statement)
CtStatement
insertAfter
in interface CtStatement
public <C extends CtStatement> C insertAfter(CtStatementList statements)
CtStatement
insertAfter
in interface CtStatement
public <C extends CtStatement> C insertBefore(CtStatement statement)
CtStatement
insertBefore
in interface CtStatement
public <C extends CtStatement> C insertBefore(CtStatementList statements)
CtStatement
insertBefore
in interface CtStatement
public java.lang.String getLabel()
CtStatement
getLabel
in interface CtStatement
public <C extends CtStatement> C setLabel(java.lang.String label)
CtStatement
setLabel
in interface CtStatement
setLabel
in interface CtClass<T>
public <R extends CtCodeElement> R partiallyEvaluate()
CtCodeElement
partiallyEvaluate
in interface CtCodeElement
R
- the returned elementpublic java.util.Collection<CtExecutableReference<?>> getDeclaredExecutables()
CtTypeInformation
getDeclaredExecutables
in interface CtTypeInformation
getDeclaredExecutables
in class CtTypeImpl<T>
public CtClass<T> clone()
CtElement
Refactoring.copyType(CtType)
and Refactoring.copyMethod(CtMethod)
instead which does additional work beyond cloning.clone
in interface CtCodeElement
clone
in interface CtStatement
clone
in interface CtClass<T>
clone
in interface CtElement
clone
in interface CtNamedElement
clone
in interface CtType<T>
clone
in class CtTypeImpl<T>
public T newInstance()
CtClass
newInstance
in interface CtClass<T>
public java.util.Collection<CtExecutableReference<?>> getAllExecutables()
getAllExecutables
in interface CtTypeInformation
getAllExecutables
in class CtTypeImpl<T>
Copyright © 2007–2021 Inria. All rights reserved.