net.sf.okapi.common.resource

## Class Property

- java.lang.Object
- - net.sf.okapi.common.resource.Property

-     public class Property
      extends java.lang.Object

  Represents a read-only or a modifiable property associated with a resource. For example the HREF attribute of the element A in HTML would be a property. Note that translatable data (such as the text of an attribute ALT of an IMG element in HTML) must be stored in `TextUnit` rather that Property.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Annotations` | `annotations`
    `static java.lang.String` | `APPROVED`
    `static java.lang.String` | `COORDINATES`
    `static java.lang.String` | `ENCODING`
    `static java.lang.String` | `ITS_LQI` Helper property used only for placing back ITS Localization Quality Issue annotations.
    `static java.lang.String` | `ITS_PROV` Helper property used only for placing back ITS Provenance annotations.
    `static java.lang.String` | `LANGUAGE`
    `static java.lang.String` | `NOTE`
    `static java.lang.String` | `TRANSNOTE`
    `static java.lang.String` | `XLIFF_PHASE`
    `static java.lang.String` | `XLIFF_TOOL`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Property(java.lang.String name, java.lang.String value)` Creates a new read-only property object with a name and a value.
    `Property(java.lang.String name, java.lang.String value, boolean isReadOnly)` Creates a new property object with a name, a vale and its read-only flag.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Property` | `clone()` Clones this property.
    `<A extends IAnnotation> A` | `getAnnotation(java.lang.Class<A> type)` Gets the annotation of a given type for this property.
    `Annotations` | `getAnnotations()`
    `boolean` | `getBoolean()` Gets the boolean value of this property.
    `java.lang.String` | `getName()` Gets the name of this property.
    `java.lang.String` | `getValue()` Gets the value of this property.
    `boolean` | `isReadOnly()` Indicates if this property is read-only.
    `void` | `setAnnotation(IAnnotation annotation)` Sets an annotation for this property.
    `void` | `setValue(java.lang.String value)` Sets a new value for this property.
    `java.lang.String` | `toString()` Gets the string representation of this property.

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### ENCODING

          public static final java.lang.String ENCODING

      See Also:
        Constant Field Values

    - #### LANGUAGE

          public static final java.lang.String LANGUAGE

      See Also:
        Constant Field Values

    - #### APPROVED

          public static final java.lang.String APPROVED

      See Also:
        Constant Field Values

    - #### NOTE

          public static final java.lang.String NOTE

      See Also:
        Constant Field Values

    - #### TRANSNOTE

          public static final java.lang.String TRANSNOTE

      See Also:
        Constant Field Values

    - #### COORDINATES

          public static final java.lang.String COORDINATES

      See Also:
        Constant Field Values

    - #### ITS_LQI

          public static final java.lang.String ITS_LQI

      Helper property used only for placing back ITS Localization Quality Issue annotations.
      See Also:
        Constant Field Values

    - #### ITS_PROV

          public static final java.lang.String ITS_PROV

      Helper property used only for placing back ITS Provenance annotations.
      See Also:
        Constant Field Values

    - #### XLIFF_TOOL

          public static final java.lang.String XLIFF_TOOL

      See Also:
        Constant Field Values

    - #### XLIFF_PHASE

          public static final java.lang.String XLIFF_PHASE

      See Also:
        Constant Field Values

    - #### annotations

          protected Annotations annotations

  - ### Constructor Detail

    - #### Property

          public Property(java.lang.String name,
                  java.lang.String value,
                  boolean isReadOnly)

      Creates a new property object with a name, a vale and its read-only flag.
      Parameters:
        `name` - the name of the property (case-sensitive).
        `value` - the value of the property.
        `isReadOnly` - true if the property cannot be modified using the filter, false if you can modify the value in the output document.

    - #### Property

          public Property(java.lang.String name,
                  java.lang.String value)

      Creates a new read-only property object with a name and a value.
      Parameters:
        `name` - the name of the property (case-sensitive)
        `value` - the value of the property.

  - ### Method Detail

    - #### toString

          public java.lang.String toString()

      Gets the string representation of this property. This is the same as its value.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        the value of the property.

    - #### clone

          public Property clone()

      Clones this property.
      Overrides:
        `clone` in class `java.lang.Object`
      Returns:
        a new property object that is a copy of this one.

    - #### getName

          public java.lang.String getName()

      Gets the name of this property.
      Returns:
        the name of this property.

    - #### getValue

          public java.lang.String getValue()

      Gets the value of this property.
      Returns:
        the value of this property.

    - #### getBoolean

          public boolean getBoolean()

      Gets the boolean value of this property. Use this helper method to get a boolean from the value of this property. The values "true" and "yes" (in any case) returns true, any other value returns false. No verification is done to see if the value is really boolean or not.
      Returns:
        true is the property value is "true", "yes" (case-insensitive), false otherwise.

    - #### setValue

          public void setValue(java.lang.String value)

      Sets a new value for this property.
      Parameters:
        `value` - the new value to set.

    - #### isReadOnly

          public boolean isReadOnly()

      Indicates if this property is read-only.

      All property can be changed, but the ones flagged as read-only cannot be modified when re-writing the document from where they have been extracted.

      Returns:
        true if the property cannot be modified in the filter output, false if it can be modified.

    - #### getAnnotation

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

      Gets the annotation of a given type for this property.
      Parameters:
        `type` - the type of annotation to retrieve.
      Returns:
        the annotation, or null if this property has no annotation of the requested type.

    - #### setAnnotation

          public void setAnnotation(IAnnotation annotation)

      Sets an annotation for this property.
      Parameters:
        `annotation` - the annotation object to set.

    - #### getAnnotations

          public Annotations getAnnotations()