Package net.sf.okapi.common.resource
Class Property
- java.lang.Object
-
- net.sf.okapi.common.resource.Property
-
- All Implemented Interfaces:
Cloneable
public class Property extends Object implements Cloneable
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 inTextUnit
rather that Property.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Property.Type
Property types.
-
Field Summary
Fields Modifier and Type Field Description static String
APPROVED
static String
COORDINATES
static EnumSet<Property.Type>
DISPLAY_ONLY
static String
ENCODING
static EnumSet<Property.Type>
FILTER_AND_DISPLAY
static String
ITS_LQI
Helper property used only for placing back some ITS and other annotations.static String
ITS_MTCONFIDENCE
static String
ITS_PROV
static String
LANGUAGE
static String
MAX_HEIGHT
static String
MAX_WIDTH
Sizing properties, can be applied to StartGroup or ITextUnit objects.static String
SIZE_UNIT
static String
STATE
static String
STATE_QUALIFIER
static String
TMX_hi
static String
TMX_i
For TMX filter - may be used byTMXWriter
orTMXFilterWriter
static String
TMX_x
static String
XLIFF_PHASE
static String
XLIFF_TOOL
-
Constructor Summary
Constructors Constructor Description Property(String name, String value)
Creates a new read-only property object with a name and a value.Property(String name, String value, boolean isReadOnly)
Creates a new property object with a name, a vale and its read-only flag.Property(String name, String value, boolean isReadOnly, EnumSet<Property.Type> type)
Property(String name, String value, EnumSet<Property.Type> type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Property
clone()
Clones this property.boolean
equals(Object o)
boolean
getBoolean()
Gets the boolean value of this property.String
getName()
Gets the name of this property.EnumSet<Property.Type>
getTypes()
Gets the types of the Property.String
getValue()
Gets the value of this property.int
hashCode()
boolean
isReadOnly()
Indicates if this property is read-only.protected void
setName(String name)
protected void
setReadOnly(boolean isReadOnly)
void
setTypes(EnumSet<Property.Type> types)
Set the types of the Property.void
setValue(String value)
Sets a new value for this property.String
toString()
Gets the string representation of this property.
-
-
-
Field Detail
-
ENCODING
public static final String ENCODING
- See Also:
- Constant Field Values
-
LANGUAGE
public static final String LANGUAGE
- See Also:
- Constant Field Values
-
APPROVED
public static final String APPROVED
- See Also:
- Constant Field Values
-
COORDINATES
public static final String COORDINATES
- See Also:
- Constant Field Values
-
STATE_QUALIFIER
public static final String STATE_QUALIFIER
- See Also:
- Constant Field Values
-
STATE
public static final String STATE
- See Also:
- Constant Field Values
-
ITS_LQI
public static final String ITS_LQI
Helper property used only for placing back some ITS and other annotations.- See Also:
- Constant Field Values
-
ITS_PROV
public static final String ITS_PROV
- See Also:
- Constant Field Values
-
ITS_MTCONFIDENCE
public static final String ITS_MTCONFIDENCE
- See Also:
- Constant Field Values
-
XLIFF_TOOL
public static final String XLIFF_TOOL
- See Also:
- Constant Field Values
-
XLIFF_PHASE
public static final String XLIFF_PHASE
- See Also:
- Constant Field Values
-
MAX_WIDTH
public static final String MAX_WIDTH
Sizing properties, can be applied to StartGroup or ITextUnit objects.- See Also:
- Constant Field Values
-
MAX_HEIGHT
public static final String MAX_HEIGHT
- See Also:
- Constant Field Values
-
SIZE_UNIT
public static final String SIZE_UNIT
- See Also:
- Constant Field Values
-
TMX_i
public static final String TMX_i
For TMX filter - may be used byTMXWriter
orTMXFilterWriter
- See Also:
- Constant Field Values
-
TMX_hi
public static String TMX_hi
-
TMX_x
public static String TMX_x
-
FILTER_AND_DISPLAY
public static EnumSet<Property.Type> FILTER_AND_DISPLAY
-
DISPLAY_ONLY
public static EnumSet<Property.Type> DISPLAY_ONLY
-
-
Constructor Detail
-
Property
public Property(String name, 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(String name, String value, boolean isReadOnly, EnumSet<Property.Type> type)
-
Property
public Property(String name, 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.
-
Property
public Property(String name, String value, EnumSet<Property.Type> type)
-
-
Method Detail
-
toString
public String toString()
Gets the string representation of this property. This is the same as its value.
-
clone
public Property clone()
Clones this property.
-
getName
public String getName()
Gets the name of this property.- Returns:
- the name of this property.
-
setName
protected void setName(String name)
-
getValue
public String getValue()
Gets the value of this property.- Returns:
- the value of this property.
-
setValue
public void setValue(String value)
Sets a new value for this property.- Parameters:
value
- the new value to set.
-
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.
-
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.
-
setReadOnly
protected void setReadOnly(boolean isReadOnly)
-
getTypes
public EnumSet<Property.Type> getTypes()
Gets the types of the Property. @seeProperty.Type
- Returns:
- The types of the Property.
-
setTypes
public void setTypes(EnumSet<Property.Type> types)
Set the types of the Property. @seeProperty.Type
- Parameters:
types
- The types to set.
-
-