java.lang.Object
java.lang.Record
net.luis.utils.io.reader.StringScope
- Record Components:
open
- The opening character of the scopeclose
- The closing character of the scope
A record to define a string scope with an opening and a closing character.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringScope
Constant string scope for angle brackets.private final char
The field for theclose
record component.static final StringScope
Constant string scope for curly brackets.private final char
The field for theopen
record component.static final StringScope
Constant string scope for parentheses.A map that stores all created scopes.
The key is the opening character and the value is the closing character.static final StringScope
Constant string scope for square brackets. -
Constructor Summary
ConstructorsConstructorDescriptionStringScope
(char open, char close) Constructs a new string scope with the given opening and closing character. -
Method Summary
Modifier and TypeMethodDescriptionchar
close()
Returns the value of theclose
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.char
open()
Returns the value of theopen
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
open
private final char openThe field for theopen
record component. -
close
private final char closeThe field for theclose
record component. -
SCOPE_REGISTRY
A map that stores all created scopes.
The key is the opening character and the value is the closing character. -
PARENTHESES
Constant string scope for parentheses. -
CURLY_BRACKETS
Constant string scope for curly brackets. -
SQUARE_BRACKETS
Constant string scope for square brackets. -
ANGLE_BRACKETS
Constant string scope for angle brackets.
-
-
Constructor Details
-
StringScope
public StringScope(char open, char close) Constructs a new string scope with the given opening and closing character.- Parameters:
open
- The opening characterclose
- The closing character- Throws:
IllegalArgumentException
- If the opening and closing character are the same
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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 with '=='. -
open
public char open()Returns the value of theopen
record component.- Returns:
- the value of the
open
record component
-
close
public char close()Returns the value of theclose
record component.- Returns:
- the value of the
close
record component
-