Interface PropertyProviderGenerator

  • All Known Implementing Classes:
    LocalePropertyProviderGenerator

    public interface PropertyProviderGenerator
    An interface for generating a property provider JS implementation, rather than having it defined in a module file. Use it like this:
       <property-provider name="foo" generator="org.example.FooGenerator"/>
     
    A default implementation in JS can be included inside the property-provider tag as usual, and will be used if the generator returns null.
    • Method Detail

      • generate

        java.lang.String generate​(TreeLogger logger,
                                  java.util.SortedSet<java.lang.String> possibleValues,
                                  java.lang.String fallback,
                                  java.util.SortedSet<ConfigurationProperty> configProperties)
                           throws UnableToCompleteException
        Generate a property provider.
        Parameters:
        logger - TreeLogger
        possibleValues - the possible values of this property
        fallback - the fallback value for this property, or null
        configProperties - the configuration properties for this module
        Returns:
        the JS source of the property provider (the complete body of a JS function taking no arguments, including open/close braces), or null to use the default implementation in the property-provider tag
        Throws:
        UnableToCompleteException - after logging the message if processing is unable to continue