E
- the type of the mapped archive entries.@NotThreadSafe public final class FsCovariantEntry<E extends FsArchiveEntry> extends FsEntry implements Cloneable
archive entries
and uses its
key
property to determine the archive entry
in the map to which it forwards calls to getEntry()
,
Entry.getSize(Size)
, Entry.getTime(Access)
etc.Entry.Access, Entry.Size, Entry.Type
ALL_ACCESS_SET, ALL_SIZE_SET, ALL_TYPE_SET, DIRECTORY_TYPE_SET, FILE_TYPE_SET, SPECIAL_TYPE_SET, SYMLINK_TYPE_SET, UNKNOWN
Constructor and Description |
---|
FsCovariantEntry(String path)
Constructs a new covariant file system entry with the given path.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(String member)
Adds the given base path to the set of members of this directory
if and only if this covariant file system entry implements a directory.
|
FsCovariantEntry<E> |
clone(FsArchiveDriver<E> driver)
Returns a deep clone of this covariant file system entry.
|
E |
get(Entry.Type type)
Returns the entry for the given type.
|
Collection<E> |
getEntries()
A collection of the mapped entries.
|
E |
getEntry()
Returns the archive entry mapped for the
key property. |
Entry.Type |
getKey()
Returns the type of the file system entry to which calls to
getEntry() , Entry.getSize(Size) ,
Entry.getTime(Access) et al shall get forwarded. |
Set<String> |
getMembers()
Returns a set of the members of this directory or
null if and
only if there is no directory entry mapped. |
String |
getName()
Returns a string representation of the
file system entry name . |
long |
getSize(Entry.Size type)
Returns the size mapped for the
key property. |
long |
getTime(Entry.Access type)
Returns the access time mapped for the
key property. |
Set<Entry.Type> |
getTypes()
A set of the mapped types.
|
boolean |
isRoot()
Returns
true if and only if the name of this covariant entry
identifies it as a root entry. |
boolean |
isType(Entry.Type type)
Returns
true if there is an entry mapped for the given type. |
E |
put(Entry.Type type,
E entry)
Maps the given type to the given entry.
|
E |
remove(Entry.Type type)
Removes the entry for the given type from the map.
|
boolean |
remove(String member)
Removes the given base path from the set of members of this
directory
if and only if this covariant file system entry implements a directory.
|
void |
setKey(Entry.Type type)
Selects the type of the file system entry to which calls to
getEntry() , Entry.getSize(Size) ,
Entry.getTime(Access) et al shall get forwarded. |
public FsCovariantEntry(String path)
path
- the file system path.public boolean add(String member)
member
- The base path of the member to add.NullPointerException
- if this covariant file system entry does
not implement a directory.public FsCovariantEntry<E> clone(FsArchiveDriver<E> driver)
driver
- the archive driver to use for cloning the mapped archive
entries.@Nullable public E get(Entry.Type type)
type
- the type of the entry to lookup.public Collection<E> getEntries()
@Nullable public E getEntry()
key
property.key
property.@Nullable public Entry.Type getKey()
getEntry()
, Entry.getSize(Size)
,
Entry.getTime(Access)
et al shall get forwarded.
Note that an arbitrary property value may get returned:
The initial value is null
and even if it's not null
,
no entry of this type needs to be mapped.
getEntry()
, Entry.getSize(Size)
,
Entry.getTime(Access)
et al shall get forwarded.@Nullable public Set<String> getMembers()
null
if and
only if there is no directory entry mapped.
This is a bidirectional view: Any change is reflected in the set and
vice versa.getMembers
in class FsEntry
null
if and
only if there is no directory entry mapped.public String getName()
FsEntry
file system entry name
.getName
in interface Entry
getName
in class FsEntry
file system entry name
.EntryName.create(URI)
public long getSize(Entry.Size type)
key
property.public long getTime(Entry.Access type)
key
property.public Set<Entry.Type> getTypes()
public boolean isRoot()
true
if and only if the name of this covariant entry
identifies it as a root entry.true
if and only if the name of this covariant entry
identifies it as a root entry.public boolean isType(Entry.Type type)
true
if there is an entry mapped for the given type.isType
in class FsEntry
type
- the type to lookup.true
if there is an entry mapped for the given type.FsEntry.getTypes()
@Nullable public E put(Entry.Type type, E entry)
key
property is set to the given
type.type
- the type to map.entry
- the entry to map.@Nullable public E remove(Entry.Type type)
type
- the type to remove.public boolean remove(String member)
member
- The base path of the member to remove.NullPointerException
- if this covariant file system entry does
not implement a directory.public void setKey(@Nullable Entry.Type type)
getEntry()
, Entry.getSize(Size)
,
Entry.getTime(Access)
et al shall get forwarded.
If the given type is null
or no file system entry of this type
is mappeed, then any subsequent call to these methods will fail with a
NullPointerException
.type
- the type of the file system entry to which calls to
getEntry()
, Entry.getSize(Size)
,
Entry.getTime(Access)
et al shall get forwarded.Copyright © 2005–2018 Schlichtherle IT Services. All rights reserved.