Top Description Inners Fields Constructors Methods
com.github.javaparser.ast

public Class Modifier

extends Node
Class Inheritance
Imports
com.github.javaparser.TokenRange, com.github.javaparser.ast.observer.ObservableProperty, com.github.javaparser.ast.visitor.CloneVisitor, .GenericVisitor, .VoidVisitor, com.github.javaparser.metamodel.JavaParserMetaModel, .ModifierMetaModel, java.util.Arrays, com.github.javaparser.ast.Node, .Generated

A modifier, like private, public, or volatile.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
Modifier.Keyword

The Java modifier keywords.

Field Summary

Modifier and TypeField and Description
private Modifier.Keyword
Inherited from com.github.javaparser.ast.Node:
ABSOLUTE_BEGIN_LINEABSOLUTE_END_LINENODE_BY_BEGIN_POSITIONprettyPrinterNoCommentsConfigurationSYMBOL_RESOLVER_KEY

Constructor Summary

AccessConstructor and Description
public
public
public
Modifier(TokenRange tokenRange, Modifier.Keyword keyword)

This constructor is used by the parser and is considered private.

Method Summary

Modifier and TypeMethod and Description
public static Modifier
public <R, A> R
accept(final GenericVisitor<R, A>
the visitor implementation
v
,
final A
the argument passed to the visitor (of type A)
arg
)

Implements com.github.javaparser.ast.visitor.Visitable.accept.

Accept method for visitor support.
public <A> void
accept(final VoidVisitor<A>
the visitor implementation
v
,
final A
any value relevant for the visitor (of type A)
arg
)

Implements com.github.javaparser.ast.visitor.Visitable.accept.

Accept method for visitor support.
public Modifier
clone()

Overrides com.github.javaparser.ast.Node.clone.

Creates and returns a copy of this object.
public static NodeList<Modifier>
createModifierList(Modifier.Keyword... modifiers)

Utility method that instantiaties "Modifier"s for the keywords, and puts them in a NodeList.

public static Modifier
public Modifier.Keyword
public ModifierMetaModel
public static Modifier
public static Modifier
public static Modifier
public static Modifier
public boolean
public boolean
replace(Node node, Node replacementNode)

Overrides com.github.javaparser.ast.Node.replace.

public Modifier
setKeyword(final Modifier.Keyword keyword)

public static Modifier
public static Modifier
public static Modifier
public static Modifier
public static Modifier
public static Modifier
Inherited from com.github.javaparser.ast.Node:
addOrphanCommentcontainsDatacustomInitializationequalsfindAllfindAllfindCompilationUnitfindFirstfindFirstfindFirstfindRootNodegetAllContainedCommentsgetChildNodesgetChildNodesByTypegetCommentgetDatagetDataKeysgetNodesByTypegetOrphanCommentsgetParentNodegetParentNodeForChildrengetParsedgetRangegetSymbolResolvergetTokenRangegetToStringPrettyPrinterConfigurationhashCodeisAncestorOfisRegisterednotifyPropertyChangeregisterregisterregisterForSubtreeremoveremoveCommentremoveDataremoveForcedremoveOrphanCommentreplacesetAsParentNodeOfsetAsParentNodeOfsetBlockCommentsetCommentsetDatasetLineCommentsetParentNodesetParsedsetRangesetTokenRangesetToStringPrettyPrinterConfigurationstreamstreamtoStringtoStringtryAddImportToParentCompilationUnitunregisterwalkwalkwalk

Field Detail

keywordback to summary
private Modifier.Keyword keyword

Constructor Detail

Modifierback to summary
public Modifier()
Modifierback to summary
public Modifier(Modifier.Keyword keyword)
Annotations
@AllFieldsConstructor
Modifierback to summary
public Modifier(TokenRange tokenRange, Modifier.Keyword keyword)

This constructor is used by the parser and is considered private.

Annotations
@Generated:com.github.javaparser.generator.core.node.MainConstructorGenerator

Method Detail

abstractModifierback to summary
public static Modifier abstractModifier()
acceptback to summary
public <R, A> R accept(final GenericVisitor<R, A> v, final A arg)

Implements com.github.javaparser.ast.visitor.Visitable.accept.

Doc from com.github.javaparser.ast.visitor.Visitable.accept.

Accept method for visitor support.

Parameters
<R>
the type of the return value of the visitor
<A>
the type the user argument passed to the visitor
v:GenericVisitor<R, A>

the visitor implementation

arg:A

the argument passed to the visitor (of type A)

Returns:R

the result of the visit (of type R)

Annotations
@Override
@Generated:com.github.javaparser.generator.core.node.AcceptGenerator
acceptback to summary
public <A> void accept(final VoidVisitor<A> v, final A arg)

Implements com.github.javaparser.ast.visitor.Visitable.accept.

Doc from com.github.javaparser.ast.visitor.Visitable.accept.

