|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap
java.util.HashMap
org.apache.poi.hpsf.CustomProperties
public class CustomProperties
Maintains the instances of 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, that's the internal representation. To external calls, it should appear as HashMap mapping between Names and Custom Property Values.
| Constructor Summary | |
|---|---|
CustomProperties()
|
|
| Method Summary | |
|---|---|
boolean |
containsKey(java.lang.Object key)
Checks against both String Name and Long ID |
boolean |
containsValue(java.lang.Object value)
Checks against both the property, and its values. |
java.lang.Object |
get(java.lang.String name)
Gets a named value from the custom properties. |
int |
getCodepage()
Gets the codepage. |
java.util.Set |
idSet()
Returns a set of all the IDs of our custom properties |
boolean |
isPure()
Tells whether this CustomProperties instance is pure or one or
more properties of the underlying low-level property set has been
dropped. |
java.util.Set |
keySet()
Returns a set of all the names of our custom properties. |
java.util.Set |
nameSet()
Returns a set of all the names of our custom properties |
java.lang.Object |
put(java.lang.String name,
java.lang.Boolean value)
Adds a named boolean property. |
CustomProperty |
put(java.lang.String name,
CustomProperty cp)
Puts a CustomProperty into this map. |
java.lang.Object |
put(java.lang.String name,
java.util.Date value)
Adds a named date property. |
java.lang.Object |
put(java.lang.String name,
java.lang.Double value)
Adds a named double property. |
java.lang.Object |
put(java.lang.String name,
java.lang.Integer value)
Adds a named integer property. |
java.lang.Object |
put(java.lang.String name,
java.lang.Long value)
Adds a named long property. |
java.lang.Object |
put(java.lang.String name,
java.lang.String value)
Adds a named string property. |
java.lang.Object |
remove(java.lang.String name)
Removes a custom property. |
void |
setCodepage(int codepage)
Sets the codepage. |
void |
setPure(boolean isPure)
Sets the purity of the custom property set. |
| Methods inherited from class java.util.HashMap |
|---|
clear, clone, entrySet, get, isEmpty, put, putAll, remove, size, values |
| Methods inherited from class java.util.AbstractMap |
|---|
equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public CustomProperties()
| Method Detail |
|---|
public CustomProperty put(java.lang.String name,
CustomProperty cp)
Puts a CustomProperty into this map. It is assumed that the
CustomProperty already has a valid ID. Otherwise use
put(CustomProperty).
public java.lang.Object remove(java.lang.String name)
Removes a custom property.
name - The name of the custom property to remove
null if the specified property was not found.HashSet.remove(java.lang.Object)
public java.lang.Object put(java.lang.String name,
java.lang.String value)
Adds a named string property.
name - The property's name.value - The property's value.
null if there was no such property before.
public java.lang.Object put(java.lang.String name,
java.lang.Long value)
Adds a named long property.
name - The property's name.value - The property's value.
null if there was no such property before.
public java.lang.Object put(java.lang.String name,
java.lang.Double value)
Adds a named double property.
name - The property's name.value - The property's value.
null if there was no such property before.
public java.lang.Object put(java.lang.String name,
java.lang.Integer value)
Adds a named integer property.
name - The property's name.value - The property's value.
null if there was no such property before.
public java.lang.Object put(java.lang.String name,
java.lang.Boolean value)
Adds a named boolean property.
name - The property's name.value - The property's value.
null if there was no such property before.public java.lang.Object get(java.lang.String name)
Gets a named value from the custom properties.
name - the name of the value to get
null if a value with the specified
name is not found in the custom properties.
public java.lang.Object put(java.lang.String name,
java.util.Date value)
Adds a named date property.
name - The property's name.value - The property's value.
null if there was no such property before.public java.util.Set keySet()
nameSet()
keySet in interface java.util.MapkeySet in class java.util.HashMappublic java.util.Set nameSet()
public java.util.Set idSet()
public void setCodepage(int codepage)
Sets the codepage.
codepage - the codepagepublic boolean containsKey(java.lang.Object key)
containsKey in interface java.util.MapcontainsKey in class java.util.HashMappublic boolean containsValue(java.lang.Object value)
containsValue in interface java.util.MapcontainsValue in class java.util.HashMappublic int getCodepage()
Gets the codepage.
public boolean isPure()
Tells whether this CustomProperties instance is pure or one or
more properties of the underlying low-level property set has been
dropped.
true if the CustomProperties is pure, else
false.public void setPure(boolean isPure)
Sets the purity of the custom property set.
isPure - the purity
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||