FileHandle, org.refcodes.mixin.CreatedDateAccessor, org.refcodes.mixin.ModifiedDateAccessor, org.refcodes.mixin.NameAccessor, org.refcodes.mixin.PathAccessor, org.refcodes.mixin.SizeAccessorFileHandleImpl.MutableFileHandleImplpublic class FileHandleImpl extends Object implements FileHandle
FileHandle,.| Modifier and Type | Class | Description |
|---|---|---|
class |
FileHandleImpl.MutableFileHandleImpl |
The implementation of a
FileHandle.MutableFileHandle.
-------------------------------------------------------------------------
CAUTION: fiddling with the path and the name attributes causes the
FileHandleImpl.MutableFileHandleImpl.hashCode() and FileHandleImpl.MutableFileHandleImpl.equals(Object) methods to change
behavior which can cause problems especially in collections! |
org.refcodes.mixin.CreatedDateAccessor.CreatedDateMutator, org.refcodes.mixin.CreatedDateAccessor.CreatedDatePropertyFileHandle.MutableFileHandleorg.refcodes.mixin.ModifiedDateAccessor.ModifiedDateMutator, org.refcodes.mixin.ModifiedDateAccessor.ModifiedDatePropertyorg.refcodes.mixin.NameAccessor.NameBuilder<B extends org.refcodes.mixin.NameAccessor.NameBuilder<B>>, org.refcodes.mixin.NameAccessor.NameMutator, org.refcodes.mixin.NameAccessor.NameProperty| Modifier and Type | Field | Description |
|---|---|---|
protected Date |
_createdDate |
|
protected Date |
_modifiedDate |
|
protected String |
_name |
|
protected String |
_path |
|
protected long |
_size |
| Constructor | Description |
|---|---|
FileHandleImpl(String aKey) |
Constructs a
FileHandle object with the given properties. |
FileHandleImpl(String aPath,
String aName) |
Constructs a
FileHandle object with the given properties. |
FileHandleImpl(String aPath,
String aName,
long aSize,
Date aCreatedDate,
Date aModifiedDate) |
Constructs a
FileHandle object with the given properties. |
FileHandleImpl(FileHandle aFileHandle) |
Constructs a
FileHandle object with the properties of the given
FileHandle. |
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
equals(Object obj) |
|
Date |
getCreatedDate() |
The date when the file was created.
|
Date |
getModifiedDate() |
The date when the file was modified.
|
String |
getName() |
The name is the part of the key without the path.
|
String |
getPath() |
The path is the part of the key without the name.
|
long |
getSize() |
The size of the content of the file.
|
int |
hashCode() |
|
String |
toKey() |
The key is the fully qualified name to identify the file.
|
FileHandle.MutableFileHandle |
toMutableFileHandle() |
Converts the give
FileHandle to a FileHandle.MutableFileHandle. |
protected String _path
protected String _name
protected long _size
protected Date _createdDate
protected Date _modifiedDate
public FileHandleImpl(String aPath, String aName, long aSize, Date aCreatedDate, Date aModifiedDate)
FileHandle object with the given properties.aPath - The path to which the file handle points.aName - The name to which the path pointsaSize - The size of the fileaCreatedDate - The creation date of the fileaModifiedDate - The modified date of the filepublic FileHandleImpl(String aKey)
FileHandle object with the given properties.aKey - The path and the name (= the key) to which the file handle
points.public FileHandleImpl(String aPath, String aName)
FileHandle object with the given properties.aPath - The path to which the file handle points.aName - The name to which the path pointspublic FileHandleImpl(FileHandle aFileHandle)
FileHandle object with the properties of the given
FileHandle.aFileHandle - The FileHandle from which to take the required
properties.public String getPath()
FileSystem.PATH_DELIMITER attribute.getPath in interface FileHandlegetPath in interface org.refcodes.mixin.PathAccessorpublic String getName()
FileSystem.PATH_DELIMITER attribute.getName in interface FileHandlegetName in interface org.refcodes.mixin.NameAccessorpublic String toKey()
toKey in interface FileHandlepublic long getSize()
getSize in interface FileHandlegetSize in interface org.refcodes.mixin.SizeAccessorpublic Date getCreatedDate()
getCreatedDate in interface org.refcodes.mixin.CreatedDateAccessorgetCreatedDate in interface FileHandlepublic Date getModifiedDate()
getModifiedDate in interface FileHandlegetModifiedDate in interface org.refcodes.mixin.ModifiedDateAccessorpublic FileHandle.MutableFileHandle toMutableFileHandle()
FileHandle to a FileHandle.MutableFileHandle. The
mutable FileHandle allows the modification of (fiddling around
with) attributes.
-------------------------------------------------------------------------
ATTENTION: Usually fiddling around with attributes is not necessary, as
the FileSystem itself provides the sufficient functionality to
work with files. In some cases though this might be necessary: This
method is being provided to allow modification of file attributes while
making sure that the FileHandle itself creates a copy so that any
additional attributes provided by extensions of this interface of whom
the developer does not know (yet) are preserved. So extensions of the
FileHandle know how to create a FileHandle.MutableFileHandle without
information loss, the business logic does not require to take care of any
yet unknown extensions.
-------------------------------------------------------------------------
CAUTION: Working with modified FileHandles on the
FileSystem can cause unexpected (severe) behavior (data loss), so
we assume that you know what you do when using the
FileHandle.MutableFileHandle!
-------------------------------------------------------------------------
Use FileHandle.MutableFileHandle.toFileHandle() to get back to a
FileHandle to avoid hassle with collections, the
Object.hashCode() and the Object.equals(Object)
operations.toMutableFileHandle in interface FileHandleCopyright © 2018. All rights reserved.