public class FileHandleImpl extends Object implements FileHandle
FileHandle
,.Modifier and Type | Class and Description |
---|---|
class |
FileHandleImpl.MutableFileHandleImpl
The implementation of a
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! |
FileHandle.MutableFileHandle
org.refcodes.mixin.PathAccessor.PathBuilder<B extends org.refcodes.mixin.PathAccessor.PathBuilder<?>>, org.refcodes.mixin.PathAccessor.PathMutator, org.refcodes.mixin.PathAccessor.PathProperty
org.refcodes.mixin.NameAccessor.NameBuilder<B extends org.refcodes.mixin.NameAccessor.NameBuilder<B>>, org.refcodes.mixin.NameAccessor.NameMutator, org.refcodes.mixin.NameAccessor.NameProperty
org.refcodes.mixin.SizeAccessor.SizeMutator, org.refcodes.mixin.SizeAccessor.SizeProperty
Modifier and Type | Field and Description |
---|---|
protected Date |
_createdDate |
protected Date |
_modifiedDate |
protected String |
_name |
protected String |
_path |
protected long |
_size |
Constructor and Description |
---|
FileHandleImpl(FileHandle aFileHandle)
Constructs a
FileHandle object with the properties of the given
FileHandle . |
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. |
Modifier and Type | Method and 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 FileHandle
getPath
in interface org.refcodes.mixin.PathAccessor
public String getName()
FileSystem.PATH_DELIMITER
attribute.getName
in interface FileHandle
getName
in interface org.refcodes.mixin.NameAccessor
public String toKey()
toKey
in interface FileHandle
public long getSize()
getSize
in interface FileHandle
getSize
in interface org.refcodes.mixin.SizeAccessor
public Date getCreatedDate()
getCreatedDate
in interface FileHandle
getCreatedDate
in interface org.refcodes.mixin.CreatedDateAccessor
public Date getModifiedDate()
getModifiedDate
in interface FileHandle
getModifiedDate
in interface org.refcodes.mixin.ModifiedDateAccessor
public 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 FileHandle
s 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 FileHandle
Copyright © 2017. All rights reserved.