Package org.apache.tika.metadata.schema
Class MetadataKeyValidator
java.lang.Object
org.apache.tika.metadata.schema.MetadataKeyValidator
Registry-driven lint: classifies a metadata key against the committed registries rather than a
hand-coded rule. A key is legitimate iff it is an enumerated closed key
(
metadata-keys.json), sits under a registered passthrough prefix
(metadata-open-namespaces.json), or is a documented template instance. Anything else is
MetadataKeyValidator.Classification.UNKNOWN — a typo, an unregistered namespace, or a key someone forgot to
declare.
Reads the JSON snapshots (which MetadataSchemaTest gates against the live declarations),
so it needs no parser classes loaded and stays dependency-free.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionfindUnknown(Iterable<String> names) The unregistered keys amongnames, in encounter order.static MetadataKeyValidatorLoads the validator from the committed registries on the classpath.booleanisLegitimate(String key) The supplying module (Maven artifactId) of the registry entry that classifieskey-- the key itself for CLOSED, the matched prefix for OPEN.
-
Method Details
-
fromClasspath
Loads the validator from the committed registries on the classpath. -
classify
-
isLegitimate
-
moduleOf
The supplying module (Maven artifactId) of the registry entry that classifieskey-- the key itself for CLOSED, the matched prefix for OPEN. Empty for TEMPLATE/UNKNOWN or if the registry didn't attribute a module for that entry. -
findUnknown
The unregistered keys amongnames, in encounter order.
-