Module org.refcodes.filesystem
Package org.refcodes.filesystem
Class FileHandleImpl.MutableFileHandleImpl
java.lang.Object
org.refcodes.filesystem.FileHandleImpl
org.refcodes.filesystem.FileHandleImpl.MutableFileHandleImpl
- All Implemented Interfaces:
FileHandle
,FileHandle.MutableFileHandle
,FileSizeAccessor
,FileSizeAccessor.FileSizeMutator
,FileSizeAccessor.FileSizeProperty
,org.refcodes.mixin.CreatedDateAccessor
,org.refcodes.mixin.CreatedDateAccessor.CreatedDateMutator
,org.refcodes.mixin.CreatedDateAccessor.CreatedDateProperty
,org.refcodes.mixin.ModifiedDateAccessor
,org.refcodes.mixin.ModifiedDateAccessor.ModifiedDateMutator
,org.refcodes.mixin.ModifiedDateAccessor.ModifiedDateProperty
,org.refcodes.mixin.NameAccessor
,org.refcodes.mixin.NameAccessor.NameMutator
,org.refcodes.mixin.NameAccessor.NameProperty
,org.refcodes.mixin.PathAccessor
,org.refcodes.mixin.PathAccessor.PathMutator
,org.refcodes.mixin.PathAccessor.PathProperty
- Enclosing class:
- FileHandleImpl
public class FileHandleImpl.MutableFileHandleImpl
extends FileHandleImpl
implements FileHandle.MutableFileHandle
The implementation of a
FileHandle.MutableFileHandle
.
-------------------------------------------------------------------------
CAUTION: fiddling with the path and the name attributes causes the
hashCode()
and equals(Object)
methods to change
behavior which can cause problems especially in collections!
-------------------------------------------------------------------------
ATTENTION: In order to avoid the above mentioned problems with the
equals(Object)
and hashCode()
methods, use
toFileHandle()
before storing a FileHandle.MutableFileHandle
in a
collection.-
Nested Class Summary
Nested classes/interfaces inherited from class org.refcodes.filesystem.FileHandleImpl
FileHandleImpl.MutableFileHandleImpl
Nested classes/interfaces inherited from interface org.refcodes.mixin.CreatedDateAccessor
org.refcodes.mixin.CreatedDateAccessor.CreatedDateMutator, org.refcodes.mixin.CreatedDateAccessor.CreatedDateProperty
Nested classes/interfaces inherited from interface org.refcodes.filesystem.FileHandle
FileHandle.MutableFileHandle
Nested classes/interfaces inherited from interface org.refcodes.filesystem.FileSizeAccessor
FileSizeAccessor.FileSizeMutator, FileSizeAccessor.FileSizeProperty
Nested classes/interfaces inherited from interface org.refcodes.mixin.ModifiedDateAccessor
org.refcodes.mixin.ModifiedDateAccessor.ModifiedDateMutator, org.refcodes.mixin.ModifiedDateAccessor.ModifiedDateProperty
Nested classes/interfaces inherited from interface org.refcodes.mixin.NameAccessor
org.refcodes.mixin.NameAccessor.NameBuilder<B extends org.refcodes.mixin.NameAccessor.NameBuilder<B>>, org.refcodes.mixin.NameAccessor.NameMutator, org.refcodes.mixin.NameAccessor.NameProperty
Nested classes/interfaces inherited from interface org.refcodes.mixin.PathAccessor
org.refcodes.mixin.PathAccessor.PathBuilder<B extends org.refcodes.mixin.PathAccessor.PathBuilder<?>>, org.refcodes.mixin.PathAccessor.PathMutator, org.refcodes.mixin.PathAccessor.PathProperty
-
Field Summary
Fields inherited from class org.refcodes.filesystem.FileHandleImpl
_createdDate, _modifiedDate, _name, _path, _size
-
Constructor Summary
ConstructorDescriptionMutableFileHandleImpl
(String aPath, String aName, long aSize, Date aCreatedDate, Date aModifiedDate) Instantiates a new mutable file handle impl.MutableFileHandleImpl
(FileHandle aFileHandle) Instantiates a new mutable file handle impl. -
Method Summary
Modifier and TypeMethodDescriptionboolean
int
hashCode()
void
setCreatedDate
(Date aCreatedDate) void
setFileSize
(long aSize) Sets the size for the size property.void
setModifiedDate
(Date aModifiedDate) void
void
Converts theFileHandle.MutableFileHandle
back to aFileHandle
to avoid hassle with collections, theObject.hashCode()
and theObject.equals(Object)
operations.Methods inherited from class org.refcodes.filesystem.FileHandleImpl
getCreatedDate, getFileSize, getModifiedDate, getName, getPath, toKey, toMutableFileHandle
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.refcodes.mixin.CreatedDateAccessor.CreatedDateProperty
letCreatedDate
Methods inherited from interface org.refcodes.filesystem.FileHandle
getCreatedDate, getFileSize, getModifiedDate, getName, getPath, toKey, toMutableFileHandle
Methods inherited from interface org.refcodes.filesystem.FileSizeAccessor.FileSizeProperty
letFileSize
Methods inherited from interface org.refcodes.mixin.ModifiedDateAccessor.ModifiedDateProperty
letModifiedDate
Methods inherited from interface org.refcodes.mixin.NameAccessor.NameProperty
letName
Methods inherited from interface org.refcodes.mixin.PathAccessor.PathProperty
letPath
-
Constructor Details
-
MutableFileHandleImpl
public MutableFileHandleImpl(String aPath, String aName, long aSize, Date aCreatedDate, Date aModifiedDate) Instantiates a new mutable file handle impl.- Parameters:
aPath
- the pathaName
- the nameaSize
- the sizeaCreatedDate
- the created dateaModifiedDate
- the modified date
-
MutableFileHandleImpl
Instantiates a new mutable file handle impl.- Parameters:
aFileHandle
- the file handle
-
-
Method Details
-
setModifiedDate
- Specified by:
setModifiedDate
in interfaceorg.refcodes.mixin.ModifiedDateAccessor.ModifiedDateMutator
-
setFileSize
public void setFileSize(long aSize) Sets the size for the size property.- Specified by:
setFileSize
in interfaceFileSizeAccessor.FileSizeMutator
- Parameters:
aSize
- The size to be stored by the size property.
-
setName
- Specified by:
setName
in interfaceorg.refcodes.mixin.NameAccessor.NameMutator
-
setPath
- Specified by:
setPath
in interfaceorg.refcodes.mixin.PathAccessor.PathMutator
-
setCreatedDate
- Specified by:
setCreatedDate
in interfaceorg.refcodes.mixin.CreatedDateAccessor.CreatedDateMutator
-
hashCode
public int hashCode()- Overrides:
hashCode
in classFileHandleImpl
-
equals
- Overrides:
equals
in classFileHandleImpl
-
toFileHandle
Converts theFileHandle.MutableFileHandle
back to aFileHandle
to avoid hassle with collections, theObject.hashCode()
and theObject.equals(Object)
operations.- Specified by:
toFileHandle
in interfaceFileHandle.MutableFileHandle
- Returns:
- An immutable
FileHandle
from thisFileHandle.MutableFileHandle
.
-