Extension SDK 10.1.2

oracle.ide.net
Class FilePath

java.lang.Object
  extended byoracle.ide.model.DefaultSubDirtyable
      extended byoracle.ide.net.FilePath
All Implemented Interfaces:
Copyable, Dirtyable, SubDirtyable

public class FilePath
extends DefaultSubDirtyable
implements Copyable

An instance of FilePath represents a path that is made up entire of Files. Use of FilePath should be limited to classes or tools that absolutely require that the path (whether class path, source path, doc path, etc.) operate only on resources that are accessible through the local machine's file system (e.g. physically local files, NFS-mounted files, files mounted via virtual file systems, etc.).

In order to support functionality that is available through the URLFileSystem, developers should give preference to using URLPath instead of FilePath whenever possible, since code written using FilePath will not interoperate with the variety of URL protocols that are integrated now and in the future.


Constructor Summary
FilePath()
          Creates a FilePath that is initially empty.
FilePath(java.io.File entry)
          Creates a FilePath that initially contains the specified File as its sole entry.
FilePath(java.io.File[] entries)
          Creates a FilePath initialized with the specified array of File objects.
FilePath(FilePath filePath)
          Copy constructor.
 
Method Summary
 void addEntries(java.io.File[] entries)
          Adds the given File objects in order to the end of the FilePath.
 void addEntries(FilePath filePath)
          Adds the entries from the specified FilePath to this instance.
 void addEntry(java.io.File entry)
          Adds the given File to the end of the FilePath, if it is not already on the FilePath.
 java.lang.Object copyTo(java.lang.Object object)
          Copies the internal state of this object to the specified copy.
protected  void copyToImpl(FilePath copy)
          Design pattern for supporting strongly typed copying.
 boolean equals(java.lang.Object o)
           
protected  boolean equalsImpl(FilePath filePath)
          This is a helper method for equals(Object) that can also be used by subclasses that implement equals(Object).
 java.io.File[] getEntries()
          Returns the path represented by this FilePath instance as an array of Files.
protected  java.util.List getEntriesListDirectly()
          This accessor is intended to support subclass extension of FilePath behavior by providing direct access to the List used to hold the FilePath data.
static FilePath newFilePathFromString(java.lang.String entries)
          Factory method that creates a new FilePath from a String representing the path entries.
 void setEntries(java.io.File[] entries)
          Sets the path represented by this FilePath instance to be equivalent to the specified array of Files.
 java.lang.String toString()
           
 URLPath toURLPath()
          Produces an URLPath that represents a path that is equivalent to this FilePath.
 
Methods inherited from class oracle.ide.model.DefaultSubDirtyable
getOwner, isDirty, markDirty, setOwner
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FilePath

public FilePath()
Creates a FilePath that is initially empty.


FilePath

public FilePath(java.io.File entry)
Creates a FilePath that initially contains the specified File as its sole entry. If the entry is null, then the FilePath created is initially empty.


FilePath

public FilePath(java.io.File[] entries)
Creates a FilePath initialized with the specified array of File objects. If the entries array is null or empty, then the FilePath created is initially empty.


FilePath

public FilePath(FilePath filePath)
Copy constructor.

Method Detail

copyTo

public java.lang.Object copyTo(java.lang.Object object)
Description copied from interface: Copyable
Copies the internal state of this object to the specified copy. If copy is null, then this method should create a new instance of this class and proceed to copy the internal state to the newly created object. Generally, only the persistent state of the object should be copied, but whether or not it is appropriate to copy transient properties is at the discretion of the individual implementor.

Regardless of whether the copy occurs to an existing object or to a newly created object, the return value is object to which this object's state was copied.

There is a standard implementation pattern for the copyTo method that helps avoid problems that arise when a Copyable object is subclassed. The pattern is:

public Object copyTo( Object target )
{
final <this_class> copy =
target != null ? (<this_class>) target : new <this_class>();
copyToImpl( copy );
return copy;
} protected final void copyToImpl( <this_class> copy ) { super.copyToImpl( copy ); // if necessary // put code here for copying the properties of <this_class> }
The parameter passed into the copyToImpl method is the same type of this class. The responsibility of copyToImpl is to copy the state of this class through direct access of the fields. The copyToImpl method should not use getters and setters since these may be overridden, causing the state of this class to be incompletely copied.

Specified by:
copyTo in interface Copyable
Parameters:
object - The target object to which the state of this object should be copied. If target is null, then the copyTo method will return a new instance of this class.
Returns:
The object to which the state of this object was copied. If the target was non-null, then the return value is the same as the target object that was passed in; otherwise, the return value is a new instance of this class.

copyToImpl

protected final void copyToImpl(FilePath copy)
Design pattern for supporting strongly typed copying.


getEntries

public java.io.File[] getEntries()
Returns the path represented by this FilePath instance as an array of Files. If the FilePath is empty, then then this method returns a File array of size 0.


setEntries

public void setEntries(java.io.File[] entries)
Sets the path represented by this FilePath instance to be equivalent to the specified array of Files. If the argument is null, then the FilePath is cleared; subsequent calls to getEntries() would then return an empty File array.


equals

public boolean equals(java.lang.Object o)

equalsImpl

protected final boolean equalsImpl(FilePath filePath)
This is a helper method for equals(Object) that can also be used by subclasses that implement equals(Object). It assumes that the argument is not null.


toString

public java.lang.String toString()

addEntry

public void addEntry(java.io.File entry)
Adds the given File to the end of the FilePath, if it is not already on the FilePath. If the parameter is null, then this method returns without doing anything.


addEntries

public void addEntries(java.io.File[] entries)
Adds the given File objects in order to the end of the FilePath. Each File is added only if it is not already on the FilePath. Any null entries are ignored. If the entries array itself is null, then this method returns without doing anything.


addEntries

public void addEntries(FilePath filePath)
Adds the entries from the specified FilePath to this instance.


toURLPath

public URLPath toURLPath()
Produces an URLPath that represents a path that is equivalent to this FilePath.


newFilePathFromString

public static FilePath newFilePathFromString(java.lang.String entries)
Factory method that creates a new FilePath from a String representing the path entries. The specified entries must use File.pathSeparator to separate path elements and File.separator within each path element. That is, the specified entries should be expressed in the platform-specific notation of the current Java VM.


getEntriesListDirectly

protected final java.util.List getEntriesListDirectly()
This accessor is intended to support subclass extension of FilePath behavior by providing direct access to the List used to hold the FilePath data.


Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.