Class PortAnnotationConfig

  • All Implemented Interfaces:
    CodecContext

    public class PortAnnotationConfig
    extends BaseConfig<ConnectPoint>
    Configuration to add extra annotations to a port via netcfg subsystem.
    • Constructor Detail

      • PortAnnotationConfig

        public PortAnnotationConfig()
        Create a detached PortAnnotationConfig.

        Note: created instance needs to be initialized by #init(..) before using.

      • PortAnnotationConfig

        public PortAnnotationConfig​(ConnectPoint cp)
        Create a detached PortAnnotationConfig for specified port.

        Note: created instance is not bound to NetworkConfigService, thus cannot use Config.apply(). Must be passed to the service using NetworkConfigService#applyConfig

        Parameters:
        cp - ConnectPoint
    • Method Detail

      • isValid

        public boolean isValid()
        Description copied from class: Config
        Indicates whether or not the backing JSON node contains valid data.

        Default implementation returns true. Subclasses are expected to override this with their own validation. Implementations are free to throw a RuntimeException if data is invalid.

        Overrides:
        isValid in class Config<ConnectPoint>
        Returns:
        true if the data is valid; false otherwise
      • annotations

        public Map<String,​String> annotations()
        Returns annotations to add to a Port.
        Returns:
        annotations as a map. null value represent key removal request
      • annotations

        public PortAnnotationConfig annotations​(Map<String,​String> replace)
        Sets annotations to add to a Port.
        Parameters:
        replace - annotations to be added by this configuration. null value represent key removal request
        Returns:
        self
      • annotation

        public PortAnnotationConfig annotation​(String key,
                                               String value)
        Add configuration to set or remove annotation entry.
        Parameters:
        key - annotations key
        value - annotations value. specifying null removes the entry.
        Returns:
        self
      • annotation

        public PortAnnotationConfig annotation​(String key)
        Remove configuration about specified key.
        Parameters:
        key - annotations key
        Returns:
        self