Cleaned up config.
This commit is contained in:
parent
bfb7ebcc09
commit
414fbc07cb
2 changed files with 19 additions and 20 deletions
|
@ -35,17 +35,16 @@ import java.math.RoundingMode
|
||||||
/**
|
/**
|
||||||
* Provides a configuration builder.
|
* Provides a configuration builder.
|
||||||
*/
|
*/
|
||||||
class Config private constructor(builder: Builder) {
|
class Config @JvmOverloads constructor(
|
||||||
val text: String
|
val text: String,
|
||||||
val wpm: Int
|
var wpm: Int = 275,
|
||||||
val postfix: String
|
var postfix: String = "min read",
|
||||||
val plural: String
|
var plural: String = "min read",
|
||||||
val excludeImages: Boolean
|
var excludeImages: Boolean = false,
|
||||||
val extra: Int
|
var extra: Int = 0,
|
||||||
val roundingMode: RoundingMode
|
var roundingMode: RoundingMode = RoundingMode.HALF_EVEN
|
||||||
|
) {
|
||||||
init {
|
constructor(builder: Builder) : this(builder.text) {
|
||||||
text = builder.text
|
|
||||||
wpm = builder.wpm
|
wpm = builder.wpm
|
||||||
postfix = builder.postfix
|
postfix = builder.postfix
|
||||||
plural = builder.plural
|
plural = builder.plural
|
||||||
|
@ -105,6 +104,6 @@ class Config private constructor(builder: Builder) {
|
||||||
/**
|
/**
|
||||||
* Builds the configuration.
|
* Builds the configuration.
|
||||||
*/
|
*/
|
||||||
fun build() = Config(this)
|
fun build(): Config = Config(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
final Boolean excludeImages = (Boolean) getJspContext().getAttribute("excludeImages");
|
final Boolean excludeImages = (Boolean) getJspContext().getAttribute("excludeImages");
|
||||||
final Integer extra = (Integer) getJspContext().getAttribute("extra");
|
final Integer extra = (Integer) getJspContext().getAttribute("extra");
|
||||||
final Integer wpm = (Integer) getJspContext().getAttribute("wpm");
|
final Integer wpm = (Integer) getJspContext().getAttribute("wpm");
|
||||||
final String body = (String) getJspContext().getAttribute("body");;
|
final String body = (String) getJspContext().getAttribute("body");
|
||||||
final String plural = (String) getJspContext().getAttribute("plural");
|
final String plural = (String) getJspContext().getAttribute("plural");
|
||||||
final String postfix = (String) getJspContext().getAttribute("postfix");
|
final String postfix = (String) getJspContext().getAttribute("postfix");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue