Package io.dialob.rule.parser.node
Class ImmutableSpan
- java.lang.Object
-
- io.dialob.rule.parser.node.ImmutableSpan
-
- All Implemented Interfaces:
Span,Serializable
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableSpan extends Object implements Span
Immutable implementation ofSpan.Use the builder to create immutable instances:
ImmutableSpan.builder(). Use the static factory method to create immutable instances:ImmutableSpan.of().- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableSpan.BuilderBuilds instances of typeImmutableSpan.
-
Field Summary
-
Fields inherited from interface io.dialob.rule.parser.node.Span
UNDEFINED_SPAN
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableSpan.Builderbuilder()Creates a builder forImmutableSpan.static ImmutableSpancopyOf(Span instance)Creates an immutable copy of aSpanvalue.booleanequals(Object another)This instance is equal to all instances ofImmutableSpanthat have equal attribute values.intgetStartIndex()intgetStopIndex()inthashCode()Computes a hash code from attributes:startIndex,stopIndex.static ImmutableSpanof(int startIndex, int stopIndex)Construct a new immutableSpaninstance.StringtoString()Prints the immutable valueSpanwith attribute values.ImmutableSpanwithStartIndex(int value)Copy the current immutable object by setting a value for thestartIndexattribute.ImmutableSpanwithStopIndex(int value)Copy the current immutable object by setting a value for thestopIndexattribute.
-
-
-
Method Detail
-
getStartIndex
public int getStartIndex()
- Specified by:
getStartIndexin interfaceSpan- Returns:
- The value of the
startIndexattribute
-
getStopIndex
public int getStopIndex()
- Specified by:
getStopIndexin interfaceSpan- Returns:
- The value of the
stopIndexattribute
-
withStartIndex
public final ImmutableSpan withStartIndex(int value)
Copy the current immutable object by setting a value for thestartIndexattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for startIndex- Returns:
- A modified copy of the
thisobject
-
withStopIndex
public final ImmutableSpan withStopIndex(int value)
Copy the current immutable object by setting a value for thestopIndexattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for stopIndex- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(@Nullable Object another)This instance is equal to all instances ofImmutableSpanthat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:startIndex,stopIndex.
-
toString
public String toString()
Prints the immutable valueSpanwith attribute values.
-
of
public static ImmutableSpan of(int startIndex, int stopIndex)
Construct a new immutableSpaninstance.- Parameters:
startIndex- The value for thestartIndexattributestopIndex- The value for thestopIndexattribute- Returns:
- An immutable Span instance
-
copyOf
public static ImmutableSpan copyOf(Span instance)
Creates an immutable copy of aSpanvalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance- The instance to copy- Returns:
- A copied immutable Span instance
-
builder
public static ImmutableSpan.Builder builder()
Creates a builder forImmutableSpan.ImmutableSpan.builder() .startIndex(int) // requiredstartIndex.stopIndex(int) // requiredstopIndex.build();- Returns:
- A new ImmutableSpan builder
-
-