Class ConstructorInsertion
java.lang.Object
org.checkerframework.afu.annotator.find.Insertion
org.checkerframework.afu.annotator.find.TypedInsertion
org.checkerframework.afu.annotator.find.ConstructorInsertion
-
Nested Class Summary
Nested classes/interfaces inherited from class org.checkerframework.afu.annotator.find.Insertion
Insertion.Kind
-
Field Summary
Fields inherited from class org.checkerframework.afu.annotator.find.TypedInsertion
annotationsOnly, innerTypeInsertions, type
Fields inherited from class org.checkerframework.afu.annotator.find.Insertion
alwaysQualify, packageNames
-
Constructor Summary
ConstructorsConstructorDescriptionConstructorInsertion
(Type type, Criteria criteria, List<Insertion> innerTypeInsertions) Construct a ConstructorInsertion. -
Method Summary
Modifier and TypeMethodDescriptionvoid
protected boolean
addLeadingSpace
(boolean gotSeparateLine, int pos, char precedingChar) Indicates if a preceding space should be added to this insertion.void
protected boolean
addTrailingSpace
(boolean gotSeparateLine) Indicates if a trailing space should be added to this insertion.getKind()
Gets the kind of this insertion.protected ReceiverInsertion
protected String
getText
(boolean abbreviate) Gets the insertion text.void
setInserted
(boolean inserted) Sets whether this insertion has already been inserted into source code.toString()
Methods inherited from class org.checkerframework.afu.annotator.find.TypedInsertion
getBaseType, getBaseType, getInnerTypeInsertions, getType, setAnnotationsOnly, setType
Methods inherited from class org.checkerframework.afu.annotator.find.Insertion
collectionToString, decorateType, decorateType, getAlwaysQualify, getCriteria, getPackageNames, getText, getText, isInserted, isSeparateLine, removePackage, setAlwaysQualify, toStringWithoutClass, typeToString
-
Constructor Details
-
ConstructorInsertion
Construct a ConstructorInsertion.To insert the annotation and the constructor (for example,
@Anno Type this
) the name should be set to the type to insert. This can either be done before calling this constructor, or by modifying the return value ofTypedInsertion.getType()
.- Parameters:
type
- the type to use when inserting the constructorcriteria
- where to insert the textinnerTypeInsertions
- the inner types to go on this constructor
-
-
Method Details
-
getText
Description copied from class:Insertion
Gets the insertion text.- Specified by:
getText
in classInsertion
- Parameters:
abbreviate
- if true, the package name will be removed from the annotations. The package name can be retrieved again by calling theInsertion.getPackageNames()
method.- Returns:
- the text to insert
-
getReceiverInsertion
-
addReceiverInsertion
-
addDeclarationInsertion
-
addLeadingSpace
protected boolean addLeadingSpace(boolean gotSeparateLine, int pos, char precedingChar) Description copied from class:Insertion
Indicates if a preceding space should be added to this insertion. Subclasses may override this method for custom leading space rules.- Overrides:
addLeadingSpace
in classInsertion
- Parameters:
gotSeparateLine
-true
if this insertion is actually added on a separate linepos
- the source position where this insertion will be insertedprecedingChar
- the character directly preceding where this insertion will be inserted. This value will be ignored ifpos
is 0.- Returns:
true
if a leading space should be added,false
otherwise
-
addTrailingSpace
protected boolean addTrailingSpace(boolean gotSeparateLine) Description copied from class:Insertion
Indicates if a trailing space should be added to this insertion. Subclasses may override this method for custom trailing space rules.- Overrides:
addTrailingSpace
in classInsertion
- Parameters:
gotSeparateLine
-true
if this insertion is actually added on a separate line- Returns:
- true if a trailing space should be added,
false
otherwise
-
getKind
Description copied from class:Insertion
Gets the kind of this insertion. -
setInserted
public void setInserted(boolean inserted) Sets whether this insertion has already been inserted into source code.- Overrides:
setInserted
in classInsertion
- Parameters:
inserted
-true
if this insertion has already been inserted,false
otherwise
-
toString
-