Package com.io7m.jlexing.core
Class LexicalPosition.Builder<F>
java.lang.Object
com.io7m.jlexing.core.LexicalPosition.Builder<F>
- Enclosing class:
- LexicalPosition<F>
Builds instances of type
LexicalPosition.
Initialize attributes and then invoke the build() method to create an
immutable instance.
Builder is not thread-safe and generally should not be stored in a field or collection,
but instead used immediately to create instances.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newLexicalPosition.final LexicalPosition.Builder<F>from(LexicalPositionType<F> instance) Fill a builder with attribute values from the providedLexicalPositionTypeinstance.final LexicalPosition.Builder<F>setColumn(int column) Initializes the value for thecolumnattribute.final LexicalPosition.Builder<F>Initializes the optional valuefileto file.final LexicalPosition.Builder<F>Initializes the optional valuefileto file.final LexicalPosition.Builder<F>setLine(int line) Initializes the value for thelineattribute.
-
Method Details
-
from
Fill a builder with attribute values from the providedLexicalPositionTypeinstance. 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
-
setLine
Initializes the value for thelineattribute.- Parameters:
line- The value for line- Returns:
thisbuilder for use in a chained invocation
-
setColumn
Initializes the value for thecolumnattribute.- Parameters:
column- The value for column- Returns:
thisbuilder for use in a chained invocation
-
setFile
Initializes the optional valuefileto file.- Parameters:
file- The value for file- Returns:
thisbuilder for chained invocation
-
setFile
Initializes the optional valuefileto file.- Parameters:
file- The value for file- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newLexicalPosition.- Returns:
- An immutable instance of LexicalPosition
- Throws:
IllegalStateException- if any required attributes are missing
-