Record Class Replacement
java.lang.Object
java.lang.Record
com.google.errorprone.fixes.Replacement
- Record Components:
range- TheRangeto be replaced.replaceWith- The source text to appear in the output.
-
Constructor Summary
ConstructorsConstructorDescriptionReplacement(com.google.common.collect.Range<Integer> range, String replaceWith) Creates an instance of aReplacementrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic ReplacementCreates aReplacement.intThe end of the replacement range, exclusive.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intlength()The length of the input text to be replaced.com.google.common.collect.Range<Integer> range()Returns the value of therangerecord component.Returns the value of thereplaceWithrecord component.intThe beginning of the replacement range.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Replacement
Creates an instance of aReplacementrecord class.- Parameters:
range- the value for therangerecord componentreplaceWith- the value for thereplaceWithrecord component
-
-
Method Details
-
create
Creates aReplacement. Start and end positions are represented as code unit indices in a Unicode 16-bit string.- Parameters:
startPosition- the beginning of the replacementendPosition- the end of the replacement, exclusivereplaceWith- the replacement text
-
startPosition
public int startPosition()The beginning of the replacement range. -
length
public int length()The length of the input text to be replaced. -
endPosition
public int endPosition()The end of the replacement range, exclusive. -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
range
-
replaceWith
Returns the value of thereplaceWithrecord component.- Returns:
- the value of the
replaceWithrecord component
-