Class FileAttributeViewMetadata
- java.lang.Object
-
- com.github.robtimus.filesystems.attribute.FileAttributeViewMetadata
-
public final class FileAttributeViewMetadata extends Object
A class that represents metadata of aFileAttributeView
interface. Instances of this class are immutable.- Author:
- Rob Spoor
- Since:
- 2.2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FileAttributeViewMetadata.Builder
A builder forFileAttributeViewMetadata
objects.static class
FileAttributeViewMetadata.Operation
The possible file attribute operations.
-
Field Summary
Fields Modifier and Type Field Description static FileAttributeViewMetadata
ACL
Metadata forAclFileAttributeView
.static FileAttributeViewMetadata
BASIC
Metadata forBasicFileAttributeView
.static FileAttributeViewMetadata
DOS
Metadata forDosFileAttributeView
.static FileAttributeViewMetadata
FILE_OWNER
Metadata forFileOwnerAttributeView
.static FileAttributeViewMetadata
POSIX
Metadata forPosixFileAttributeView
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>
attributeNames()
Returns the names of the attributes that are supported in the view this metadata object applies to.Set<String>
attributeNames(FileAttributeViewMetadata.Operation operation)
Returns the names of the attributes that are supported in the view this metadata object applies to for a specific operation.Type
attributeType(String attributeName)
Returns the type for a specific attribute.static FileAttributeViewMetadata.Builder
forView(Class<? extends FileAttributeView> viewType)
Creates a builder forFileAttributeViewMetadata
objects.boolean
supportsAttribute(String attributeName)
Checks whether or not an attribute is supported by the view this metadata object applies to.boolean
supportsAttribute(String attributeName, FileAttributeViewMetadata.Operation operation)
Checks whether or not an attribute is supported by the view this metadata object applies to for a specific operation.String
toString()
String
viewName()
Returns the name of the view this metadata object applies to.Class<? extends FileAttributeView>
viewType()
Returns the type of the view this metadata object applies to.
-
-
-
Field Detail
-
BASIC
public static final FileAttributeViewMetadata BASIC
Metadata forBasicFileAttributeView
.
-
FILE_OWNER
public static final FileAttributeViewMetadata FILE_OWNER
Metadata forFileOwnerAttributeView
.
-
DOS
public static final FileAttributeViewMetadata DOS
Metadata forDosFileAttributeView
.
-
POSIX
public static final FileAttributeViewMetadata POSIX
Metadata forPosixFileAttributeView
.
-
ACL
public static final FileAttributeViewMetadata ACL
Metadata forAclFileAttributeView
.
-
-
Method Detail
-
viewType
public Class<? extends FileAttributeView> viewType()
Returns the type of the view this metadata object applies to.- Returns:
- The type of the view this metadata object applies to.
-
viewName
public String viewName()
Returns the name of the view this metadata object applies to.- Returns:
- The name of the view this metadata object applies to.
- See Also:
AttributeView.name()
-
attributeNames
public Set<String> attributeNames()
Returns the names of the attributes that are supported in the view this metadata object applies to. These names are attributes that are readable, writable, or both.- Returns:
- An unmodifiable set containing the name of the attributes that are supported in the view this metadata object applies to.
-
attributeNames
public Set<String> attributeNames(FileAttributeViewMetadata.Operation operation)
Returns the names of the attributes that are supported in the view this metadata object applies to for a specific operation.- Parameters:
operation
- The operation to perform - read or write.- Returns:
- An unmodifiable set containing the name of the attributes that are supported in the view this metadata object applies to for the given operation.
- Throws:
NullPointerException
- If the given operation isnull
.
-
attributeType
public Type attributeType(String attributeName)
Returns the type for a specific attribute.- Parameters:
attributeName
- The name of the attribute to return the type for.- Returns:
- The type for the given attribute.
- Throws:
IllegalArgumentException
- If the given attribute is not supported by the view this metadata object applies to.
-
supportsAttribute
public boolean supportsAttribute(String attributeName)
Checks whether or not an attribute is supported by the view this metadata object applies to. This method does not make a distinction between readable or writable attributes.- Parameters:
attributeName
- The name of the attribute to check.- Returns:
true
if the given attribute is supported by the view this metadata object applies to, orfalse
otherwise.
-
supportsAttribute
public boolean supportsAttribute(String attributeName, FileAttributeViewMetadata.Operation operation)
Checks whether or not an attribute is supported by the view this metadata object applies to for a specific operation.- Parameters:
attributeName
- The name of the attribute to check.operation
- The operation to check for - read or write.- Returns:
true
if the given attribute is supported by the view this metadata object applies to for the given operation, orfalse
otherwise.- Throws:
NullPointerException
- If the given operation isnull
.
-
forView
public static FileAttributeViewMetadata.Builder forView(Class<? extends FileAttributeView> viewType)
Creates a builder forFileAttributeViewMetadata
objects.- Parameters:
viewType
- The type of the view created metadata objects apply to.- Returns:
- The created builder.
- Throws:
NullPointerException
- If the given view type isnull
.
-
-