org.apache.nutch.metadata

## Class MetaWrapper

- java.lang.Object
- - org.apache.hadoop.io.GenericWritable
  - - org.apache.nutch.util.GenericWritableConfigurable
    - - org.apache.nutch.crawl.NutchWritable
      - - org.apache.nutch.metadata.MetaWrapper

- All Implemented Interfaces:
    Configurable, Writable

      public class MetaWrapper
      extends NutchWritable

  This is a simple decorator that adds metadata to any Writable-s that can be serialized by `NutchWritable`. This is useful when data needs to be temporarily enriched during processing, but this temporary metadata doesn't need to be permanently stored after the job is done.
  Author:
    Andrzej Bialecki

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MetaWrapper()`
    `MetaWrapper(Metadata metadata, Writable instance, Configuration conf)`
    `MetaWrapper(Writable instance, Configuration conf)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addMeta(java.lang.String name, java.lang.String value)` Add metadata.
    `java.lang.String` | `getMeta(java.lang.String name)` Get metadata.
    `Metadata` | `getMetadata()` Get all metadata.
    `java.lang.String[]` | `getMetaValues(java.lang.String name)` Get multiple metadata.
    `void` | `readFields(java.io.DataInput in)`
    `void` | `setMeta(java.lang.String name, java.lang.String value)` Set metadata.
    `void` | `write(java.io.DataOutput out)`

    - ### Methods inherited from class org.apache.nutch.crawl.NutchWritable

      `getTypes`

    - ### Methods inherited from class org.apache.nutch.util.GenericWritableConfigurable

      `getConf, setConf`

    - ### Methods inherited from class org.apache.hadoop.io.GenericWritable

      `get, set, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### MetaWrapper

          public MetaWrapper()

    - #### MetaWrapper

          public MetaWrapper(Writable instance,
                             Configuration conf)

    - #### MetaWrapper

          public MetaWrapper(Metadata metadata,
                             Writable instance,
                             Configuration conf)

  - ### Method Detail

    - #### getMetadata

          public Metadata getMetadata()

      Get all metadata.

    - #### addMeta

          public void addMeta(java.lang.String name,
                              java.lang.String value)

      Add metadata. See `Metadata.add(String, String)` for more information.
      Parameters:
        `name` - metadata name
        `value` - metadata value

    - #### setMeta

          public void setMeta(java.lang.String name,
                              java.lang.String value)

      Set metadata. See `Metadata.set(String, String)` for more information.
      Parameters:
        `name` -
        `value` -

    - #### getMeta

          public java.lang.String getMeta(java.lang.String name)

      Get metadata. See `Metadata.get(String)` for more information.
      Parameters:
        `name` -
      Returns:
        metadata value

    - #### getMetaValues

          public java.lang.String[] getMetaValues(java.lang.String name)

      Get multiple metadata. See `Metadata.getValues(String)` for more information.
      Parameters:
        `name` -
      Returns:
        multiple values

    - #### readFields

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

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

    - #### write

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

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

Copyright © 2019 The Apache Software Foundation