Accept method for visitor support.

Parameters
<A>
the type the argument passed for the visitor
v:VoidVisitor<A>

the visitor implementation

arg:A

any value relevant for the visitor (of type A)

Annotations
@Override
@Generated:com.github.javaparser.generator.core.node.AcceptGenerator
cloneback to summary
public Modifier clone()

Overrides com.github.javaparser.ast.Node.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:Modifier

a clone of this instance.

Annotations
@Override
@Generated:com.github.javaparser.generator.core.node.CloneGenerator
createModifierListback to summary
public static NodeList<Modifier> createModifierList(Modifier.Keyword... modifiers)

Utility method that instantiaties "Modifier"s for the keywords, and puts them in a NodeList.

finalModifierback to summary
public static Modifier finalModifier()
getKeywordback to summary
public Modifier.Keyword getKeyword()
Annotations
@Generated:com.github.javaparser.generator.core.node.PropertyGenerator
getMetaModelback to summary
public ModifierMetaModel getMetaModel()

Overrides com.github.javaparser.ast.Node.getMetaModel.

Returns:ModifierMetaModel

Doc from com.github.javaparser.ast.Node.getMetaModel.

get JavaParser specific node introspection information.

Annotations
@Override
@Generated:com.github.javaparser.generator.core.node.GetMetaModelGenerator
nativeModifierback to summary
public static Modifier nativeModifier()
privateModifierback to summary
public static Modifier privateModifier()
protectedModifierback to summary
public static Modifier protectedModifier()
publicModifierback to summary
public static Modifier publicModifier()
removeback to summary
public boolean remove(Node node)

Overrides com.github.javaparser.ast.Node.remove.

Annotations
@Override
@Generated:com.github.javaparser.generator.core.node.RemoveMethodGenerator
replaceback to summary
public boolean replace(Node node, Node replacementNode)

Overrides com.github.javaparser.ast.Node.replace.

Annotations
@Override
@Generated:com.github.javaparser.generator.core.node.ReplaceMethodGenerator
setKeywordback to summary
public Modifier setKeyword(final Modifier.Keyword keyword)
Annotations
@Generated:com.github.javaparser.generator.core.node.PropertyGenerator
staticModifierback to summary
public static Modifier staticModifier()
strictfpModifierback to summary
public static Modifier strictfpModifier()
synchronizedModifierback to summary
public static Modifier synchronizedModifier()
transientModifierback to summary
public static Modifier transientModifier()
transitiveModifierback to summary
public static Modifier transitiveModifier()
volatileModifierback to summary
public static Modifier volatileModifier()
com.github.javaparser.ast back to summary

public final Enum Modifier.Keyword

extends Enum<Modifier.Keyword>
Class Inheritance

The Java modifier keywords.

Field Summary

Modifier and TypeField and Description
public static final Modifier.Keyword
private final String
public static final Modifier.Keyword
public static final Modifier.Keyword
public static final Modifier.Keyword
public static final Modifier.Keyword
public static final Modifier.Keyword
public static final Modifier.Keyword
public static final Modifier.Keyword
public static final Modifier.Keyword
public static final Modifier.Keyword
public static final Modifier.Keyword
public static final Modifier.Keyword
public static final Modifier.Keyword

Constructor Summary

AccessConstructor and Description
private
Keyword(String codeRepresentation)

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the Java keyword represented by this enum constant.
asString
()

public static Modifier.Keyword
public static Modifier.Keyword[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ABSTRACTback to summary
public static final Modifier.Keyword ABSTRACT
codeRepresentationback to summary
private final String codeRepresentation
DEFAULTback to summary
public static final Modifier.Keyword DEFAULT
FINALback to summary
public static final Modifier.Keyword FINAL
NATIVEback to summary
public static final Modifier.Keyword NATIVE
PRIVATEback to summary
public static final Modifier.Keyword PRIVATE
PROTECTEDback to summary
public static final Modifier.Keyword PROTECTED
PUBLICback to summary
public static final Modifier.Keyword PUBLIC
STATICback to summary
public static final Modifier.Keyword STATIC
STRICTFPback to summary
public static final Modifier.Keyword STRICTFP
SYNCHRONIZEDback to summary
public static final Modifier.Keyword SYNCHRONIZED
TRANSIENTback to summary
public static final Modifier.Keyword TRANSIENT
TRANSITIVEback to summary
public static final Modifier.Keyword TRANSITIVE
VOLATILEback to summary
public static final Modifier.Keyword VOLATILE

Constructor Detail

Keywordback to summary
private Keyword(String codeRepresentation)

Method Detail

asStringback to summary
public String asString()
Returns:String

the Java keyword represented by this enum constant.

valueOfback to summary
public static Modifier.Keyword valueOf(String name)
valuesback to summary
public static Modifier.Keyword[] values()