Class Context

    • Constructor Detail

      • Context

        public Context()
        Instantiates a new Context.
      • Context

        public Context​(@NonNull
                       @NonNull Map<String,​?> properties)
        Instantiates a new Context
        Parameters:
        properties - the properties
    • Method Detail

      • get

        public Object get​(String name)
        Gets the value for the given property name
        Parameters:
        name - the name
        Returns:
        the value
      • getAs

        public <T> T getAs​(String name,
                           @NonNull
                           @NonNull Class<T> clazz)
        Gets the value of the given property name as the given class type
        Type Parameters:
        T - the type parameter
        Parameters:
        name - the name
        clazz - the clazz
        Returns:
        the value
      • getAs

        public <T> T getAs​(String name,
                           @NonNull
                           @NonNull Type type)
        Gets the value of the given property name as the given type
        Type Parameters:
        T - the type parameter
        Parameters:
        name - the name
        type - the type
        Returns:
        the value
      • getAs

        public <T> T getAs​(String name,
                           @NonNull
                           @NonNull Class<T> clazz,
                           T defaultValue)
        Gets the value of the given property name as the given class type returning the default value if no value is currently set.
        Type Parameters:
        T - the type parameter
        Parameters:
        name - the name
        clazz - the clazz
        defaultValue - the default value if none is set.
        Returns:
        the value
      • getDouble

        public Double getDouble​(String name)
        Gets the value of the given property name as a double
        Parameters:
        name - the name
        Returns:
        the value
      • getDouble

        public Double getDouble​(String name,
                                double defaultValue)
        Gets the value of the given property name as a double or the default value if not defined.
        Parameters:
        name - the name
        defaultValue - the default value
        Returns:
        the value
      • getInteger

        public Integer getInteger​(String name)
        Gets the value of the given property name as an integer
        Parameters:
        name - the name
        Returns:
        the value
      • getInteger

        public Integer getInteger​(String name,
                                  int defaultValue)
        Gets the value of the given property name as an integer or the default value if not defined.
        Parameters:
        name - the name
        defaultValue - the default value
        Returns:
        the value
      • getString

        public String getString​(String name)
        Gets the value of the given property name as a String
        Parameters:
        name - the name
        Returns:
        the value
      • getString

        public String getString​(String name,
                                String defaultValue)
        Gets the value of the given property name as a String or the default value if not defined.
        Parameters:
        name - the name
        defaultValue - the default value
        Returns:
        the value
      • merge

        public void merge​(@NonNull
                          @NonNull Context other)
        Merges the given context with this one overwriting this context values with those in the given context.
        Parameters:
        other - the context to merge
      • property

        public void property​(String name,
                             Object value)
        Defines a property in the context.
        Parameters:
        name - the name
        value - the value