Package net.sf.okapi.common.resource
Interface IWithTargetProperties
-
- All Known Subinterfaces:
IMultilingual,ITextUnit
- All Known Implementing Classes:
DocumentPart,StartDocument,StartGroup,StartSubfilter,StorageList,TextUnit
public interface IWithTargetProperties
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static voidcopy(IWithTargetProperties from, IWithTargetProperties to)Copy allIWithTargetPropertiesUnless destination already has the property. TargetLocaleIdnot found in the destination are added then properties are copied.default PropertycreateTargetProperty(LocaleId locId, String name, boolean overwriteExisting, int creationOptions)Create targetPropertywithout access to the source propertydefault PropertycreateTargetProperty(LocaleId locId, String name, Property sourceProperty, boolean overwriteExisting, int creationOptions)Creates or get a target property based on the corresponding source.AnnotationsgetAnnotations()default Set<LocaleId>getTargetLocales()Gets all the target locales for this resource.default Map<String,Property>getTargetProperties(LocaleId locale)default PropertygetTargetProperty(LocaleId locId, String name)Gets the target property for a given name and target locale.default Set<String>getTargetPropertyNames(LocaleId locId)Gets the names of all the properties for a given target locale in this resource.default booleanhasTargetProperty(LocaleId locId, String name)Indicates if a property exists for a given name and target locale.default voidremoveTargetProperty(LocaleId locId, String name)Removes a target property of a given name.default PropertysetTargetProperty(LocaleId locId, Property property)Sets a target property.
-
-
-
Method Detail
-
copy
static void copy(IWithTargetProperties from, IWithTargetProperties to)
Copy allIWithTargetPropertiesUnless destination already has the property. TargetLocaleIdnot found in the destination are added then properties are copied. Properties are cloned before copying.- Parameters:
from- source ofIWithTargetPropertiesto- destination ofIWithTargetProperties
-
getTargetProperties
default Map<String,Property> getTargetProperties(LocaleId locale)
- Returns:
Mapof target properties for the implementer of interface
-
createTargetProperty
default Property createTargetProperty(LocaleId locId, String name, boolean overwriteExisting, int creationOptions)
Create targetPropertywithout access to the source property- Parameters:
locId-name-overwriteExisting-creationOptions-- Returns:
-
createTargetProperty
default Property createTargetProperty(LocaleId locId, String name, Property sourceProperty, 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)sourceProperty- The source property of the same nameoverwriteExisting- 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.
-
getAnnotations
Annotations getAnnotations()
- Returns:
Annotationsfor the implementer of interface
-
getTargetLocales
default Set<LocaleId> getTargetLocales()
Gets all the target locales for this resource.- Returns:
- all the target locales for this resource.
-
getTargetProperty
default Property getTargetProperty(LocaleId locId, 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.
-
getTargetPropertyNames
default Set<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.
-
hasTargetProperty
default boolean hasTargetProperty(LocaleId locId, 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.
-
removeTargetProperty
default void removeTargetProperty(LocaleId locId, 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.
-
setTargetProperty
default 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.
-
-