Class Options


  • public class Options
    extends Object
    A Store for all options.
    • Constructor Detail

      • Options

        public Options()
    • Method Detail

      • setGlobalOption

        public void setGlobalOption​(Option option)
        Sets an option with global scope.
        Parameters:
        option - the option to set, not null.
        Throws:
        NullPointerException - if option is null.
      • addGlobalOptions

        public void addGlobalOptions​(Collection<Option> options)
        Adds several options with global scope.
        Parameters:
        options - the option to add, not null, may not contain null.
        Throws:
        NullPointerException - if options is null or contains null.
      • getInHierarchy

        public Option getInHierarchy​(QualifiedName key)
        Returns the value of the option which is closest in Hierarchy. If more than one matching options (options with the matching name and in the name space or parent name space of the key) are found, the one which name space is closer to the given key's name space is chosen.
        Parameters:
        key - the key for the option which value should be retrieved.
        Returns:
        the value of the option (can be null), or null if no matching option exists.
      • getInHierarchy

        public Options getInHierarchy​(Namespace namespace)
        Returns all mappings which live in the given name space. If one mapping hides another mapping, i.e. if one mapping is a more specialized version of another, the hidden mapping is NOT returned.
        Parameters:
        namespace - the name space from which the returned options should be visible.
        Returns:
        an Options object containing the matching options
      • getAllInHierarchy

        public Options getAllInHierarchy​(Namespace namespace)
        Returns all mappings which live in the given namespace. If one mapping hides another mapping, i.e. if one mapping is a more specialized version of another, both mappings are present in the returned map.
        Parameters:
        namespace - the name space from which the returned options should be visible.
        Returns:
        an Options object containing the matching options
      • values

        public Collection<Option> values()
        Returns all options in a Collection.
        Returns:
        a Collection containing all options, not null. The collection is unmodifiable.
      • keySet

        public Collection<QualifiedName> keySet()
        Returns all options in a set.
        Returns:
        a Collection containing the qualified names of all options, not null.
      • getGlobalScope

        public Map<QualifiedName,​Option> getGlobalScope()
        Returns a map containing all options in the global scope. The key of the map is the key of the option, the value is the option itself.
        Returns:
        a map containing the options in global scope, not null.
      • containsKey

        public boolean containsKey​(QualifiedName key)
        Checks if an option with the given key exists in any scope.
        Parameters:
        key - the key to check.
        Returns:
        true if the key exists, false otherwise.