org.apache.nutch.metadata

## Class Metadata

- java.lang.Object
- - org.apache.nutch.metadata.Metadata

- All Implemented Interfaces:
    Writable, CreativeCommons, DublinCore, Feed, HttpHeaders, Nutch
  Direct Known Subclasses:
    SpellCheckedMetadata

      public class Metadata
      extends java.lang.Object
      implements Writable, CreativeCommons, DublinCore, HttpHeaders, Nutch, Feed

  A multi-valued metadata container.

- - ### Field Summary

    - ### Fields inherited from interface org.apache.nutch.metadata.CreativeCommons

      `LICENSE_LOCATION, LICENSE_URL, WORK_TYPE`

    - ### Fields inherited from interface org.apache.nutch.metadata.DublinCore

      `CONTRIBUTOR, COVERAGE, CREATOR, DATE, DESCRIPTION, FORMAT, IDENTIFIER, LANGUAGE, MODIFIED, PUBLISHER, RELATION, RIGHTS, SOURCE, SUBJECT, TITLE, TYPE`

    - ### Fields inherited from interface org.apache.nutch.metadata.HttpHeaders

      `CLIENT_TRANSFER_ENCODING, CONTENT_DISPOSITION, CONTENT_ENCODING, CONTENT_LANGUAGE, CONTENT_LENGTH, CONTENT_LOCATION, CONTENT_MD5, CONTENT_TYPE, IF_MODIFIED_SINCE, LAST_MODIFIED, LOCATION, TRANSFER_ENCODING, USER_AGENT, WRITABLE_CONTENT_TYPE`

    - ### Fields inherited from interface org.apache.nutch.metadata.Nutch

      `ARG_CRAWLDB, ARG_HOSTDB, ARG_LINKDB, ARG_SEEDDIR, ARG_SEEDNAME, ARG_SEGMENTDIR, ARG_SEGMENTS, CACHING_FORBIDDEN_ALL, CACHING_FORBIDDEN_CONTENT, CACHING_FORBIDDEN_KEY, CACHING_FORBIDDEN_NONE, CHAR_ENCODING_FOR_CONVERSION, CRAWL_ID_KEY, FETCH_EVENT_CONTENTLANG, FETCH_EVENT_CONTENTTYPE, FETCH_EVENT_FETCHTIME, FETCH_EVENT_SCORE, FETCH_EVENT_TITLE, FETCH_STATUS_KEY, FETCH_TIME_KEY, FIXED_INTERVAL_KEY, GENERATE_TIME_KEY, ORIGINAL_CHAR_ENCODING, PROTO_STATUS_KEY, PROTOCOL_STATUS_CODE_KEY, REPR_URL_KEY, SCORE_KEY, SEGMENT_NAME_KEY, SIGNATURE_KEY, STAT_PROGRESS, VAL_RESULT, WRITABLE_FIXED_INTERVAL_KEY, WRITABLE_GENERATE_TIME_KEY, WRITABLE_PROTO_STATUS_KEY, WRITABLE_REPR_URL_KEY`

    - ### Fields inherited from interface org.apache.nutch.metadata.Feed

      `FEED, FEED_AUTHOR, FEED_PUBLISHED, FEED_TAGS, FEED_UPDATED`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Metadata()` Constructs a new, empty metadata.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(java.lang.String name, java.lang.String value)` Add a metadata name/value mapping.
    `void` | `addAll(Metadata metadata)` Add all name/value mappings (merge two metadata mappings).
    `void` | `clear()` Remove all mappings from metadata.
    `boolean` | `equals(java.lang.Object o)`
    `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` | `readFields(java.io.DataInput in)`
    `void` | `remove(java.lang.String name)` Remove a metadata and all its associated values.
    `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()`
    `void` | `write(java.io.DataOutput out)`

    - ### 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.

    - #### 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.

    - #### addAll

          public void addAll(Metadata metadata)

      Add all name/value mappings (merge two metadata mappings). If a name already exists in current metadata the values are added to existing values.
      Parameters:
        `metadata` - other Metadata to be merged

    - #### 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.

    - #### 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

    - #### clear

          public void clear()

      Remove all mappings from metadata.

    - #### 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`

    - #### write

          public final void write(java.io.DataOutput out)
                           throws java.io.IOException

      Specified by:
        `write` in interface `Writable`
      Throws:
        `java.io.IOException`

    - #### readFields

          public final void readFields(java.io.DataInput in)
                                throws java.io.IOException

      Specified by:
        `readFields` in interface `Writable`
      Throws:
        `java.io.IOException`

Copyright © 2019 The Apache Software Foundation