com.google.gdata.model
Class MetadataValueTransform

java.lang.Object
  extended by com.google.gdata.model.MetadataValueTransform
All Implemented Interfaces:
Metadata.VirtualValue

public class MetadataValueTransform
extends java.lang.Object
implements Metadata.VirtualValue

This class represents a transformation of a value based on a list of keys to use as the value for the element. During generation this will check each of the source keys for a value, using the first value found. During parsing it will place the incoming value into the first key in the list.


Constructor Summary
MetadataValueTransform(MetadataKey<?>... inputSources)
          Constructs a simple value transform using the given sources.
 
Method Summary
 java.lang.Object generate(Element element, ElementMetadata<?,?> metadata)
          Runs this transformation on the given element.
 void parse(Element element, ElementMetadata<?,?> metadata, java.lang.Object value)
          For parsing, we always parse directly into the first source.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetadataValueTransform

public MetadataValueTransform(MetadataKey<?>... inputSources)
Constructs a simple value transform using the given sources.

Parameters:
inputSources - the source keys to pull the values from.
Method Detail

generate

public java.lang.Object generate(Element element,
                                 ElementMetadata<?,?> metadata)
Runs this transformation on the given element.

Specified by:
generate in interface Metadata.VirtualValue
Parameters:
element - the element to transform.
metadata - the metadata of the element being transformed.
Returns:
the String representation of the property value.

parse

public void parse(Element element,
                  ElementMetadata<?,?> metadata,
                  java.lang.Object value)
           throws ParseException
For parsing, we always parse directly into the first source.

Specified by:
parse in interface Metadata.VirtualValue
Throws:
ParseException - if parsing fails.