TextModifier
interface TextModifier
Package: dev.joid.lib.font.modifier · Module: core · Source: TextModifier.java
Changes the characters a text shows, such as its case, without changing its value.
Description
Section titled “Description”Set one on a Text or a TextElement with modifier(...), or use one of the constants.
It applies to the whole text at once and leaves the markup tags untouched.
Learn more
Section titled “Learn more”Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
String | modify(String text) abstract | Returns the text to show for text, without markup tags. |
String | modify(String text, TextInfo info) default | Returns the text to show for text, with the tags of the markups of info kept as they are and the text between them modified as one string. |
String | modifyAfter(UnaryOperator | Returns the modified form of text when it follows before, so that a modifier that depends on what comes first, such as a capital at the start, stays right across elements; text is appended to before. |
String | camelCase(String text, boolean upperFirst) static | Returns text with its words joined in camel case, the first word capitalized when upperFirst is true; any character other than a letter or a digit separates words. |
String | capitalizeWords(String text) static | Returns text with the first letter after each whitespace in title case. |
Constants and fields
Section titled “Constants and fields”| Type | Name | Value | Summary |
|---|---|---|---|
TextModifier | LOWER_CASE | text -> text.toLowerCase(Locale.ROOT) | Shows the text in lower case. |
TextModifier | UPPER_CASE | text -> text.toUpperCase(Locale.ROOT) | Shows the text in upper case. |
TextModifier | CAMEL_CASE | text -> TextModifier.camelCase(text, false) | Shows hello big world as helloBigWorld. |
TextModifier | UPPER_CAMEL_CASE | text -> TextModifier.camelCase(text, true) | Shows hello big world as HelloBigWorld. |
TextModifier | SNAKE_CASE | text -> text.toLowerCase(Locale.ROOT).replace(" ", "_") | Shows Hello big world as hello_big_world. |
TextModifier | CAPITALIZE | StringUtils::capitalize | Capitalizes the first letter of the text. |
TextModifier | WORD_CAPITALIZE | TextModifier::capitalizeWords | Capitalizes the first letter of every word. |
Method details
Section titled “Method details”modify
Section titled “modify”String modify(String text) abstract
Returns the text to show for text, without markup tags.
String modify(String text, TextInfo info) default
Returns the text to show for text, with the tags of the markups of info kept as they are and the text between them modified as one string.
modifyAfter
Section titled “modifyAfter”String modifyAfter(UnaryOperator<String> modifier, StringBuilder before, String text) static
Returns the modified form of text when it follows before, so that a modifier that depends on what comes first, such as a capital at the start, stays right across elements; text is appended to before.
camelCase
Section titled “camelCase”String camelCase(String text, boolean upperFirst) static
Returns text with its words joined in camel case, the first word capitalized when upperFirst is true; any character other than a letter or a digit separates words.
capitalizeWords
Section titled “capitalizeWords”String capitalizeWords(String text) static
Returns text with the first letter after each whitespace in title case.
Constant and field details
Section titled “Constant and field details”LOWER_CASE
Section titled “LOWER_CASE”TextModifier LOWER_CASE
Shows the text in lower case.
UPPER_CASE
Section titled “UPPER_CASE”TextModifier UPPER_CASE
Shows the text in upper case.
CAMEL_CASE
Section titled “CAMEL_CASE”TextModifier CAMEL_CASE
Shows hello big world as helloBigWorld.
UPPER_CAMEL_CASE
Section titled “UPPER_CAMEL_CASE”TextModifier UPPER_CAMEL_CASE
Shows hello big world as HelloBigWorld.
SNAKE_CASE
Section titled “SNAKE_CASE”TextModifier SNAKE_CASE
Shows Hello big world as hello_big_world.
CAPITALIZE
Section titled “CAPITALIZE”TextModifier CAPITALIZE
Capitalizes the first letter of the text.
WORD_CAPITALIZE
Section titled “WORD_CAPITALIZE”TextModifier WORD_CAPITALIZE
Capitalizes the first letter of every word.
fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses
