Top Description Inners Fields Constructors Methods
io.github.kusoroadeolu.clique.configuration

public Class DividerConfiguration

extends Object
Class Inheritance
Imports
io.github.kusoroadeolu.clique.internal.utils.ParserUtils, io.github.kusoroadeolu.clique.parser.MarkupParser, io.github.kusoroadeolu.clique.spi.AnsiCode, java.util.Arrays, .Objects

Immutable configuration for a io.github.kusoroadeolu.clique.components.Divider.

Controls three aspects of divider rendering:

The DEFAULT constant provides a pre-built configuration with the default divider character, no divider color, and MarkupParser#DEFAULT as the parser.

This class is immutable and thread-safe. DividerConfigurationBuilder is not thread-safe; external synchronization is required if a builder instance is shared across threads.

Example:

DividerConfiguration config = DividerConfiguration.builder()
    .dividerChar('=')
    .dividerColor("red")
    .parser(MarkupParser.DEFAULT)
    .build();

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
public static final DividerConfiguration
private final char
private final AnsiCode[]
private final MarkupParser

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
pack-priv
DividerConfiguration(AnsiCode[] dividerColor, char dividerChar, MarkupParser parser)

Method Summary

Modifier and TypeMethod and Description
public static DividerConfiguration.DividerConfigurationBuilder
builder()

Returns a new builder for constructing a DividerConfiguration.

public boolean
equals(Object o)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public char
public AnsiCode[]
public MarkupParser
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

DEFAULTback to summary
public static final DividerConfiguration DEFAULT
dividerCharback to summary
private final char dividerChar
dividerColorback to summary
private final AnsiCode[] dividerColor
parserback to summary
private final MarkupParser parser

Constructor Detail

DividerConfigurationback to summary
pack-priv DividerConfiguration(DividerConfiguration.DividerConfigurationBuilder builder)
DividerConfigurationback to summary
pack-priv DividerConfiguration()
DividerConfigurationback to summary
pack-priv DividerConfiguration(AnsiCode[] dividerColor, char dividerChar, MarkupParser parser)

Method Detail

builderback to summary
public static DividerConfiguration.DividerConfigurationBuilder builder()

Returns a new builder for constructing a DividerConfiguration.

Returns:DividerConfiguration.DividerConfigurationBuilder

a new DividerConfigurationBuilder

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Annotations
@Override
getDividerCharback to summary
public char getDividerChar()
getDividerColorback to summary
public AnsiCode[] getDividerColor()
getParserback to summary
public MarkupParser getParser()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
io.github.kusoroadeolu.clique.configuration back to summary

public Class DividerConfiguration.DividerConfigurationBuilder

extends Object
Class Inheritance
  • java.lang.Object
  • io.github.kusoroadeolu.clique.configuration.DividerConfiguration.DividerConfigurationBuilder

Field Summary

Modifier and TypeField and Description
private char
private AnsiCode[]
private MarkupParser

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public DividerConfiguration

Returns:

a new, immutable DividerConfiguration
build
()

Constructs a new DividerConfiguration from the current builder state.

public DividerConfiguration.DividerConfigurationBuilder

Returns:

this builder
dividerChar
(char
the char used to render the Divider
c
)

Sets the char used to render the Divider

public DividerConfiguration.DividerConfigurationBuilder

Returns:

this builder
dividerColor
(AnsiCode...
one or more ANSI codes to apply to Divider; must not be null
colorCodes
)

Sets the ANSI color to the io.github.kusoroadeolu.clique.components.Divider characters during rendering.

public DividerConfiguration.DividerConfigurationBuilder

Returns:

this builder
dividerColor
(String
a markup string representing the desired Divider color; must not be null
color
)

Sets the ANSI color to the Divider by parsing a markup string using the currently configured parser.

public DividerConfiguration.DividerConfigurationBuilder

Returns:

this builder
parser
(MarkupParser
the parser to use; must not be null
parser
)

Sets the MarkupParser used to resolve markup tags in the divider title.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dividerCharback to summary
private char dividerChar
dividerColorback to summary
private AnsiCode[] dividerColor
parserback to summary
private MarkupParser parser

Constructor Detail

DividerConfigurationBuilderback to summary
public DividerConfigurationBuilder()

Method Detail

buildback to summary
public DividerConfiguration build()

Constructs a new DividerConfiguration from the current builder state.

Returns:DividerConfiguration

a new, immutable DividerConfiguration

dividerCharback to summary
public DividerConfiguration.DividerConfigurationBuilder dividerChar(char c)

Sets the char used to render the Divider

Parameters
c:char

the char used to render the Divider

Returns:DividerConfiguration.DividerConfigurationBuilder

this builder

Exceptions
NullPointerException:
if c is null
dividerColorback to summary
public DividerConfiguration.DividerConfigurationBuilder dividerColor(AnsiCode... colorCodes)

Sets the ANSI color to the io.github.kusoroadeolu.clique.components.Divider characters during rendering.

Parameters
colorCodes:AnsiCode[]

one or more ANSI codes to apply to Divider; must not be null

Returns:DividerConfiguration.DividerConfigurationBuilder

this builder

Exceptions
NullPointerException:
if codes is null
dividerColorback to summary
public DividerConfiguration.DividerConfigurationBuilder dividerColor(String color)

Sets the ANSI color to the Divider by parsing a markup string using the currently configured parser. to the io.github.kusoroadeolu.clique.components.Divider characters

The markup string is resolved against the parser set via parser(MarkupParser) at the time this method is called.

Parameters
color:String

a markup string representing the desired Divider color; must not be null

Returns:DividerConfiguration.DividerConfigurationBuilder

this builder

Exceptions
NullPointerException:
if color is null
parserback to summary
public DividerConfiguration.DividerConfigurationBuilder parser(MarkupParser parser)

Sets the MarkupParser used to resolve markup tags in the divider title.

Parameters
parser:MarkupParser

the parser to use; must not be null

Returns:DividerConfiguration.DividerConfigurationBuilder

this builder

Exceptions
NullPointerException:
if parser is null