org.favabeans.file
Class IdentityFile
java.lang.Object
|
+--org.favabeans.file.IdentityFile
- All Implemented Interfaces:
- Faceted
- Direct Known Subclasses:
- IdentityDataFile, IdentityDirectory
- public class IdentityFile
- extends Object
- implements Faceted
An IdentityFile
is an convenience wrapper around a
File
. Unlike File
, it preserves its
identity despite changes of name and movements from one containing
directory to another. The underlying File
representing the current path of this object is always available
via the methods of this class, but may change during its lifetime.
getFacet
public Facet getFacet(Type type)
- Description copied from interface:
Faceted
- Obtain a
Facet
of the requested Type
for this object.
- Specified by:
getFacet
in interface Faceted
- Following copied from interface:
org.favabeans.base.Faceted
- Parameters:
type
- the Type
of Facet
requested for this object.- Returns:
- a
Facet
, or null
if none can
be created as requested.
exists
public boolean exists()
getParent
public IdentityDirectory getParent()
setParent
public void setParent(IdentityDirectory parent)
throws FileOperationException
getName
public String getName()
setName
public void setName(String name)
throws FileOperationException
getPath
public String getPath()
getFileRepresentation
public File getFileRepresentation()
moveTo
public boolean moveTo(IdentityDirectory directory)
throws FileOperationException
- Move this file into the specified directory.
- Parameters:
directory
- the directory into which the file is to be moved.- Returns:
true
if the file was moved, or
false
if the file was already in the specified
directory and was therefore not moved.- Throws:
FileOperationException
- if the specified directory
already contains a file with the same name, or if there was a
problem in the File
operations involved in
renaming the file.RuntimeException
- if an irrecoverable logic error
occurred.
delete
public void delete()
throws FileOperationException
- Delete this file.
- Throws:
FileOperationException
- if the file could not be
deleted.RuntimeException
- if an irrecoverable logic error
occurred.
isReadable
public boolean isReadable()
isWriteable
public boolean isWriteable()
isHidden
public boolean isHidden()
getLastModified
public Date getLastModified()
toString
public String toString()
- Overrides:
toString
in class Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
equals
public boolean equals(Object x)
- Overrides:
equals
in class Object
addPropertyChangeListener
public void addPropertyChangeListener(String propertyName,
PropertyChangeListener l)
removePropertyChangeListener
public void removePropertyChangeListener(String propertyName,
PropertyChangeListener l)
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener l)
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener l)
addFileListener
public void addFileListener(FileListener l)
removeFileListener
public void removeFileListener(FileListener l)
updateFileRepresentation
protected void updateFileRepresentation()
firePropertyChange
protected void firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
fireFileContentsChanged
protected void fireFileContentsChanged()
fireFileDeleted
protected void fireFileDeleted()
fireStateChanged
protected void fireStateChanged()
Copyright © 2000-2001, Regents of the University of Minnesota. All Rights Reserved.