Package org.daisy.dotify.api.translator
Class TranslatorMode.Builder
- java.lang.Object
-
- org.daisy.dotify.api.translator.TranslatorMode.Builder
-
- Enclosing class:
- TranslatorMode
public static class TranslatorMode.Builder extends Object
Provides a translator mode builder.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TranslatorModebuild()Builds a newTranslatorModeinstance based on the current configuration of this builder.TranslatorMode.Builderdescription(String value)Set the description for this mode.TranslatorMode.BuilderdisplayName(String value)Set the display name for this mode.TranslatorMode.BuilderdotsPerCell(Optional<TranslatorMode.DotsPerCell> value)Set the number of dots per cell.TranslatorMode.BuilderdotsPerCell(TranslatorMode.DotsPerCell value)Set the number of dots per cell.TranslatorMode.Buildergrade(double grade)Sets the contraction grade.TranslatorMode.Builderidentifier(String value)Sets the identifier.static TranslatorMode.Builderparse(String str)Parses the string as translator mode segments and sets the builder accordingly.TranslatorMode.Buildertype(TranslatorType type)Sets the translator type.static TranslatorMode.BuilderwithGrade(double grade)Creates a new translator mode builder with the specified contraction grade.static TranslatorMode.BuilderwithIdentifier(String identifier)Creates a new translator mode builder with the specified identifier.static TranslatorMode.BuilderwithType(TranslatorType type)Creates a new translator mode builder with the specified type.
-
-
-
Method Detail
-
withIdentifier
public static TranslatorMode.Builder withIdentifier(String identifier)
Creates a new translator mode builder with the specified identifier.- Parameters:
identifier- the identifier- Returns:
- a new builder
-
withType
public static TranslatorMode.Builder withType(TranslatorType type)
Creates a new translator mode builder with the specified type.- Parameters:
type- the translator type- Returns:
- a new builder
-
withGrade
public static TranslatorMode.Builder withGrade(double grade)
Creates a new translator mode builder with the specified contraction grade.Note that setting the contraction grade implies that the translator type is
contractedeven though in some locales a particular contraction grade could have another meaning, for example that the braille is not contracted.- Parameters:
grade- the contraction grade- Returns:
- a new builder
-
parse
public static TranslatorMode.Builder parse(String str)
Parses the string as translator mode segments and sets the builder accordingly.- Parameters:
str- the input string- Returns:
- a new builder
- Throws:
IllegalArgumentException- if parsing fails
-
identifier
public TranslatorMode.Builder identifier(String value)
Sets the identifier. If an identifier is not set, it will be generated from the supplied properties.- Parameters:
value- the identifier- Returns:
- this instance
-
grade
public TranslatorMode.Builder grade(double grade)
Sets the contraction grade.- Parameters:
grade- the contraction grade- Returns:
- this instance
-
type
public TranslatorMode.Builder type(TranslatorType type)
Sets the translator type.- Parameters:
type- the type- Returns:
- this instance
-
displayName
public TranslatorMode.Builder displayName(String value)
Set the display name for this mode. The display name should be localized.- Parameters:
value- the display name- Returns:
- this instance
-
description
public TranslatorMode.Builder description(String value)
Set the description for this mode. The description should be localized.- Parameters:
value- the description- Returns:
- this instance
-
dotsPerCell
public TranslatorMode.Builder dotsPerCell(Optional<TranslatorMode.DotsPerCell> value)
Set the number of dots per cell.- Parameters:
value- dots per cell- Returns:
- this instance
-
dotsPerCell
public TranslatorMode.Builder dotsPerCell(TranslatorMode.DotsPerCell value)
Set the number of dots per cell.- Parameters:
value- dots per cell- Returns:
- this instance
-
build
public TranslatorMode build()
Builds a newTranslatorModeinstance based on the current configuration of this builder.- Returns:
- a new
TranslatorModeinstance
-
-