Package spoon.reflect.declaration
Interface CtTypeParameter
- All Superinterfaces:
Cloneable
,CtElement
,CtFormalTypeDeclarer
,CtModifiable
,CtNamedElement
,CtQueryable
,CtShadowable
,CtType<Object>
,CtTypeInformation
,CtTypeMember
,CtVisitable
,FactoryAccessor
,Serializable
,SourcePositionHolder
- All Known Implementing Classes:
CtTypeParameterImpl
This element defines a declaration of a type parameter (aka generics).
For example, in class A<E> { ... }, the "E" is modeled as an instance of CtTypeParameter.
-
Field Summary
Fields inherited from interface spoon.reflect.declaration.CtType
INNERTTYPE_SEPARATOR, NAME_UNKNOWN
-
Method Summary
Modifier and TypeMethodDescriptionaddFieldAtTop(CtField<F> field)
Adds a field at the top of the type (before static block).Adds a method to this type.addNestedType(CtType<N> nestedType)
Add a nested type.addSuperInterface(CtTypeReference<S> interfac)
clone()
Clone the element which calls this method in a new object.override the return typeSets all fields in the type.<T extends CtFormalTypeDeclarer>
TsetFormalCtTypeParameters(List<CtTypeParameter> formalTypeParameters)
Sets the type parameters of this generic element.setMethods(Set<CtMethod<?>> methods)
Sets the methods of this type.<T extends CtModifiable>
TsetModifiers(Set<ModifierKind> modifiers)
Sets the modifiers.setNestedTypes(Set<CtType<?>> nestedTypes)
Sets all nested types.setSuperInterfaces(Set<CtTypeReference<?>> interfaces)
Sets the super interfaces of this type.setTypeMembers(List<CtTypeMember> members)
Removes all types members with these new members.Methods inherited from interface spoon.reflect.declaration.CtElement
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
Methods inherited from interface spoon.reflect.declaration.CtFormalTypeDeclarer
addFormalCtTypeParameter, addFormalCtTypeParameterAt, getFormalCtTypeParameters, removeFormalCtTypeParameter
Methods inherited from interface spoon.reflect.declaration.CtModifiable
addModifier, getExtendedModifiers, getModifiers, getVisibility, hasModifier, isAbstract, isFinal, isNative, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile, removeModifier, setExtendedModifiers, setVisibility
Methods inherited from interface spoon.reflect.declaration.CtNamedElement
setSimpleName
Methods inherited from interface spoon.reflect.visitor.chain.CtQueryable
filterChildren, map, map
Methods inherited from interface spoon.reflect.declaration.CtShadowable
isShadow, setShadow
Methods inherited from interface spoon.reflect.declaration.CtType
addField, addField, addTypeMember, addTypeMemberAt, compileAndReplaceSnippets, copyType, getActualClass, getAllMethods, getField, getFields, getMethod, getMethod, getMethods, getMethodsAnnotatedWith, getMethodsByName, getNestedType, getNestedTypes, getPackage, getSimpleName, getTypeMembers, getUsedTypes, hasMethod, isTopLevel, removeField, removeMethod, removeNestedType, removeSuperInterface, removeTypeMember, setSuperclass, toStringWithImports
Methods inherited from interface spoon.reflect.declaration.CtTypeInformation
getAllExecutables, getAllFields, getDeclaredExecutables, getDeclaredField, getDeclaredFields, getDeclaredOrInheritedField, getModifiers, getQualifiedName, getSuperclass, getSuperInterfaces, getTypeErasure, isAnnotationType, isAnonymous, isArray, isClass, isEnum, isGenerics, isInterface, isLocalType, isParameterized, isPrimitive, isSubtypeOf
Methods inherited from interface spoon.reflect.declaration.CtTypeMember
getDeclaringType, getTopLevelType
Methods inherited from interface spoon.reflect.visitor.CtVisitable
accept
Methods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
Method Details
-
getReference
CtTypeParameterReference getReference()override the return type- Specified by:
getReference
in interfaceCtNamedElement
- Specified by:
getReference
in interfaceCtType<Object>
-
getTypeParameterDeclarer
CtFormalTypeDeclarer getTypeParameterDeclarer()- Returns:
- the
CtFormalTypeDeclarer
, which declares thisCtTypeParameter
-
clone
CtTypeParameter clone()Description copied from interface:CtElement
Clone the element which calls this method in a new object. Note that that references are kept as is, and thus, so if you clone whole classes or methods, some parts of the cloned element (eg executable references) may still point to the initial element. In this case, consider using methodsRefactoring.copyType(CtType)
andRefactoring.copyMethod(CtMethod)
instead which does additional work beyond cloning. -
setFormalCtTypeParameters
<T extends CtFormalTypeDeclarer> T setFormalCtTypeParameters(List<CtTypeParameter> formalTypeParameters)Description copied from interface:CtFormalTypeDeclarer
Sets the type parameters of this generic element.- Specified by:
setFormalCtTypeParameters
in interfaceCtFormalTypeDeclarer
-
setSuperInterfaces
Description copied from interface:CtType
Sets the super interfaces of this type.- Specified by:
setSuperInterfaces
in interfaceCtType<Object>
-
addSuperInterface
- Specified by:
addSuperInterface
in interfaceCtType<Object>
- Returns:
- true if this element changed as a result of the call
-
setTypeMembers
Description copied from interface:CtType
Removes all types members with these new members.- Specified by:
setTypeMembers
in interfaceCtType<Object>
-
setFields
Description copied from interface:CtType
Sets all fields in the type. -
setMethods
Description copied from interface:CtType
Sets the methods of this type.- Specified by:
setMethods
in interfaceCtType<Object>
-
addMethod
Description copied from interface:CtType
Adds a method to this type. -
setNestedTypes
Description copied from interface:CtType
Sets all nested types.- Specified by:
setNestedTypes
in interfaceCtType<Object>
-
addNestedType
Description copied from interface:CtType
Add a nested type.- Specified by:
addNestedType
in interfaceCtType<Object>
- Returns:
- true if this element changed as a result of the call
-
addFieldAtTop
Description copied from interface:CtType
Adds a field at the top of the type (before static block). Note that the position of these field will be negative to be written at the top of the type.- Specified by:
addFieldAtTop
in interfaceCtType<Object>
- Returns:
- true if the field is added.
-
setModifiers
Description copied from interface:CtModifiable
Sets the modifiers.- Specified by:
setModifiers
in interfaceCtModifiable
-