Class Property
- All Implemented Interfaces:
Comparable<Property>
value type and category (internal or external)
of the property are included in the property definition. The available
choice values are also stored for open and closed choice value types.
Every public factory method below throws IllegalArgumentException if name
is in the reserved Tika-native namespace (tk:/X-TIKA:); see
ReservedNamespaces.
The public factories intern every Property in a static, JVM-global registry,
permanently (first-wins: a name collision keeps the earlier registration and WARNs
on a shape mismatch). They are for declaration-time constants — a bounded population. Never
feed them runtime, per-document, or user-supplied names: each distinct name grows the
registry forever, and a collision can shadow a curated constant JVM-wide. Document-derived
names go through Metadata.add(KeyPrefix, String, String) with no Property at all.
- Since:
- Apache Tika 0.7
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enum -
Method Summary
Modifier and TypeMethodDescriptionintstatic PropertyConstructs a new composite property from the given primary and array of secondary properties.booleanstatic PropertyexternalBoolean(String name) static PropertyexternalBooleanSeq(String name) static PropertyexternalClosedChoice(String name, String... choices) static PropertyexternalDate(String name) static PropertyexternalInteger(String name) static Propertystatic PropertyexternalOpenChoice(String name, String... choices) static PropertyexternalReal(String name) static PropertyexternalRealSeq(String name) static PropertyexternalText(String name) static PropertyexternalTextBag(String name) static PropertyRetrieve the property object that corresponds to the given key.Returns the (immutable) set of choices for the values of this property.getName()Gets the primary property for a composite propertygetProperties(String prefix) Likeget(String), registered Properties only: never returns aKeyPrefix-minted Property.static Property.PropertyTypegetPropertyType(String key) Get the type of a propertyProperty[]Gets the secondary properties for a composite propertyinthashCode()static PropertyinternalBoolean(String name) static PropertyinternalClosedChoice(String name, String... choices) static PropertyinternalDate(String name) static PropertyinternalDateBag(String name) static PropertyinternalInteger(String name) static Propertystatic PropertyinternalOpenChoice(String name, String... choices) static PropertyinternalRational(String name) static PropertyinternalReal(String name) static PropertyinternalText(String name) static PropertyinternalTextBag(String name) static PropertyinternalURI(String name) booleanbooleanbooleanIs the PropertyType one which accepts multiple values?toString()The property name, so a String→Property constant flip doesn't turn existing logging/concatenation intoProperty@<hex>with no compile signal.
-
Method Details
-
getPropertyType
Get the type of a property- Parameters:
key- name of the property- Returns:
- the type of the property
-
get
Retrieve the property object that corresponds to the given key. Only registered Properties resolve here: document-derived keys (written viaMetadata.add(KeyPrefix, String, String)or minted throughProperty#mintUnregistered) are never interned, so this always returnsnullfor them, even after a write. This is load-bearing forMetadata.reconstruct(java.lang.String, java.lang.String, boolean), which falls back to the trusted String path when lookup misses.- Parameters:
key- the property key or name- Returns:
- the Property object, or
nullif unregistered
-
getProperties
Likeget(String), registered Properties only: never returns aKeyPrefix-minted Property. -
internalBoolean
-
internalClosedChoice
-
internalDate
-
internalDateBag
-
internalInteger
-
internalIntegerSequence
-
internalRational
-
internalOpenChoice
-
internalReal
-
internalText
-
internalTextBag
-
internalURI
-
externalClosedChoice
-
externalOpenChoice
-
externalDate
-
externalReal
-
externalRealSeq
-
externalIntegerSequence
-
externalInteger
-
externalBoolean
-
externalBooleanSeq
-
externalText
-
externalTextBag
-
composite
Constructs a new composite property from the given primary and array of secondary properties.Note that name of the composite property is taken from its primary property, and primary and secondary properties must not be composite properties themselves.
No reserved-name check here:
primaryPropertywas already validated at its own mint.- Parameters:
primaryProperty-secondaryExtractProperties-- Returns:
- the composite property
-
getName
-
isInternal
public boolean isInternal() -
isExternal
public boolean isExternal() -
isMultiValuePermitted
public boolean isMultiValuePermitted()Is the PropertyType one which accepts multiple values? -
getPropertyType
-
getValueType
-
getChoices
Returns the (immutable) set of choices for the values of this property. Only defined foropenandclosed choicevalue types.- Returns:
- available choices, or
null
-
getPrimaryProperty
Gets the primary property for a composite property- Returns:
- the primary property
-
getSecondaryExtractProperties
Gets the secondary properties for a composite property- Returns:
- the secondary properties
-
compareTo
- Specified by:
compareToin interfaceComparable<Property>
-
equals
-
hashCode
public int hashCode() -
toString
The property name, so a String→Property constant flip doesn't turn existing logging/concatenation intoProperty@<hex>with no compile signal.
-