Klasse Utils
-
Verschachtelte Klassen - Übersicht
Modifizierer und TypKlasseBeschreibungstatic enum
static enum
An element can have flags that place it into some subcategories, like being a preview or a deprecated element.static final record
static class
Utils.Pair<K,
L> A container holding a pair of values (tuple).static interface
static final class
-
Feldübersicht
Modifizierer und TypFeldBeschreibungfinal Comparators
final BaseConfiguration
final DocTrees
final Elements
final Types
-
Konstruktorübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungReturns the TypeMirror corresponding to the type of the field declaration seen as a member of a given declared type.Returns the ExecutableType corresponding to the type of the method declaration seen as a member of a given declared type.Return this type as a TypeElement if it represents a class interface or annotation.void
checkJavaScriptInOption
(String name, String value) int
compareStrings
(String s1, String s2) A general purpose case insensitive String comparator, which compares two Strings using a Collator strength of “TERTIARY”.boolean
definesSerializableFields
(TypeElement aclass) elementFlags
(Element el) Return all flags for the given Element.filterOutPrivateClasses
(Iterable<TypeElement> classlist, boolean javafx) In case of JavaFX mode on, filters out classes that are private, package private, these are not documented in JavaFX mode, also remove those classes that have @hidden or @treatAsPrivate comment tag.TODO: FIXME: port to javax.lang.model Find a class within the context of this class.findClassInPackageElement
(PackageElement pkg, String className) Lookup for a class within this package.flatSignature
(ExecutableElement e, TypeElement site) Get the flat signature of an executable element with simple (unqualified) parameter types in the context of type element site.Returns a sorted set containing the documented classes and interfaces in a package.Returns all the classes in a package.Returns all the implemented superinterfaces of a given type, in the case of classes, include all the superinterfaces of the supertype.Returns the fields and methods declared in an annotation interface.getBlockTags
(DocCommentTree dcTree) getBlockTags
(Element element) getBlockTags
(Element element, DocTree.Kind kind) getBlockTags
(Element element, DocTree.Kind kind, Class<T> tClass) getBlockTags
(Element element, Predicate<DocTree> filter) getBlockTags
(Element element, Predicate<DocTree> filter, Class<T> tClass) getBlockTags
(Element element, Taglet taglet) List
<? extends TypeMirror> Returns the documented classes in an element, such as a package element or type element.getCommentHelper
(Element element) Returns the documented constructors in a type element.getDeclaredType
(Collection<TypeMirror> values, TypeElement enclosing, TypeMirror target) Finds the declaration of the enclosing’s type parameter.getDeclaredType
(TypeElement enclosing, TypeMirror target) Returns the value of the Deprecated.since element if it is set on the given Element.List
<? extends DeprecatedTree> getDeprecatedTrees
(Element element) Return the type’s dimension information, as a string.getDocCommentTree
(Element element) getDocCommentTree0
(Element element) Retrieves the doc comments for a given element.Returns the recursively enclosed documented type elements in a packageReturns the documented enum constants in a type element.getFields
(TypeElement te) Returns the documented fields in a type element.Returns the fields in a type element.getFirstSentenceTrees
(Element element) Given a class, return the closest visible superclass.Given a class, return the closest visible superclass.getFullBody
(Element element) A generic utility which returns the fully qualified names of an entity, if the entity is not qualifiable then its enclosing entity, it is up to the caller to add the elements name as required.getFullyQualifiedName
(Element e, boolean outer) getHTMLTitle
(Element element) long
Returns the documented methods in a type element.getModuleName
(ModuleElement mdle) Get the module name for a given module element.Get the package name for a given package element.getParamTrees
(Element element) getPreamble
(Element element) Returns the value of the internal PreviewFeature.feature element.getPropertyLabel
(String name) getPropertyName
(String name) List
<? extends ProvidesTree> getProvidesTrees
(Element element) Get the qualified type name of a TypeMirror compatible with the Element’s getQualified name, returns the qualified name of the Reference type otherwise the primitive name.List
<? extends ReturnTree> getReturnTrees
(Element element) getReturnType
(TypeElement site, ExecutableElement ee) Returns the TypeMirror of the ExecutableElement if it is a method, or null if it is a constructor.getSeeTrees
(Element element) List
<? extends SerialDataTree> getSerialDataTrees
(ExecutableElement member) List
<? extends SerialFieldTree> List
<? extends SerialTree> getSerialTrees
(Element element) Returns the name of the element after the last dot of the package name.getSpecTrees
(Element element) getThrowsTrees
(Element element) Gets a TreePath for an Element.getTypeElementKindName
(TypeElement te, boolean lowerCaseOnly) Returns the name of the kind of a type element (Class, Interface, etc.).getTypeElementsAsSortedSet
(Iterable<TypeElement> typeElements) getTypeName
(TypeMirror t, boolean fullyQualified) getTypeParamTrees
(Element element) getTypeSignature
(TypeMirror t, boolean qualifiedName, boolean noTypeParameters) getUsesTrees
(Element element) boolean
hasBlockTag
(Element element, DocTree.Kind kind) boolean
hasBlockTag
(Element element, DocTree.Kind kind, String tagName) boolean
hasDocCommentTree
(Element element) Checks whether an element has an associated doc comment.boolean
Returns true if the element is included or selected, contains @hidden tag, or if javafx flag is present and element contains @treatAsPrivate tag.boolean
ignoreBounds
(TypeMirror bound) boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
According to The Java Language Specification, all the outer classes and static inner classes are core classes.boolean
boolean
boolean
Return true if the given Element is deprecated.boolean
Returns true if the given Element is deprecated for removal.boolean
isDocumentedAnnotation
(TypeElement annotation) Given an annotation, return true if it should be documented and false otherwise.boolean
boolean
boolean
boolean
boolean
boolean
boolean
isFunctionalInterface
(AnnotationMirror amirror) boolean
isGenericType
(TypeMirror type) Returns true if type or any of its enclosing types has non-empty type arguments.boolean
boolean
boolean
isLinkable
(TypeElement typeElem) Returns true if this class is linkable and false if we can’t link to it.boolean
isLinkable
(TypeElement typeElem, Element elem) Returns true if an element is linkable in the context of a given type element.boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
isPreviewAPI
(Element el) Checks whether the given Element should be marked as a preview API.boolean
boolean
isProperty
(String name) boolean
boolean
boolean
boolean
Checks whether the given Element should be marked as a reflective preview API.boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
isUndocumentedEnclosure
(TypeElement enclosingTypeElement) boolean
boolean
isVoid
(TypeMirror t) makeSignature
(ExecutableElement e, TypeElement site, boolean full) makeSignature
(ExecutableElement e, TypeElement site, boolean full, boolean ignoreTypeParameters) overriddenMethod
(ExecutableElement method) Return the set of preview language features used to declare the given element.A convenience method to get property name from the name of the getter or setter method.void
removeCommentHelper
(Element element) replaceTabs
(String text) Replace all tabs in a string with the appropriate number of spaces.serializableFields
(TypeElement aclass) serializationMethods
(TypeElement aclass) boolean
signature
(ExecutableElement e, TypeElement site) Get the signature of an executable element with qualified parameter types in the context of type element site.static String
Returns a locale independent lower cased String.
-
Felddetails
-
configuration
-
docTrees
-
elementUtils
-
typeUtils
-
comparators
-
-
Konstruktordetails
-
Utils
-
-
Methodendetails
-
getSymbol
-
getObjectType
-
getThrowableType
-
getSerializableType
-
getExternalizableType
-
getDeprecatedType
-
getFunctionalInterface
-
isCoreClass
According to The Java Language Specification, all the outer classes and static inner classes are core classes. -
getLocationForPackage
-
getLocationForModule
-
isAnnotated
-
isAnnotationInterface
-
isClass
-
isInterface
-
isConstructor
-
isEnum
-
isField
-
isPlainInterface
-
isMethod
-
isModule
-
isPackage
-
isAbstract
-
isDefault
-
isFinal
-
isPackagePrivate
-
isPrivate
-
isProtected
-
isPublic
-
isProperty
-
getPropertyName
-
getPropertyLabel
-
isOverviewElement
-
isStatic
-
isSerializable
-
isExternalizable
-
isRecord
-
isCanonicalRecordConstructor
-
serializableFields
-
serializationMethods
-
definesSerializableFields
-
isFunctionalInterface
-
isUndocumentedEnclosure
-
isNonThrowableClass
-
isThrowable
-
isExecutableElement
-
isVariableElement
-
isTypeElement
-
signature
Get the signature of an executable element with qualified parameter types in the context of type element site.For instance, for a method mymethod(String x, int y), it will return (java.lang.String,int).
- Parameter:
e
- the executable elementsite
- the contextual site- Gibt zurück:
- String signature with qualified parameter types
-
flatSignature
Get the flat signature of an executable element with simple (unqualified) parameter types in the context of type element site.For instance, for a method mymethod(String x, int y), it will return (String, int).
- Parameter:
e
- the executable elementsite
- the contextual site- Gibt zurück:
- signature with simple (unqualified) parameter types
-
makeSignature
-
makeSignature
public String makeSignature(ExecutableElement e, TypeElement site, boolean full, boolean ignoreTypeParameters) -
getTypeSignature
-
isArrayType
-
isDeclaredType
-
isTypeParameterElement
-
isTypeVariable
-
isVoid
-
ignoreBounds
-
getBounds
-
getReturnType
Returns the TypeMirror of the ExecutableElement if it is a method, or null if it is a constructor.- Parameter:
site
- the contextual typeee
- the ExecutableElement- Gibt zurück:
- the return type
-
asInstantiatedMethodType
Returns the ExecutableType corresponding to the type of the method declaration seen as a member of a given declared type.This might cause type-variable substitution to kick in.
- Parameter:
site
- the contextual type.ee
- the method declaration.- Gibt zurück:
- the instantiated method type.
-
asInstantiatedFieldType
Returns the TypeMirror corresponding to the type of the field declaration seen as a member of a given declared type.This might cause type-variable substitution to kick in.
- Parameter:
site
- the contextual type.ve
- the field declaration.- Gibt zurück:
- the instantiated field type.
-
overriddenMethod
-
getTypeElementsAsSortedSet
-
getSerialDataTrees
-
getFileObject
-
getDeclaredType
-
getDeclaredType
public TypeMirror getDeclaredType(Collection<TypeMirror> values, TypeElement enclosing, TypeMirror target) Finds the declaration of the enclosing’s type parameter.- Parameter:
values
-enclosing
- a TypeElement whose type arguments we desiretarget
- the TypeMirror of the type as described by the enclosing- Gibt zurück:
-
getAllInterfaces
Returns all the implemented superinterfaces of a given type, in the case of classes, include all the superinterfaces of the supertype.The superinterfaces are collected before the superinterfaces of the supertype.
- Parameter:
te
- the type element to get the superinterfaces for.- Gibt zurück:
- the list of superinterfaces.
-
findClassInPackageElement
Lookup for a class within this package.- Gibt zurück:
- TypeElement of found class, or null if not found.
-
isGenericType
Returns true if type or any of its enclosing types has non-empty type arguments.- Parameter:
type
- the type- Gibt zurück:
- true if type arguments were found
-
findClass
TODO: FIXME: port to javax.lang.model Find a class within the context of this class.Search order: qualified name, in this class (inner), in this package, in the class imports, in the package imports. Return the TypeElement if found, null if not found.
-
isDocumentedAnnotation
Given an annotation, return true if it should be documented and false otherwise.- Parameter:
annotation
- the annotation to check.- Gibt zurück:
- true return true if it should be documented and false otherwise.
-
isLinkable
Returns true if this class is linkable and false if we can’t link to it.NOTE: You can only link to external classes if they are public or protected.
- Gibt zurück:
- true if this class is linkable and false if we can’t link to the desired class.
-
isLinkable
Returns true if an element is linkable in the context of a given type element.If the element is a type element, it delegates to
isLinkable(TypeElement)
. Otherwise, the element is linkable if any of the following are true:- it is "included" (see
jdk.javadoc.doclet
) - it is inherited from an undocumented supertype
- it is a public or protected member of an external API
- Parameter:
typeElem
- the type elementelem
- the element- Gibt zurück:
- whether or not the element is linkable
- it is "included" (see
-
asTypeElement
Return this type as a TypeElement if it represents a class interface or annotation.Array dimensions are ignored. If this type ParameterizedType or WildcardType, return the TypeElement of the type’s erasure. If this is an annotation, return this as a TypeElement. If this is a primitive type, return null.
- Gibt zurück:
- the TypeElement of this type, or null if it is a primitive type.
-
getComponentType
-
getDimension
Return the type’s dimension information, as a string.For example, a two dimensional array of String returns "[][]".
- Gibt zurück:
- the type’s dimension information as a string.
-
getFirstVisibleSuperClassAsTypeElement
-
getFirstVisibleSuperClass
Given a class, return the closest visible superclass.- Parameter:
type
- the TypeMirror to be interrogated- Gibt zurück:
- the closest visible superclass. Return null if it cannot be found.
-
getFirstVisibleSuperClass
Given a class, return the closest visible superclass.- Parameter:
te
- the TypeElement to be interrogated- Gibt zurück:
- the closest visible superclass. Return null if it cannot be found.
-
getTypeElementKindName
Returns the name of the kind of a type element (Class, Interface, etc.).- Parameter:
te
- the type elementlowerCaseOnly
- true if you want the name returned in lower case; if false, the first letter of the name is capitalized- Gibt zurück:
- the name
-
getTypeName
-
replaceTabs
Replace all tabs in a string with the appropriate number of spaces.The string may be a multi-line string.
- Parameter:
text
- the text for which the tabs should be expanded- Gibt zurück:
- the text with all tabs expanded
-
toLowerCase
Returns a locale independent lower cased String.That is, it always uses US locale, this is a clone of the one in StringUtils.
- Parameter:
s
- to convert- Gibt zurück:
- converted String
-
isDeprecated
Return true if the given Element is deprecated.- Parameter:
e
- the Element to check.- Gibt zurück:
- true if the given Element is deprecated.
-
isDeprecatedForRemoval
Returns true if the given Element is deprecated for removal.- Parameter:
e
- the Element to check.- Gibt zurück:
- true if the given Element is deprecated for removal.
-
getDeprecatedSince
Returns the value of the Deprecated.since element if it is set on the given Element.- Parameter:
e
- the Element to check.- Gibt zurück:
- the Deprecated.since value for e, or null.
-
getPreviewFeature
Returns the value of the internal PreviewFeature.feature element.- Parameter:
e
- the Element to check- Gibt zurück:
- the PreviewFeature.feature for e, or null
-
propertyName
A convenience method to get property name from the name of the getter or setter method.- Parameter:
e
- the input method.- Gibt zurück:
- the name of the property of the given setter of getter.
-
hasHiddenTag
Returns true if the element is included or selected, contains @hidden tag, or if javafx flag is present and element contains @treatAsPrivate tag.- Parameter:
e
- the queried element- Gibt zurück:
- true if it exists, false otherwise
-
isSimpleOverride
-
filterOutPrivateClasses
public SortedSet<TypeElement> filterOutPrivateClasses(Iterable<TypeElement> classlist, boolean javafx) In case of JavaFX mode on, filters out classes that are private, package private, these are not documented in JavaFX mode, also remove those classes that have @hidden or @treatAsPrivate comment tag.- Parameter:
classlist
- a collection of TypeElementsjavafx
- set to true if in JavaFX mode.- Gibt zurück:
- list of filtered classes.
-
compareStrings
A general purpose case insensitive String comparator, which compares two Strings using a Collator strength of “TERTIARY”.- Parameter:
s1
- first String to compare.s2
- second String to compare.- Gibt zurück:
- a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
-
getHTMLTitle
-
getQualifiedTypeName
Get the qualified type name of a TypeMirror compatible with the Element’s getQualified name, returns the qualified name of the Reference type otherwise the primitive name.- Parameter:
t
- the type whose name is to be obtained.- Gibt zurück:
- the fully qualified name of Reference type or the primitive name
-
getFullyQualifiedName
A generic utility which returns the fully qualified names of an entity, if the entity is not qualifiable then its enclosing entity, it is up to the caller to add the elements name as required.- Parameter:
e
- the element to get FQN for.- Gibt zurück:
- the name
-
getFullyQualifiedName
-
getEnclosedTypeElements
Returns the recursively enclosed documented type elements in a package- Parameter:
pkg
- the package- Gibt zurück:
- the elements
-
getAnnotationMembers
Returns the fields and methods declared in an annotation interface.- Parameter:
te
- the annotation interface- Gibt zurück:
- the fields and methods
-
getFields
Returns the documented fields in a type element.- Parameter:
te
- the element- Gibt zurück:
- the fields
-
getFieldsUnfiltered
Returns the fields in a type element.- Parameter:
te
- the element- Gibt zurück:
- the fields
-
getClasses
Returns the documented classes in an element, such as a package element or type element.- Parameter:
e
- the element- Gibt zurück:
- the classes
-
getConstructors
Returns the documented constructors in a type element.- Parameter:
te
- the type element- Gibt zurück:
- the constructors
-
getMethods
Returns the documented methods in a type element.- Parameter:
te
- the type element- Gibt zurück:
- the methods
-
getModulePackageMap
-
getDependentModules
-
getModifiers
-
getLineNumber
-
getEnumConstants
Returns the documented enum constants in a type element.- Parameter:
te
- the element- Gibt zurück:
- the interfaces
-
getAllClassesUnfiltered
Returns all the classes in a package.- Parameter:
pkg
- the package- Gibt zurück:
- the interfaces
-
getAllClasses
Returns a sorted set containing the documented classes and interfaces in a package.- Parameter:
pkg
- the element- Gibt zurück:
- the classes and interfaces
-
shouldDocument
-
getSimpleName
Returns the name of the element after the last dot of the package name.This emulates the behavior of the old doclet.
- Parameter:
e
- an element whose name is required- Gibt zurück:
- the name
-
getEnclosingTypeElement
-
constantValueExpression
-
isEnclosingPackageIncluded
-
isIncluded
-
isSpecified
-
getPackageName
Get the package name for a given package element.An unnamed package is returned as <Unnamed> Use
HtmlDocletWriter.getLocalizedPackageName(PackageElement)
to get a localized string for the unnamed package instead.- Parameter:
pkg
-- Gibt zurück:
-
getModuleName
Get the module name for a given module element.An unnamed module is returned as <Unnamed>
- Parameter:
mdle
- a ModuleElement- Gibt zurück:
-
getCommentHelper
-
removeCommentHelper
-
getBlockTags
-
getBlockTags
-
getBlockTags
-
getBlockTags
-
getBlockTags
-
getBlockTags
public <T extends DocTree> List<? extends T> getBlockTags(Element element, DocTree.Kind kind, Class<T> tClass) -
getBlockTags
-
hasBlockTag
-
hasBlockTag
-
getTreePath
Gets a TreePath for an Element.Note this method is called very frequently, care must be taken to ensure this method is lithe and efficient.
- Parameter:
e
- an Element- Gibt zurück:
- TreePath
-
hasDocCommentTree
Checks whether an element has an associated doc comment.- Parameter:
element
- the element- Gibt zurück:
- true if the element has a comment, and false otherwise
-
getDocCommentTree0
Retrieves the doc comments for a given element.- Parameter:
element
- the element- Gibt zurück:
- DocCommentTree for the Element
-
checkJavaScriptInOption
-
getDocCommentTree
-
getPreamble
-
getFullBody
-
getBody
-
getDeprecatedTrees
-
getProvidesTrees
-
getSeeTrees
-
getSerialTrees
-
getSerialFieldTrees
-
getSpecTrees
-
getThrowsTrees
-
getTypeParamTrees
-
getParamTrees
-
getReturnTrees
-
getUsesTrees
-
getFirstSentenceTrees
-
containingModule
-
containingPackage
-
previewLanguageFeaturesUsed
Return the set of preview language features used to declare the given element.- Parameter:
e
- the Element to check.- Gibt zurück:
- the set of preview language features used to declare the given element
-
declaredUsingPreviewAPIs
-
isPreviewAPI
Checks whether the given Element should be marked as a preview API.Note that if a type is marked as a preview, its members are not.
- Parameter:
el
- the element to check- Gibt zurück:
- true if and only if the given element should be marked as a preview API
-
isReflectivePreviewAPI
Checks whether the given Element should be marked as a reflective preview API.Note that if a type is marked as a preview, its members are not.
- Parameter:
el
- the element to check- Gibt zurück:
- true if and only if the given element should be marked as a reflective preview API
-
elementFlags
Return all flags for the given Element.- Parameter:
el
- the element to test- Gibt zurück:
- the set of all the element’s flags.
-
setPreviewFlagProvider
-
docFinder
-