E
- the type of the mapped archive entries.@NotThreadSafe public final class FsCovariantNode<E extends FsArchiveEntry> extends FsAbstractNode 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)
et al.Constructor and Description |
---|
FsCovariantNode(String path)
Constructs a new covariant file system node 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 node implements a directory.
|
FsCovariantNode<E> |
clone(FsArchiveDriver<E> driver)
Returns a deep clone of this covariant file system node.
|
E |
get(net.java.truecommons.cio.Entry.Type type)
Returns the archive 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. |
net.java.truecommons.cio.Entry.Type |
getKey()
Returns the type of the file system node 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 archive entry mapped. |
String |
getName()
Returns a string representation of the
file system node name . |
long |
getSize(net.java.truecommons.cio.Entry.Size type)
Returns the size mapped for the
key property. |
long |
getTime(net.java.truecommons.cio.Entry.Access type)
Returns the access time mapped for the
key property. |
net.java.truecommons.shed.BitField<net.java.truecommons.cio.Entry.Type> |
getTypes()
Returns a set of the mapped types.
|
Boolean |
isPermitted(net.java.truecommons.cio.Entry.Access type,
net.java.truecommons.cio.Entry.Entity entity)
Returns the permission mapped for the
key property. |
boolean |
isRoot()
Returns
true if and only if the name of this covariant node
identifies it as a root node. |
boolean |
isType(net.java.truecommons.cio.Entry.Type type)
Returns
true if and only if there is an archive entry mapped for
the given type. |
E |
put(net.java.truecommons.cio.Entry.Type type,
E entry)
Maps the given type to the given archive entry.
|
E |
remove(net.java.truecommons.cio.Entry.Type type)
Removes the archive 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 node implements a directory.
|
void |
setKey(net.java.truecommons.cio.Entry.Type key)
Selects the type of the file system node to which calls to
getEntry() , Entry.getSize(Size) ,
Entry.getTime(Access) et al shall get forwarded. |
toString
public FsCovariantNode(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 node does
not implement a directory.public FsCovariantNode<E> clone(FsArchiveDriver<E> driver)
driver
- the archive driver to use for cloning the mapped archive
entries.@Nullable public E get(net.java.truecommons.cio.Entry.Type type)
type
- the type of the archive entry to lookup.public Collection<E> getEntries()
@Nullable public E getEntry()
key
property.key
property.@Nullable public net.java.truecommons.cio.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 node 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 archive entry mapped.
This is a bidirectional view: Any change is reflected in the set and
vice versa.getMembers
in interface FsNode
null
if and only if this is not a
directory node.public String getName()
FsNode
file system node name
.getName
in interface net.java.truecommons.cio.Entry
getName
in interface FsNode
file system node name
.public long getSize(net.java.truecommons.cio.Entry.Size type)
key
property.getSize
in interface net.java.truecommons.cio.Entry
public long getTime(net.java.truecommons.cio.Entry.Access type)
key
property.getTime
in interface net.java.truecommons.cio.Entry
public net.java.truecommons.shed.BitField<net.java.truecommons.cio.Entry.Type> getTypes()
public Boolean isPermitted(net.java.truecommons.cio.Entry.Access type, net.java.truecommons.cio.Entry.Entity entity)
key
property.isPermitted
in interface net.java.truecommons.cio.Entry
public boolean isRoot()
true
if and only if the name of this covariant node
identifies it as a root node.true
if and only if the name of this covariant node
identifies it as a root node.public boolean isType(net.java.truecommons.cio.Entry.Type type)
true
if and only if there is an archive entry mapped for
the given type.isType
in interface FsNode
isType
in class FsAbstractNode
type
- the type to test.true
if and only if this file system node implements
the given type.FsNode.getTypes()
@Nullable public E put(net.java.truecommons.cio.Entry.Type type, E entry)
key
property is set to the given
type.type
- the type to map.entry
- the archive entry to map.@Nullable public E remove(net.java.truecommons.cio.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 node does
not implement a directory.public void setKey(@Nullable net.java.truecommons.cio.Entry.Type key)
getEntry()
, Entry.getSize(Size)
,
Entry.getTime(Access)
et al shall get forwarded.
If the given type is null
or no file system node of this type
is mappeed, then any subsequent call to these methods will fail with a
NullPointerException
.key
- the type of the file system node 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.