java.lang.Object
org.jhotdraw8.application.resources.FontIconDecoder
- All Implemented Interfaces:
ResourceDecoder
FontIconDecoder decodes a property value if it starts with the specified
prefix.
The property value must have the following format:
format = prefix, "U+", codePoint ; prefix = "fonticon:" ;
- Author:
- Werner Randelshofer
-
Constructor Summary
ConstructorsConstructorDescriptionFontIconDecoder(@NonNull String keyRegex, String valuePrefix, @NonNull String fontResourceName, float fontSize, @NonNull Class<?> baseClass) Creates a new instance.FontIconDecoder(@NonNull String keyRegex, String valuePrefix, javafx.scene.text.Font font) Creates a new instance.FontIconDecoder(@NonNull String keyRegex, javafx.scene.text.Font font) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if this resource handler can decode the specified property value.<T> @NonNull TDecodes the property value.
-
Constructor Details
-
FontIconDecoder
Creates a new instance.- Parameters:
keyRegex- the regex used on the property keyfont- The font
-
FontIconDecoder
Creates a new instance.- Parameters:
keyRegex- the regex used on the property keyvaluePrefix- the prefix for the value.font- The font
-
FontIconDecoder
public FontIconDecoder(@NonNull String keyRegex, String valuePrefix, @NonNull String fontResourceName, float fontSize, @NonNull Class<?> baseClass) throws IOException Creates a new instance.- Parameters:
keyRegex- the regex used on the property keyvaluePrefix- the prefix for the value.fontResourceName- The resource name of the fontfontSize- The size of the fontbaseClass- The base class for loading the font- Throws:
IOException- if the font resource can not be read
-
-
Method Details
-
canDecodeValue
public boolean canDecodeValue(@NonNull String key, @NonNull String propertyValue, @NonNull Class<?> type) Description copied from interface:ResourceDecoderReturns true if this resource handler can decode the specified property value.- Specified by:
canDecodeValuein interfaceResourceDecoder- Parameters:
key- The property keypropertyValue- the property valuetype- The desired type- Returns:
- true if the property can be decoded
-
decode
public <T> @NonNull T decode(String key, @NonNull String propertyValue, Class<T> type, Class<?> baseClass) Description copied from interface:ResourceDecoderDecodes the property value.- Specified by:
decodein interfaceResourceDecoder- Type Parameters:
T- The type of the decoded object- Parameters:
key- The property keypropertyValue- The property valuetype- The desired typebaseClass- The base class to be used if the property value is a resource uri- Returns:
- the decoded object
-