Package io.dialob.rule.parser.node
Class ImmutableSpan.Builder
- java.lang.Object
-
- io.dialob.rule.parser.node.ImmutableSpan.Builder
-
- Enclosing class:
- ImmutableSpan
@NotThreadSafe public static final class ImmutableSpan.Builder extends Object
Builds instances of typeImmutableSpan. Initialize attributes and then invoke thebuild()method to create an immutable instance.Builderis not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableSpanbuild()Builds a newImmutableSpan.ImmutableSpan.Builderfrom(Span instance)Fill a builder with attribute values from the providedSpaninstance.ImmutableSpan.BuilderstartIndex(int startIndex)Initializes the value for thestartIndexattribute.ImmutableSpan.BuilderstopIndex(int stopIndex)Initializes the value for thestopIndexattribute.
-
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final ImmutableSpan.Builder from(Span instance)
Fill a builder with attribute values from the providedSpaninstance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
startIndex
@CanIgnoreReturnValue public final ImmutableSpan.Builder startIndex(int startIndex)
Initializes the value for thestartIndexattribute.- Parameters:
startIndex- The value for startIndex- Returns:
thisbuilder for use in a chained invocation
-
stopIndex
@CanIgnoreReturnValue public final ImmutableSpan.Builder stopIndex(int stopIndex)
Initializes the value for thestopIndexattribute.- Parameters:
stopIndex- The value for stopIndex- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutableSpan build()
Builds a newImmutableSpan.- Returns:
- An immutable instance of Span
- Throws:
IllegalStateException- if any required attributes are missing
-
-