Package hydra.ast
Class BlockStyle
- java.lang.Object
-
- hydra.ast.BlockStyle
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<BlockStyle>
public class BlockStyle extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<BlockStyle>
Formatting option for code blocks- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBlockStyle.BuilderA fluent builder forBlockStyle.
-
Field Summary
Fields Modifier and Type Field Description Optional<java.lang.String>indentAn optional indentation stringstatic NameINDENTName of thehydra.ast.BlockStyle.indentfield.static NameNEWLINE_AFTER_CONTENTName of thehydra.ast.BlockStyle.newlineAfterContentfield.static NameNEWLINE_BEFORE_CONTENTName of thehydra.ast.BlockStyle.newlineBeforeContentfield.java.lang.BooleannewlineAfterContentWhether to place a newline after the contentjava.lang.BooleannewlineBeforeContentWhether to place a newline before the contentstatic NameTYPE_Name of thehydra.ast.BlockStyletype.
-
Constructor Summary
Constructors Constructor Description BlockStyle(Optional<java.lang.String> indent, java.lang.Boolean newlineBeforeContent, java.lang.Boolean newlineAfterContent)Constructs an immutableBlockStyle.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BlockStyle.Builderbuilder()Creates a new fluent builder forBlockStyle.intcompareTo(BlockStyle other)booleanequals(java.lang.Object other)inthashCode()java.lang.StringtoString()BlockStylewithIndent(Optional<java.lang.String> indent)Returns a copy of thisBlockStylewithindentreplaced.BlockStylewithNewlineAfterContent(java.lang.Boolean newlineAfterContent)Returns a copy of thisBlockStylewithnewlineAfterContentreplaced.BlockStylewithNewlineBeforeContent(java.lang.Boolean newlineBeforeContent)Returns a copy of thisBlockStylewithnewlineBeforeContentreplaced.
-
-
-
Field Detail
-
TYPE_
public static final Name TYPE_
Name of thehydra.ast.BlockStyletype.
-
INDENT
public static final Name INDENT
Name of thehydra.ast.BlockStyle.indentfield.
-
NEWLINE_BEFORE_CONTENT
public static final Name NEWLINE_BEFORE_CONTENT
Name of thehydra.ast.BlockStyle.newlineBeforeContentfield.
-
NEWLINE_AFTER_CONTENT
public static final Name NEWLINE_AFTER_CONTENT
Name of thehydra.ast.BlockStyle.newlineAfterContentfield.
-
indent
public final Optional<java.lang.String> indent
An optional indentation string
-
newlineBeforeContent
public final java.lang.Boolean newlineBeforeContent
Whether to place a newline before the content
-
newlineAfterContent
public final java.lang.Boolean newlineAfterContent
Whether to place a newline after the content
-
-
Constructor Detail
-
BlockStyle
public BlockStyle(Optional<java.lang.String> indent, java.lang.Boolean newlineBeforeContent, java.lang.Boolean newlineAfterContent)
Constructs an immutableBlockStyle.- Parameters:
indent- An optional indentation stringnewlineBeforeContent- Whether to place a newline before the contentnewlineAfterContent- Whether to place a newline after the content
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
compareTo
public int compareTo(BlockStyle other)
- Specified by:
compareToin interfacejava.lang.Comparable<BlockStyle>
-
withIndent
public BlockStyle withIndent(Optional<java.lang.String> indent)
Returns a copy of thisBlockStylewithindentreplaced.
-
withNewlineBeforeContent
public BlockStyle withNewlineBeforeContent(java.lang.Boolean newlineBeforeContent)
Returns a copy of thisBlockStylewithnewlineBeforeContentreplaced.
-
withNewlineAfterContent
public BlockStyle withNewlineAfterContent(java.lang.Boolean newlineAfterContent)
Returns a copy of thisBlockStylewithnewlineAfterContentreplaced.
-
builder
public static BlockStyle.Builder builder()
Creates a new fluent builder forBlockStyle.
-
-