Class FontIconDecoder

java.lang.Object
org.jhotdraw8.application.resources.FontIconDecoder
All Implemented Interfaces:
ResourceDecoder

public class FontIconDecoder extends Object implements 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 Details

    • FontIconDecoder

      public FontIconDecoder(@NonNull String keyRegex, javafx.scene.text.Font font)
      Creates a new instance.
      Parameters:
      keyRegex - the regex used on the property key
      font - The font
    • FontIconDecoder

      public FontIconDecoder(@NonNull String keyRegex, String valuePrefix, javafx.scene.text.Font font)
      Creates a new instance.
      Parameters:
      keyRegex - the regex used on the property key
      valuePrefix - 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 key
      valuePrefix - the prefix for the value.
      fontResourceName - The resource name of the font
      fontSize - The size of the font
      baseClass - 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: ResourceDecoder
      Returns true if this resource handler can decode the specified property value.
      Specified by:
      canDecodeValue in interface ResourceDecoder
      Parameters:
      key - The property key
      propertyValue - the property value
      type - 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: ResourceDecoder
      Decodes the property value.
      Specified by:
      decode in interface ResourceDecoder
      Type Parameters:
      T - The type of the decoded object
      Parameters:
      key - The property key
      propertyValue - The property value
      type - The desired type
      baseClass - The base class to be used if the property value is a resource uri
      Returns:
      the decoded object