net.sf.okapi.common

## Interface IContext

- All Known Implementing Classes:
    BaseContext, BatchItemContext, ExecutionContext

      public interface IContext

  Common set of methods to provide context information.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clearAnnotations()` Removes all annotations from this context.
    `void` | `clearProperties()` Removes all properties from this context.
    `<A extends IAnnotation> A` | `getAnnotation(java.lang.Class<A> type)` Gets the annotation of a given type for this context.
    `boolean` | `getBoolean(java.lang.String name)` Gets a boolean property of this context.
    `int` | `getInteger(java.lang.String name)` Gets an integer property of this context.
    `java.lang.Object` | `getObject(java.lang.String name)` Gets an object property of this context.
    `java.util.Map<java.lang.String,java.lang.Object>` | `getProperties()` Gets the map of the existing properties for this context.
    `java.lang.String` | `getString(java.lang.String name)` Gets a string property of this context.
    `void` | `removeProperty(java.lang.String name)` Removes a given property from this context.
    `void` | `setAnnotation(IAnnotation annotation)` Sets an annotation for this context.
    `void` | `setBoolean(java.lang.String name, boolean value)` Sets a boolean property for this context.
    `void` | `setInteger(java.lang.String name, int value)` Sets an integer property for this context.
    `void` | `setObject(java.lang.String name, java.lang.Object value)` Sets an object property for this context.
    `void` | `setString(java.lang.String name, java.lang.String value)` Sets a string property for this context.

- - ### Method Detail

    - #### getString

          java.lang.String getString(java.lang.String name)

      Gets a string property of this context.
      Parameters:
        `name` - the name of the property to retrieve.
      Returns:
        the value of the property or null if it not defined.

    - #### setString

          void setString(java.lang.String name,
                       java.lang.String value)

      Sets a string property for this context. If the property is already defined its value will be overwritten.
      Parameters:
        `name` - the name of the property to set.
        `value` - the value to set.

    - #### getBoolean

          boolean getBoolean(java.lang.String name)

      Gets a boolean property of this context.
      Parameters:
        `name` - the name of the property to retrieve.
      Returns:
        the value of the property or false if it is not defined.

    - #### setBoolean

          void setBoolean(java.lang.String name,
                        boolean value)

      Sets a boolean property for this context. If the property is already defined its value will be overwritten.
      Parameters:
        `name` - the name of the property to set.
        `value` - the value to set.

    - #### getInteger

          int getInteger(java.lang.String name)

      Gets an integer property of this context.
      Parameters:
        `name` - the name of the property to retrieve.
      Returns:
        the value of the property or 0 if it is not defined.

    - #### setInteger

          void setInteger(java.lang.String name,
                        int value)

      Sets an integer property for this context. If the property is already defined its value will be overwritten.
      Parameters:
        `name` - the name of the property to set.
        `value` - the value to set.

    - #### getObject

          java.lang.Object getObject(java.lang.String name)

      Gets an object property of this context.
      Parameters:
        `name` - the name of the property to retrieve.
      Returns:
        the value of the property or null if it is not defined.

    - #### setObject

          void setObject(java.lang.String name,
                       java.lang.Object value)

      Sets an object property for this context. If the property is already defined its value will be overwritten.
      Parameters:
        `name` - the name of the property to set.
        `value` - the value to set.

    - #### removeProperty

          void removeProperty(java.lang.String name)

      Removes a given property from this context. If the property does not exist nothing happens.
      Parameters:
        `name` - the name of the property to remove.

    - #### getProperties

          java.util.Map<java.lang.String,java.lang.Object> getProperties()

      Gets the map of the existing properties for this context.
      Returns:
        the map of the properties for this context. May be empty but not null.

    - #### clearProperties

          void clearProperties()

      Removes all properties from this context.

    - #### getAnnotation

          <A extends IAnnotation> A getAnnotation(java.lang.Class<A> type)

      Gets the annotation of a given type for this context.
      Parameters:
        `type` - the type of the annotation to retrieve.
      Returns:
        the annotation for the given type, or null if it is not defined.

    - #### setAnnotation

          void setAnnotation(IAnnotation annotation)

      Sets an annotation for this context.
      Parameters:
        `annotation` - the annotation to set. If one of this type already exists it will be overwritten.

    - #### clearAnnotations

          void clearAnnotations()

      Removes all annotations from this context.