edu.harvard.hul.ois.jhove
Class PropertyPath

java.lang.Object
  extended by edu.harvard.hul.ois.jhove.PropertyPath

public class PropertyPath
extends java.lang.Object

A description of the location of a Property in a RepInfo object. Properties can be nested under other properties, in lists, maps, or subproperties. This class provides a general way to specify their location. For the moment, only paths by name are fully supported.

Author:
Gary McGath

Constructor Summary
PropertyPath()
          No-argument constructor.
PropertyPath(PropertyPath path)
          Cloning constructor.
PropertyPath(java.lang.String[] pathArray)
          String array constructor.
 
Method Summary
 void addPropertyIndex(int idx)
          Adds an index to the path, for an indexed property.
 void addPropertyKey(java.lang.Object obj)
          Adds a key to the path, for a property map.
 void addPropertyName(java.lang.String str)
          Adds a property name to the path.
 Property locateProperty(RepInfo info)
          Walk down the path and return the specified Property.
 Property locateProperty(RepInfo info, boolean trace)
          Walk down the path and return the specified Property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyPath

public PropertyPath()
No-argument constructor. Creates an empty path.


PropertyPath

public PropertyPath(PropertyPath path)
Cloning constructor. This creates a new pathInfo list, whose elements are shared with the original PropertyPath's list.


PropertyPath

public PropertyPath(java.lang.String[] pathArray)
String array constructor. This allows creation of a path in a common and simple case: a hierarchy of named subproperties. It's the equivalent of creating an empty PropertyPath and then calling addElement successively with each of the strings in the array.

Method Detail

addPropertyName

public void addPropertyName(java.lang.String str)
Adds a property name to the path.


addPropertyKey

public void addPropertyKey(java.lang.Object obj)
Adds a key to the path, for a property map.


addPropertyIndex

public void addPropertyIndex(int idx)
Adds an index to the path, for an indexed property.


locateProperty

public Property locateProperty(RepInfo info)
Walk down the path and return the specified Property.

Parameters:
info - The RepInfo object to search
Returns:
The specified Property if found, otherwise null.

locateProperty

public Property locateProperty(RepInfo info,
                               boolean trace)
Walk down the path and return the specified Property.

Parameters:
info - The RepInfo object to search
trace - If true, write debugging information to standard output.
Returns:
The specified Property if found, otherwise null.