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,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,org.refcodes.mixin.SizeAccessor,org.refcodes.mixin.SizeAccessor.SizeMutator,org.refcodes.mixin.SizeAccessor.SizeProperty
- Enclosing class:
- FileHandleImpl
public class FileHandleImpl.MutableFileHandleImpl extends FileHandleImpl implements FileHandle.MutableFileHandle
The implementation of aFileHandle.MutableFileHandle. ------------------------------------------------------------------------- CAUTION: fiddling with the path and the name attributes causes thehashCode()andequals(Object)methods to change behavior which can cause problems especially in collections! ------------------------------------------------------------------------- ATTENTION: In order to avoid the above mentioned problems with theequals(Object)andhashCode()methods, usetoFileHandle()before storing aFileHandle.MutableFileHandlein a collection.
-
-
Nested Class Summary
-
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 class org.refcodes.filesystem.FileHandleImpl
FileHandleImpl.MutableFileHandleImpl
-
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
-
-
Field Summary
-
Fields inherited from class org.refcodes.filesystem.FileHandleImpl
_createdDate, _modifiedDate, _name, _path, _size
-
-
Constructor Summary
Constructors Constructor Description MutableFileHandleImpl(java.lang.String aPath, java.lang.String aName, long aSize, java.util.Date aCreatedDate, java.util.Date aModifiedDate)Instantiates a new mutable file handle impl.MutableFileHandleImpl(FileHandle aFileHandle)Instantiates a new mutable file handle impl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)inthashCode()voidsetCreatedDate(java.util.Date aCreatedDate)voidsetModifiedDate(java.util.Date aModifiedDate)voidsetName(java.lang.String aName)voidsetPath(java.lang.String aPath)voidsetSize(long aSize)FileHandletoFileHandle()Converts theFileHandle.MutableFileHandleback to aFileHandleto avoid hassle with collections, theObject.hashCode()and theObject.equals(Object)operations.-
Methods inherited from interface org.refcodes.filesystem.FileHandle
getCreatedDate, getModifiedDate, getName, getPath, getSize, toKey, toMutableFileHandle
-
Methods inherited from class org.refcodes.filesystem.FileHandleImpl
getCreatedDate, getModifiedDate, getName, getPath, getSize, toKey, toMutableFileHandle
-
-
-
-
Constructor Detail
-
MutableFileHandleImpl
public MutableFileHandleImpl(java.lang.String aPath, java.lang.String aName, long aSize, java.util.Date aCreatedDate, java.util.Date aModifiedDate)Instantiates a new mutable file handle impl.- Parameters:
aPath- the pathaName- the nameaSize- the sizeaCreatedDate- the created dateaModifiedDate- the modified date
-
MutableFileHandleImpl
public MutableFileHandleImpl(FileHandle aFileHandle)
Instantiates a new mutable file handle impl.- Parameters:
aFileHandle- the file handle
-
-
Method Detail
-
setModifiedDate
public void setModifiedDate(java.util.Date aModifiedDate)
- Specified by:
setModifiedDatein interfaceorg.refcodes.mixin.ModifiedDateAccessor.ModifiedDateMutator
-
setSize
public void setSize(long aSize)
- Specified by:
setSizein interfaceorg.refcodes.mixin.SizeAccessor.SizeMutator
-
setName
public void setName(java.lang.String aName)
- Specified by:
setNamein interfaceorg.refcodes.mixin.NameAccessor.NameMutator
-
setPath
public void setPath(java.lang.String aPath)
- Specified by:
setPathin interfaceorg.refcodes.mixin.PathAccessor.PathMutator
-
setCreatedDate
public void setCreatedDate(java.util.Date aCreatedDate)
- Specified by:
setCreatedDatein interfaceorg.refcodes.mixin.CreatedDateAccessor.CreatedDateMutator
-
hashCode
public int hashCode()
- Overrides:
hashCodein classFileHandleImpl
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classFileHandleImpl
-
toFileHandle
public FileHandle toFileHandle()
Converts theFileHandle.MutableFileHandleback to aFileHandleto avoid hassle with collections, theObject.hashCode()and theObject.equals(Object)operations.- Specified by:
toFileHandlein interfaceFileHandle.MutableFileHandle- Returns:
- An immutable
FileHandlefrom thisFileHandle.MutableFileHandle.
-
-