CustomProperty that belong to a
DocumentSummaryInformation. The class maintains the names of the
custom properties in a dictionary. It implements the Map interface
and by this provides a simplified view on custom properties: A property's
name is the key that maps to a typed value. This implementation hides
property IDs from the developer and regards the property names as keys to
typed values.While this class provides a simple API to custom properties, it ignores the fact that not names, but IDs are the real keys to properties. Under the hood this class maintains a 1:1 relationship between IDs and names. Therefore you should not use this class to process property sets with several IDs mapping to the same name or with properties without a name: the result will contain only a subset of the original properties. If you really need to deal such property sets, use HPSF's low-level access methods.
An application can call the isPure method to check whether a
property set parsed by CustomProperties is still pure (i.e.
unmodified) or whether one or more properties have been dropped.
This class is not thread-safe; concurrent access to instances of this class must be synchronized.
While this class is roughly HashMap<Long,CustomProperty>, that's the internal representation. To external calls, it should appear as HashMap<String,Object> mapping between Names and Custom Property Values.
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private final TreeBidiMap | dictionary
Maps property IDs to property names and vice versa. |
| private boolean | isPure
Tells whether this object is pure or not. |
| private static final Logger | |
| private final HashMap | props
The custom properties |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public void | clear()
Implements java. Removes all of the mappings from this map (optional operation). |
| public boolean | containsKey(Object
key whose presence in this map is to be tested key)Implements java. Checks against both String Name and Long ID |
| public boolean | containsValue(Object
value whose presence in this map is to be tested value)Implements java. Checks against both the property, and its values. |
| public Set | entrySet()
Implements java. Returns a |
| public boolean | equals(Object
object to be compared for equality with this map obj)Overrides java. Implements java. Compares the specified object with this map for equality. |
| public Object | Returns: the value ornull if a value with the specified
name is not found in the custom properties.the name of the value to get key)Implements java. Gets a named value from the custom properties - only works for keys of type String |
| public int | |
| pack-priv Map | Returns: the dictionary.Gets the dictionary which contains IDs and names of the named custom properties. |
| public int | hashCode()
Overrides java. Implements java. Returns the hash code value for this map. |
| public Set | Returns: a set of all the IDs of our custom propertiesReturns a set of all the IDs of our custom properties |
| public boolean | |
| public boolean | isPure()
Tells whether this |
| public Set | Returns: a set of all the names of our custom propertiesImplements java. Returns a set of all the names of our custom properties. |
| public Set | Returns: a set of all the names of our custom propertiesReturns a set of all the names of our custom properties |
| public List | |
| public CustomProperty | Returns: the previous property stored under this namethe property name name, final CustomProperty the property cp)Implements java. Puts a |
| public Object | Returns: the property that was stored under the specified name before, ornull if there was no such property before.The property's name. key, Object The property's value. value)Implements java. Adds a named property. |
| private Object | Returns: If there was already a property with the same name, the old propertyThe customProperty)CustomProperty to add.Puts a |
| public void | putAll(Map<? extends String, ?>
mappings to be stored in this map m)Implements java. Copies all of the mappings from the specified map to this map (optional operation). |
| public CustomProperty | Returns: The removed property ornull if the specified property was not found.The name of the custom property to remove key)Implements java. Removes a custom property - only works for keys of type String |
| public void | |
| public void | |
| public int | |
| public Collection | Returns: the list of property values - useproperties() for the wrapped valuesImplements java. Returns a |
| codepage | back to summary |
|---|---|
| private int codepage | |
| dictionary | back to summary |
|---|---|
| private final TreeBidiMap<Long, String> dictionary Maps property IDs to property names and vice versa. | |
| isPure | back to summary |
|---|---|
| private boolean isPure Tells whether this object is pure or not. | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| props | back to summary |
|---|---|
| private final HashMap<Long, CustomProperty> props The custom properties | |
| CustomProperties | back to summary |
|---|---|
| public CustomProperties() | |
| checkCodePage | back to summary |
|---|---|
| private void checkCodePage(String value) | |
| clear | back to summary |
|---|---|
| public void clear() Implements java. Doc from java. Removes all of the mappings from this map (optional operation). The map will be empty after this call returns.
| |
| containsKey | back to summary |
|---|---|
| public boolean containsKey(Object key) Implements java. Checks against both String Name and Long ID
| |
| containsValue | back to summary |
|---|---|
| public boolean containsValue(Object value) Implements java. Checks against both the property, and its values.
| |
| entrySet | back to summary |
|---|---|
| public Set Implements java. Doc from java. Returns a | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Implements java. Doc from java. Compares the specified object with this map for equality. Returns
| |
| get | back to summary |
|---|---|
| public Object get(final Object key) Implements java. Gets a named value from the custom properties - only works for keys of type String | |
| getCodepage | back to summary |
|---|---|
| public int getCodepage() Gets the codepage.
| |
| getDictionary | back to summary |
|---|---|
| pack-priv Map Gets the dictionary which contains IDs and names of the named custom properties. | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Implements java. Doc from java. Returns the hash code value for this map. The hash code of a map is
defined to be the sum of the hash codes of each entry in the map's
| |
| idSet | back to summary |
|---|---|
| public Set Returns a set of all the IDs of our custom properties | |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Implements java. Doc from java. Returns
| |
| isPure | back to summary |
|---|---|
| public boolean isPure() Tells whether this
| |
| keySet | back to summary |
|---|---|
| public Set Implements java. Returns a set of all the names of our custom properties.
Equivalent to | |
| nameSet | back to summary |
|---|---|
| public Set Returns a set of all the names of our custom properties | |
| properties | back to summary |
|---|---|
public List
| |
| put | back to summary |
|---|---|
| public CustomProperty put(final String name, final CustomProperty cp) Implements java. Puts a
| |
| put | back to summary |
|---|---|
| public Object put(String key, Object value) Implements java. Adds a named property. | |
| put | back to summary |
|---|---|
| private Object put(final CustomProperty customProperty) throws ClassCastException Puts a
| |
| putAll | back to summary |
|---|---|
| public void putAll(Map<? extends String, ?> m) Implements java. Doc from java. Copies all of the mappings from the specified map to this map
(optional operation). The effect of this call is equivalent to that
of calling | |
| remove | back to summary |
|---|---|
| public CustomProperty remove(Object key) Implements java. Removes a custom property - only works for keys of type String
| |
| setCodepage | back to summary |
|---|---|
| public void setCodepage(final int codepage) Sets the codepage.
| |
| setPure | back to summary |
|---|---|
| public void setPure(final boolean isPure) Sets the purity of the custom property set.
| |
| size | back to summary |
|---|---|
| public int size() Implements java. Doc from java. Returns the number of key-value mappings in this map. If the
map contains more than
| |
| values | back to summary |
|---|---|
| public Collection Implements java. Doc from java. Returns a
| |