public static class

Path.Builder

extends Object
java.lang.Object
   ↳ com.google.gdata.model.Path.Builder

Class Overview

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

Summary

Fields
private ElementMetadata<?, ?> root
private AttributeMetadata<?> selectedAttribute
private ElementMetadata<?, ?> selectedElement
private boolean selectsAttribute
private List<MetadataKey<?>> steps
Public Methods
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.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

private ElementMetadata<?, ?> root

private AttributeMetadata<?> selectedAttribute

private ElementMetadata<?, ?> selectedElement

private boolean selectsAttribute

private List<MetadataKey<?>> steps

Public Methods

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.

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.

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.

public Path build ()

Returns a new Path instance based upon the current state of the builder.