com.google.gdata.model
Class Path.Builder

java.lang.Object
  extended by com.google.gdata.model.Path.Builder
Enclosing class:
Path

public static class Path.Builder
extends java.lang.Object

The Builder class provides a model for incrementally constructing new Path relative or absolute instances.


Method Summary
 boolean addIfAttribute(QName id)
          Conditionally adds a new attribute path step.
 boolean addIfElement(QName id)
          Conditionally adds a new element path step.
 Path.Builder addStep(MetadataKey<?> step)
          Adds a new path step to the end of the path.
 Path build()
          Returns a new Path instance based upon the current state of the builder.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addStep

public Path.Builder addStep(MetadataKey<?> step)
Adds a new path step to the end of the path. If the path is absolute the step will be validated against the element type currently selected by the path. If the step parameter is an ElementKey, then the step will be valid if there is a child element type with the same QName. If the step parameter is an AttributeKey, then it will be valid if there is a matching child attribute type with the same QName. If invalid, a PathException will be thrown. No validation is performed for relative paths.

Parameters:
step - metadata key for new path step
Throws:
PathException - if this path has been bound to a metadata instance and no key with the given step can be found, or if the path is an attribute path. Once a path has an attribute key no more steps may be added.

addIfElement

public boolean addIfElement(QName id)
Conditionally adds a new element path step. For absolute paths, it will be added if the QName matches a valid child element type for the current selected element. If the path is relative a new ElementKey step corresponding to the name will be unconditionally added.

Parameters:
id - qualified name of child element step to add
Returns:
true if added successfully, false otherwise.
Throws:
PathException - if this path is an attribute path. Once a path has an attribute key no more steps may be added.

addIfAttribute

public boolean addIfAttribute(QName id)
Conditionally adds a new attribute path step. For absolute paths, it will be added if the QName matches a valid child attribute type for the current selected element. If the path is relative a new ElementKey step corresponding to the name will be unconditionally added.

Parameters:
id - qualified name of child attribute step to add
Returns:
true if added successfully, false otherwise.
Throws:
PathException - if this path is an attribute path. Once a path has an attribute key no more steps may be added.

build

public Path build()
Returns a new Path instance based upon the current state of the builder.