Module org.jhotdraw8.css
Package org.jhotdraw8.css.converter
Class LiteralEnumCssConverter<E extends Enum<E>>
java.lang.Object
org.jhotdraw8.css.converter.LiteralEnumCssConverter<E>
- Type Parameters:
E- the type of the enum that can be converted from/to CSS
- All Implemented Interfaces:
Converter<E>,CssConverter<E>
CssLiteralEnumConverter. Uses the names of the Java Enum literals
for conversion.
If you need a different mapping use MappedCssConverter or
KebabCaseEnumCssConverter.
- Author:
- Werner Randelshofer
-
Constructor Summary
ConstructorsConstructorDescriptionLiteralEnumCssConverter(@NonNull Class<E> enumClass) LiteralEnumCssConverter(@NonNull Class<E> enumClass, boolean nullable) -
Method Summary
Modifier and TypeMethodDescriptionGets a help text.booleanparse(@NonNull CssTokenizer tt, @Nullable IdResolver idResolver) Parses from the given tokenizer and moves the tokenizer to the next token past the value.<TT extends E>
voidproduceTokens(@Nullable TT value, @Nullable IdSupplier idSupplier, @NonNull Consumer<CssToken> consumer) Produces tokens for the specified value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jhotdraw8.base.converter.Converter
fromString, fromString, fromStringNonNull, fromStringNonNull, fromStringNonNull, fromStringNonNull, needsIdResolver, toString, toStringMethods inherited from interface org.jhotdraw8.css.converter.CssConverter
fromString, fromString, getExamples, parseNonNull, toString, toString, toString, toTokens
-
Constructor Details
-
LiteralEnumCssConverter
-
LiteralEnumCssConverter
-
-
Method Details
-
parse
public @Nullable E parse(@NonNull CssTokenizer tt, @Nullable IdResolver idResolver) throws ParseException, IOException Description copied from interface:CssConverterParses from the given tokenizer and moves the tokenizer to the next token past the value.- Specified by:
parsein interfaceCssConverter<E extends Enum<E>>- Parameters:
tt- tokenizer positioned on the tokenidResolver- the id factory- Returns:
- the parsed value
- Throws:
ParseException- on parse exceptionIOException- on io exception
-
getHelpText
Description copied from interface:CssConverterGets a help text.- Specified by:
getHelpTextin interfaceConverter<E extends Enum<E>>- Specified by:
getHelpTextin interfaceCssConverter<E extends Enum<E>>- Returns:
- a help text.
-
produceTokens
public <TT extends E> void produceTokens(@Nullable TT value, @Nullable IdSupplier idSupplier, @NonNull Consumer<CssToken> consumer) Description copied from interface:CssConverterProduces tokens for the specified value.- Specified by:
produceTokensin interfaceCssConverter<E extends Enum<E>>- Type Parameters:
TT- the value type- Parameters:
value- the valueidSupplier- the id factoryconsumer- the consumer for the tokens
-
toString
-
getDefaultValue
- Specified by:
getDefaultValuein interfaceConverter<E extends Enum<E>>
-
isNullable
public boolean isNullable()- Specified by:
isNullablein interfaceCssConverter<E extends Enum<E>>
-