public class CustomProperties
extends java.lang.Object
implements java.util.Map<java.lang.String,java.lang.Object>
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.
(维护属于 DocumentSummaryInformation 的 CustomProperty 实例。该类在字典中维护自定义属性的名称。它实现了 Map 接口,从而提供了自定义属性的简化视图:属性的名称是映射到类型化值的键。此实现对开发人员隐藏属性 ID,并将属性名称视为类型值的键。虽然此类为自定义属性提供了一个简单的 API,但它忽略了一个事实,即不是名称,而是 ID 是属性的真正键。在后台,这个类在 ID 和名称之间保持 1:1 的关系。因此,您不应该使用此类来处理具有多个 ID 映射到相同名称或没有名称的属性的属性集:结果将仅包含原始属性的子集。如果您确实需要处理此类属性集,请使用 HPSF 的低级访问方法。应用程序可以调用 isPure 方法来检查由 CustomProperties 解析的属性集是否仍然是纯的(即未修改),或者是否删除了一个或多个属性。这个类不是线程安全的;必须同步对此类实例的并发访问。虽然这个类大致是HashMapConstructor and Description |
---|
CustomProperties() |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(java.lang.Object key)
Checks against both String Name and Long ID
(检查字符串名称和长 ID)
|
boolean |
containsValue(java.lang.Object value)
Checks against both the property, and its values.
(检查属性及其值。)
|
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> |
entrySet() |
boolean |
equals(java.lang.Object obj) |
java.lang.Object |
get(java.lang.Object key)
Gets a named value from the custom properties - only works for keys of type String
(从自定义属性中获取命名值 - 仅适用于字符串类型的键)
|
int |
getCodepage()
Gets the codepage.
(获取代码页。)
|
int |
hashCode() |
java.util.Set<java.lang.Long> |
idSet()
Returns a set of all the IDs of our custom properties
(返回我们自定义属性的所有 ID 的集合)
|
boolean |
isEmpty() |
boolean |
isPure()
Tells whether this
CustomProperties instance is pure or one or more properties of the underlying low-level property set has been dropped.
(说明此 CustomProperties 实例是纯的还是底层低级属性集的一个或多个属性已被删除。)
|
java.util.Set |
keySet()
Returns a set of all the names of our custom properties.
(返回一组我们自定义属性的所有名称。)
|
java.util.Set<java.lang.String> |
nameSet()
Returns a set of all the names of our custom properties
(返回一组我们自定义属性的所有名称)
|
java.util.List<CustomProperty> |
properties() |
CustomProperty |
put(java.lang.String name, CustomProperty cp)
Puts a
CustomProperty into this map.
(将 CustomProperty 放入此地图。)
|
java.lang.Object |
put(java.lang.String key, java.lang.Object value)
Adds a named property.
(添加命名属性。)
|
void |
putAll(java.util.Map<? extends java.lang.String,?> m) |
CustomProperty |
remove(java.lang.Object key)
Removes a custom property - only works for keys of type String
(删除自定义属性 - 仅适用于 String 类型的键)
|
void |
setCodepage(int codepage)
Sets the codepage.
(设置代码页。)
|
void |
setPure(boolean isPure)
Sets the purity of the custom property set.
(设置自定义属性集的纯度。)
|
int |
size() |
java.util.Collection<java.lang.Object> |
values() |
public CustomProperty put(java.lang.String name, CustomProperty cp)
CustomProperty
into this map. It is assumed that the
CustomProperty
already has a valid ID. Otherwise use
put(CustomProperty)
.
(将 CustomProperty 放入此地图。假定 CustomProperty 已经有一个有效的 ID。否则使用 put(CustomProperty)。)
name
- the property name
(name - 属性名称)
cp
- the property
(cp - 属性)
public java.lang.Object put(java.lang.String key, java.lang.Object value)
put
in interface
java.util.Map<java.lang.String,java.lang.Object>
(放入接口 java.util.Map
key
- The property's name.
(key - 属性的名称。)
value
- The property's value.
(value - 属性的值。)
null
if there was no such property before.
(之前以指定名称存储的属性,如果之前没有此类属性,则为 null。)
public java.lang.Object get(java.lang.Object key)
get
in interface
java.util.Map<java.lang.String,java.lang.Object>
(进入接口 java.util.Map
key
- the name of the value to get
(key - 要获取的值的名称)
null
if a value with the specified name is not found in the custom properties.
(如果在自定义属性中未找到具有指定名称的值,则返回该值或 null。)
public CustomProperty remove(java.lang.Object key)
remove
in interface
java.util.Map<java.lang.String,java.lang.Object>
(在接口 java.util.Map 中删除
key
- The name of the custom property to remove
(key - 要删除的自定义属性的名称)
null
if the specified property was not found.
(如果未找到指定的属性,则删除的属性或 null。)
public int size()
size
in interface
java.util.Map<java.lang.String,java.lang.Object>
(接口 java.util.Map 中的大小
public boolean isEmpty()
isEmpty
in interface
java.util.Map<java.lang.String,java.lang.Object>
(接口 java.util.Map 中的 isEmpty
public void clear()
clear
in interface
java.util.Map<java.lang.String,java.lang.Object>
(在接口 java.util.Map 中清除
public int hashCode()
hashCode
in interface
java.util.Map<java.lang.String,java.lang.Object>
(接口 java.util.Map 中的 hashCode
hashCode
in class
java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in interface
java.util.Map<java.lang.String,java.lang.Object>
(接口 java.util.Map 中的等于
equals
in class
java.lang.Object
public void putAll(java.util.Map<? extends java.lang.String,?> m)
putAll
in interface
java.util.Map<java.lang.String,java.lang.Object>
(接口 java.util.Map 中的 putAll
public java.util.List<CustomProperty> properties()
public java.util.Collection<java.lang.Object> values()
values
in interface
java.util.Map<java.lang.String,java.lang.Object>
(接口 java.util.Map 中的值
properties()
for the wrapped values
(属性值列表 - 使用 properties() 包装值)
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
entrySet
in interface
java.util.Map<java.lang.String,java.lang.Object>
(接口 java.util.Map 中的 entrySet
public java.util.Set keySet()
nameSet()
(返回一组我们自定义属性的所有名称。等价于 nameSet())
keySet
in interface
java.util.Map<java.lang.String,java.lang.Object>
(接口 java.util.Map 中的 keySet
public java.util.Set<java.lang.String> nameSet()
public java.util.Set<java.lang.Long> idSet()
public void setCodepage(int codepage)
codepage
- the codepage
(代码页 - 代码页)
public int getCodepage()
public boolean containsKey(java.lang.Object key)
containsKey
in interface
java.util.Map<java.lang.String,java.lang.Object>
(接口 java.util.Map 中的 containsKey
public boolean containsValue(java.lang.Object value)
containsValue
in interface
java.util.Map<java.lang.String,java.lang.Object>
(接口 java.util.Map 中的 containsValue
public boolean isPure()
CustomProperties
instance is pure or one or more properties of the underlying low-level property set has been dropped.
(说明此 CustomProperties 实例是纯的还是底层低级属性集的一个或多个属性已被删除。)
true
if the
CustomProperties
is pure, else
false
.
(如果 CustomProperties 是纯的,则为 true,否则为 false。)
public void setPure(boolean isPure)
isPure
- the purity
(isPure - 纯度)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.