Class DynamicPlugin

  • All Implemented Interfaces:
    Plugin

    public class DynamicPlugin
    extends java.lang.Object
    implements Plugin
    This Plugin can be arbitrarily customized.
    • Constructor Detail

      • DynamicPlugin

        public DynamicPlugin()
    • Method Detail

      • loadYaml

        public static DynamicPlugin loadYaml​(java.lang.String yamlUrl)
        Loads a YAML file of the following format:
        
         # mappings to be loaded by this plugin
         mappings:
           include:
             - <expression that evaluates to a Mapping instance or Collection of such>
             - ...
           exclude:
             - <expression that evaluates to a Mapping instance or Collection of such>
             - ...
        
         # channel conversions to be loaded by this plugin
         conversions:
           include:
             - <expression that evaulates to a ChannelConversion instance or Collection of such>
             - ..
           exclude:
             - <expression that evaulates to a ChannelConversion instance or Collection of such>
             - ..
        
         # properties configured by this plugin
         properties:
           <property name>: <property value>
        
         # required platforms
         platforms:
           include:
             - <expression that evaluates to a Platform instance or Collection of such>
             - ..
           exclude:
             - <expression that evaluates to a Platform instance or Collection of such>
             - ..
        
         
        Parameters:
        yamlUrl - an URL to a YAML file of the above format
        Returns:
        the configured instance
        See Also:
        Supported expressions
      • ifPresent

        public static <T> void ifPresent​(java.lang.Object o,
                                         java.lang.Class<? super T> t,
                                         java.util.function.Consumer<T> consumer)
        Checks and casts the given Object. If it is not null, feed it to a Consumer.
        Parameters:
        o - to be casted
        t - to that should be casted
        consumer - accepts the casted o unless it is null
      • addRequiredPlatform

        public void addRequiredPlatform​(Platform platform)
      • excludeRequiredPlatform

        public void excludeRequiredPlatform​(Platform platform)
      • addMapping

        public void addMapping​(Mapping mapping)
      • excludeMapping

        public void excludeMapping​(Mapping mapping)
      • getMappings

        public java.util.Collection<Mapping> getMappings()
        Description copied from interface: Plugin
        Provides the Mappings shipped with this instance.
        Specified by:
        getMappings in interface Plugin
        Returns:
        the Mappings
      • addChannelConversion

        public void addChannelConversion​(ChannelConversion channelConversion)
      • excludeChannelConversion

        public void excludeChannelConversion​(ChannelConversion channelConversion)
      • addProperty

        public void addProperty​(java.lang.String key,
                                java.lang.Object value)
      • setProperties

        public void setProperties​(Configuration configuration)
        Description copied from interface: Plugin
        Provides relevant Configuration properties.
        Specified by:
        setProperties in interface Plugin
        Parameters:
        configuration - accepts the properties