org.apache.tika.metadata
Class Metadata

java.lang.Object
  extended by org.apache.tika.metadata.Metadata
All Implemented Interfaces:
CreativeCommons, DublinCore, HttpHeaders, MSOffice, TikaMetadataKeys, TikaMimeKeys

public class Metadata
extends java.lang.Object
implements CreativeCommons, DublinCore, HttpHeaders, MSOffice, TikaMetadataKeys, TikaMimeKeys

A multi-valued metadata container.


Field Summary
 
Fields inherited from interface org.apache.tika.metadata.CreativeCommons
LICENSE_LOCATION, LICENSE_URL, WORK_TYPE
 
Fields inherited from interface org.apache.tika.metadata.DublinCore
CONTRIBUTOR, COVERAGE, CREATOR, DATE, DESCRIPTION, FORMAT, IDENTIFIER, LANGUAGE, MODIFIED, PUBLISHER, RELATION, RIGHTS, SOURCE, SUBJECT, TITLE, TYPE
 
Fields inherited from interface org.apache.tika.metadata.HttpHeaders
CONTENT_DISPOSITION, CONTENT_ENCODING, CONTENT_LANGUAGE, CONTENT_LENGTH, CONTENT_LOCATION, CONTENT_MD5, CONTENT_TYPE, LAST_MODIFIED, LOCATION
 
Fields inherited from interface org.apache.tika.metadata.MSOffice
APPLICATION_NAME, APPLICATION_VERSION, AUTHOR, CATEGORY, CHARACTER_COUNT, CHARACTER_COUNT_WITH_SPACES, COMMENTS, COMPANY, CONTENT_STATUS, CREATION_DATE, EDIT_TIME, KEYWORDS, LAST_AUTHOR, LAST_PRINTED, LAST_SAVED, LINE_COUNT, MANAGER, NOTES, PAGE_COUNT, PARAGRAPH_COUNT, PRESENTATION_FORMAT, REVISION_NUMBER, SECURITY, SLIDE_COUNT, TEMPLATE, TOTAL_TIME, VERSION, WORD_COUNT
 
Fields inherited from interface org.apache.tika.metadata.TikaMetadataKeys
PROTECTED, RESOURCE_NAME_KEY
 
Fields inherited from interface org.apache.tika.metadata.TikaMimeKeys
MIME_TYPE_MAGIC, TIKA_MIME_FILE
 
Constructor Summary
Metadata()
          Constructs a new, empty metadata.
 
Method Summary
 void add(java.lang.String name, java.lang.String value)
          Add a metadata name/value mapping.
 boolean equals(java.lang.Object o)
           
 java.lang.String get(Property property)
          Returns the value (if any) of the identified metadata property.
 java.lang.String get(java.lang.String name)
          Get the value associated to a metadata name.
 java.lang.String[] getValues(java.lang.String name)
          Get the values associated to a metadata name.
 boolean isMultiValued(java.lang.String name)
          Returns true if named value is multivalued.
 java.lang.String[] names()
          Returns an array of the names contained in the metadata.
 void remove(java.lang.String name)
          Remove a metadata and all its associated values.
 void set(Property property, java.lang.String value)
          Sets the value of the identified metadata property.
 void set(java.lang.String name, java.lang.String value)
          Set metadata name/value.
 void setAll(java.util.Properties properties)
          Copy All key-value pairs from properties.
 int size()
          Returns the number of metadata names in this metadata.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Metadata

public Metadata()
Constructs a new, empty metadata.

Method Detail

isMultiValued

public boolean isMultiValued(java.lang.String name)
Returns true if named value is multivalued.

Parameters:
name - name of metadata
Returns:
true is named value is multivalued, false if single value or null

names

public java.lang.String[] names()
Returns an array of the names contained in the metadata.

Returns:
Metadata names

get

public java.lang.String get(java.lang.String name)
Get the value associated to a metadata name. If many values are assiociated to the specified name, then the first one is returned.

Parameters:
name - of the metadata.
Returns:
the value associated to the specified metadata name.

get

public java.lang.String get(Property property)
Returns the value (if any) of the identified metadata property.

Parameters:
property - property definition
Returns:
property value, or null if the property is not set
Since:
Apache Tika 0.7

getValues

public java.lang.String[] getValues(java.lang.String name)
Get the values associated to a metadata name.

Parameters:
name - of the metadata.
Returns:
the values associated to a metadata name.

add

public void add(java.lang.String name,
                java.lang.String value)
Add a metadata name/value mapping. Add the specified value to the list of values associated to the specified metadata name.

Parameters:
name - the metadata name.
value - the metadata value.

setAll

public void setAll(java.util.Properties properties)
Copy All key-value pairs from properties.

Parameters:
properties - properties to copy from

set

public void set(java.lang.String name,
                java.lang.String value)
Set metadata name/value. Associate the specified value to the specified metadata name. If some previous values were associated to this name, they are removed.

Parameters:
name - the metadata name.
value - the metadata value.

set

public void set(Property property,
                java.lang.String value)
Sets the value of the identified metadata property.

Parameters:
property - property definition
value - property value
Since:
Apache Tika 0.7

remove

public void remove(java.lang.String name)
Remove a metadata and all its associated values.

Parameters:
name - metadata name to remove

size

public int size()
Returns the number of metadata names in this metadata.

Returns:
number of metadata names

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2007-2010 The Apache Software Foundation. All Rights Reserved.