|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.schmant.support.AbstractArgumentChecker
org.schmant.support.FutureEntity
public class FutureEntity
An instance of this class represents the location of a future entity (a file
or directory). It is often used to instruct process tasks
where they should put their results.
It can also be used when configuring the source
of an
action task if the source entity has not been created
yet when the task is configured.
Objects of this type are immutable. Once they are created, they cannot be modified.
This object is thread-safe. It can safely be used by concurrent threads without any synchronizing in the client code.
Constructor Summary | |
---|---|
FutureEntity(DirectoryView base,
RelativeLocation loc)
Create a FutureEntity as a (perhaps future) entity with the
supplied location relative to an existing directory. |
|
FutureEntity(DirectoryView parentDir,
String name)
Create a FutureEntity as a (perhaps future) entity in an existing
parent directory. |
|
FutureEntity(EntityView ent)
Create a FutureEntity representing an entity that exists now. |
|
FutureEntity(File f)
Create a FutureEntity representing a File path in the
file system. |
Method Summary | |
---|---|
boolean |
exists()
Does the entity represented by this future entity exist? |
DirectoryView |
getBaseDirectory()
Get the base directory for this future entity. |
DirectoryView |
getDirectory()
Get the directory referenced by this future entity, possibly creating it if it does not already exist. |
EntityView |
getEntity()
Get the entity represented by this future entity. |
EntityView |
getEntityOrNull()
Get the entity represented by this future entity, returning null
if the entity does not exist. |
EFile |
getFile()
Get the file referenced by this future entity, possibly creating it if it does not already exist. |
File |
getFileObject()
Get the File object referencing the future entity. |
protected RelativeLocation |
getLocation()
Return the future entity's location relative to the base directory. |
String |
getName()
Get the name of the future entity. |
DirectoryView |
getParent()
Get the parent directory of the future entity. |
DirectoryView |
getParentOrNull()
Get the parent directory of the future entity. |
RelativeLocation |
getRelativeLocation()
Get the future entity's location relative to its base directory. |
boolean |
isExistingDirectory()
Does this future entity reference an existing directory? |
boolean |
isExistingFile()
Does this future entity reference an existing file? |
String |
toString()
|
Methods inherited from class org.schmant.support.AbstractArgumentChecker |
---|
check, check, check, check |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FutureEntity(DirectoryView parentDir, String name)
FutureEntity
as a (perhaps future) entity in an existing
parent directory.
parentDir
- The parent directory.name
- The entity's namepublic FutureEntity(DirectoryView base, RelativeLocation loc)
FutureEntity
as a (perhaps future) entity with the
supplied location relative to an existing directory.
base
- An existing directory.loc
- The entity's location relative to the directory.public FutureEntity(EntityView ent)
FutureEntity
representing an entity that exists now. The
created future entity does not represent the supplied entity, rather the
supplied entity's parent and its name. So, if the entity is deleted this
is still a valid future entity.
ent
- An existing entity.public FutureEntity(File f)
FutureEntity
representing a File
path in the
file system. When any of the getter methods are called on this object, a
temporary read/write file system containing the entity's parent directory
and the entity (unless the entity itself is the root directory), is
returned.
f
- The file path for the future entity.Method Detail |
---|
public DirectoryView getParent()
This method is protected by the object's intrinsic lock (synchronized). If it creates the parent directory, it will also acquire temporary locks on the directories it needs to lock in order to do that.
null
public DirectoryView getParentOrNull()
null
.
null
public DirectoryView getBaseDirectory()
null
if the future
entity references the root directory of a file system.public RelativeLocation getRelativeLocation()
null
if the future entity
references the root directory of a file system.public String getName()
protected RelativeLocation getLocation()
null
.public EntityView getEntity() throws FutureEntityNotCreatedYetException
FutureEntityNotCreatedYetException
- If the entity does not exist.public EntityView getEntityOrNull()
null
if the entity does not exist.
null
.public boolean exists()
true
if the entity exists, false
if not.public boolean isExistingDirectory()
true
if this future entity references an already existing
directory.public boolean isExistingFile()
true
if this future entity references an already existing
file.public EFile getFile() throws WrongEntityTypeException
WrongEntityTypeException
- If the future entity references an
existing directory.getDirectory()
public File getFileObject()
File
object referencing the future entity. If the entity
does not exist, a File
object referencing the future entity's
location is returned without creating the entity.
The future entity must be in a File
-backed file system.
File
referencing the future entity's location.public DirectoryView getDirectory() throws WrongEntityTypeException
WrongEntityTypeException
- If the future entity references an
existing file.getFile()
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |