FileDocCategorySizeDatePackage
DocumentDescriptor.javaAPI DocApache Poi 3.0.13243Mon Jan 01 12:39:34 GMT 2007org.apache.poi.poifs.filesystem

DocumentDescriptor

public class DocumentDescriptor extends Object
Class DocumentDescriptor
author
Marc Johnson (mjohnson at apache dot org)
version
%I%, %G%

Fields Summary
private POIFSDocumentPath
path
private String
name
private int
hashcode
Constructors Summary
public DocumentDescriptor(POIFSDocumentPath path, String name)
Trivial constructor

param
path the Document path
param
name the Document name


                     

          
    
        if (path == null)
        {
            throw new NullPointerException("path must not be null");
        }
        if (name == null)
        {
            throw new NullPointerException("name must not be null");
        }
        if (name.length() == 0)
        {
            throw new IllegalArgumentException("name cannot be empty");
        }
        this.path = path;
        this.name = name;
    
Methods Summary
public booleanequals(java.lang.Object o)
equality. Two DocumentDescriptor instances are equal if they have equal paths and names

param
o the object we're checking equality for
return
true if the object is equal to this object

        boolean rval = false;

        if ((o != null) && (o.getClass() == this.getClass()))
        {
            if (this == o)
            {
                rval = true;
            }
            else
            {
                DocumentDescriptor descriptor = ( DocumentDescriptor ) o;

                rval = this.path.equals(descriptor.path)
                       && this.name.equals(descriptor.name);
            }
        }
        return rval;
    
public inthashCode()
calculate and return the hashcode

return
hashcode

        if (hashcode == 0)
        {
            hashcode = path.hashCode() ^ name.hashCode();
        }
        return hashcode;
    
public java.lang.StringtoString()

        StringBuffer buffer = new StringBuffer(40 * (path.length() + 1));

        for (int j = 0; j < path.length(); j++)
        {
            buffer.append(path.getComponent(j)).append("/");
        }
        buffer.append(name);
        return buffer.toString();