java.lang.Object
org.jhotdraw8.css.converter.MappedCssConverter<E>
- Type Parameters:
E- the object type
- All Implemented Interfaces:
Converter<E>,CssConverter<E>
This converter uses a map to convert an object from/to String.
-
Constructor Summary
ConstructorsConstructorDescriptionMappedCssConverter(String name, @NonNull ReadOnlyMap<String, E> fromStringMap) MappedCssConverter(String name, @NonNull ReadOnlyMap<String, E> fromStringMap, 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
-
MappedCssConverter
-
MappedCssConverter
-
MappedCssConverter
-
MappedCssConverter
public MappedCssConverter(String name, @NonNull ReadOnlyMap<String, E> fromStringMap, boolean nullable)
-
-
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>- 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>- Specified by:
getHelpTextin interfaceCssConverter<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>- Type Parameters:
TT- the value type- Parameters:
value- the valueidSupplier- the id factoryconsumer- the consumer for the tokens
-
getDefaultValue
- Specified by:
getDefaultValuein interfaceConverter<E>
-
isNullable
public boolean isNullable()- Specified by:
isNullablein interfaceCssConverter<E>
-