net.sf.okapi.common.resource

## Interface INameable

- All Superinterfaces:
    IResource
  All Known Subinterfaces:
    ITextUnit
  All Known Implementing Classes:
    BaseNameable, BaseReferenceable, DocumentPart, StartDocument, StartGroup, StartSubDocument, StartSubfilter, StorageList, TextContainer, TextUnit

      public interface INameable
      extends IResource

  Provides the methods common to all resources that can be named and have properties.

- - ### Field Summary

    - ### Fields inherited from interface net.sf.okapi.common.IResource

      `COPY_ALL, COPY_CONTENT, COPY_PROPERTIES, COPY_SEGMENTATION, COPY_SEGMENTED_CONTENT, CREATE_EMPTY`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Property` | `createTargetProperty(LocaleId locId, java.lang.String name, boolean overwriteExisting, int creationOptions)` Creates or get a target property based on the corresponding source.
    `java.lang.String` | `getMimeType()` Gets the type of content of this resource.
    `java.lang.String` | `getName()` Gets the name of this resource.
    `Property` | `getProperty(java.lang.String name)` Gets the resource-level property for a given name.
    `java.util.Set<java.lang.String>` | `getPropertyNames()` Gets the names of all the resource-level properties for this resource.
    `Property` | `getSourceProperty(java.lang.String name)` Gets the source property for a given name.
    `java.util.Set<java.lang.String>` | `getSourcePropertyNames()` Gets the names of all the source properties for this resource.
    `java.util.Set<LocaleId>` | `getTargetLocales()` Gets all the target locales for this resource.
    `Property` | `getTargetProperty(LocaleId locId, java.lang.String name)` Gets the target property for a given name and target locale.
    `java.util.Set<java.lang.String>` | `getTargetPropertyNames(LocaleId locId)` Gets the names of all the properties for a given target locale in this resource.
    `java.lang.String` | `getType()` Gets the type information associated with this resource.
    `boolean` | `hasProperty(java.lang.String name)` Indicates if a resource-level property exists for a given name.
    `boolean` | `hasSourceProperty(java.lang.String name)` Indicates if a source property exists for a given name.
    `boolean` | `hasTargetProperty(LocaleId locId, java.lang.String name)` Indicates if a property exists for a given name and target locale.
    `boolean` | `isTranslatable()` Indicates if the content of this resource is translatable.
    `boolean` | `preserveWhitespaces()` Indicates if the white-spaces in the content of this resource should be preserved.
    `void` | `removeProperty(java.lang.String name)` Removes a resource-level property of a given name.
    `void` | `removeSourceProperty(java.lang.String name)` Removes a source property of a given name.
    `void` | `removeTargetProperty(LocaleId locId, java.lang.String name)` Removes a target property of a given name.
    `void` | `setIsTranslatable(boolean value)` Sets the flag indicating if the content of this resource is translatable.
    `void` | `setMimeType(java.lang.String value)` Sets the type of content of this resource.
    `void` | `setName(java.lang.String name)` Sets the name of this resource.
    `void` | `setPreserveWhitespaces(boolean value)` sets the flag indicating if the white-spaces in the content of this resource should be preserved.
    `Property` | `setProperty(Property property)` Sets a resource-level property.
    `Property` | `setSourceProperty(Property property)` Sets a source property.
    `Property` | `setTargetProperty(LocaleId locId, Property property)` Sets a target property.
    `void` | `setType(java.lang.String value)` Sets the type information associated with this resource.

    - ### Methods inherited from interface net.sf.okapi.common.IResource

      `getAnnotation, getAnnotations, getId, getSkeleton, setAnnotation, setId, setSkeleton`

- - ### Method Detail

    - #### getName

          java.lang.String getName()

      Gets the name of this resource. The resource name corresponds to different things depending on the type of resource. For a StartDocument the name is the URI of the document. Otherwise, in most cases the name is the identifier of the resource (This is the equivalent of the XLIFF resname attribute).
      Returns:
        This resource name, or null if there is none.

    - #### setName

          void setName(java.lang.String name)

      Sets the name of this resource. The resource name is the equivalent of the XLIFF resname attribute.
      Parameters:
        `name` - New name to set.

    - #### getType

          java.lang.String getType()

      Gets the type information associated with this resource. For example "button".
      Returns:
        The type information associated with this resource.

    - #### setType

          void setType(java.lang.String value)

      Sets the type information associated with this resource. For example "button".
      Parameters:
        `value` - The new type information.

    - #### getMimeType

          java.lang.String getMimeType()

      Gets the type of content of this resource. For example "text/xml".
      Returns:
        The type of content of this resource.

    - #### setMimeType

          void setMimeType(java.lang.String value)

      Sets the type of content of this resource. For example "text/xml".
      Parameters:
        `value` - The new type of content of this resource.

    - #### getProperty

          Property getProperty(java.lang.String name)

      Gets the resource-level property for a given name.
      Parameters:
        `name` - Name of the property to retrieve.
      Returns:
        The property or null if it does not exist.

    - #### setProperty

          Property setProperty(Property property)

      Sets a resource-level property. If a property already exists it is overwritten.
      Parameters:
        `property` - The new property to set.
      Returns:
        The property that has been set.

    - #### removeProperty

          void removeProperty(java.lang.String name)

      Removes a resource-level property of a given name. If the property does not exists nothing happens.
      Parameters:
        `name` - The name of the property to remove.

    - #### getPropertyNames

          java.util.Set<java.lang.String> getPropertyNames()

      Gets the names of all the resource-level properties for this resource.
      Returns:
        All the names of the resource-level properties for this resource.

    - #### hasProperty

          boolean hasProperty(java.lang.String name)

      Indicates if a resource-level property exists for a given name.
      Parameters:
        `name` - The name of the resource-level property to query.
      Returns:
        True if a resource-level property exists, false otherwise.

    - #### getSourceProperty

          Property getSourceProperty(java.lang.String name)

      Gets the source property for a given name.
      Parameters:
        `name` - The name of the source property to retrieve.
      Returns:
        The property or null if it does not exist.

    - #### setSourceProperty

          Property setSourceProperty(Property property)

      Sets a source property. If a property already exists it is overwritten.
      Parameters:
        `property` - The new property to set.
      Returns:
        The property that has been set.

    - #### removeSourceProperty

          void removeSourceProperty(java.lang.String name)

      Removes a source property of a given name. If the property does not exists nothing happens.
      Parameters:
        `name` - The name of the property to remove.

    - #### getSourcePropertyNames

          java.util.Set<java.lang.String> getSourcePropertyNames()

      Gets the names of all the source properties for this resource.
      Returns:
        All the names of the source properties for this resource.

    - #### hasSourceProperty

          boolean hasSourceProperty(java.lang.String name)

      Indicates if a source property exists for a given name.
      Parameters:
        `name` - The name of the source property to query.
      Returns:
        True if a source property exists, false otherwise.

    - #### getTargetProperty

          Property getTargetProperty(LocaleId locId,
                                   java.lang.String name)

      Gets the target property for a given name and target locale.
      Parameters:
        `locId` - the locale of the property to retrieve.
        `name` - The name of the property to retrieve. This name is case-sensitive.
      Returns:
        The property or null if it does not exist.

    - #### setTargetProperty

          Property setTargetProperty(LocaleId locId,
                                   Property property)

      Sets a target property. If a property already exists it is overwritten.
      Parameters:
        `locId` - The target locale for which this property should be set.
        `property` - The new property to set. This name is case-sensitive.
      Returns:
        The property that has been set.

    - #### removeTargetProperty

          void removeTargetProperty(LocaleId locId,
                                  java.lang.String name)

      Removes a target property of a given name. If the property does not exists nothing happens.
      Parameters:
        `locId` - The target locale for which this property should be set.
        `name` - The name of the property to remove.

    - #### getTargetPropertyNames

          java.util.Set<java.lang.String> getTargetPropertyNames(LocaleId locId)

      Gets the names of all the properties for a given target locale in this resource.
      Parameters:
        `locId` - the target locale to query.
      Returns:
        all the names of the target properties for the given locale in this resource.

    - #### getTargetLocales

          java.util.Set<LocaleId> getTargetLocales()

      Gets all the target locales for this resource.
      Returns:
        all the target locales for this resource.

    - #### hasTargetProperty

          boolean hasTargetProperty(LocaleId locId,
                                  java.lang.String name)

      Indicates if a property exists for a given name and target locale.
      Parameters:
        `locId` - the target locale to query.
        `name` - the name of the property to query.
      Returns:
        true if a property exists, false otherwise.

    - #### createTargetProperty

          Property createTargetProperty(LocaleId locId,
                                      java.lang.String name,
                                      boolean overwriteExisting,
                                      int creationOptions)

      Creates or get a target property based on the corresponding source.
      Parameters:
        `locId` - The target locale to use.
        `name` - The name of the property to create (or retrieve)
        `overwriteExisting` - True to overwrite any existing property. False to not create a new property if one exists already.
        `creationOptions` - Creation options:
        - CREATE_EMPTY: Creates an empty property, only the read-only flag of the source is copied.
        - COPY_CONTENT: Creates a new property with all its data copied from the source.
      Returns:
        The property that was created, or retrieved.

    - #### isTranslatable

          boolean isTranslatable()

      Indicates if the content of this resource is translatable. By default this indicator is set to true for all resources.
      Returns:
        True if the content of this resource is translatable. False if it is not translatable.

    - #### setIsTranslatable

          void setIsTranslatable(boolean value)

      Sets the flag indicating if the content of this resource is translatable.
      Parameters:
        `value` - True to indicate that the content of this resource is translatable.

    - #### preserveWhitespaces

          boolean preserveWhitespaces()

      Indicates if the white-spaces in the content of this resource should be preserved. By default this indicator is set to false for all resources.
      Returns:
        True if the white-spaces in the content of this resource should be preserved.

    - #### setPreserveWhitespaces

          void setPreserveWhitespaces(boolean value)

      sets the flag indicating if the white-spaces in the content of this resource should be preserved.
      Parameters:
        `value` - True to indicate that the white-spaces in the content of this resource should be preserved.