Class FileAttributeViewMetadata
- java.lang.Object
-
- com.github.robtimus.filesystems.attribute.FileAttributeViewMetadata
-
public final class FileAttributeViewMetadata extends Object
A class that represents metadata of aFileAttributeViewinterface. Instances of this class are immutable.- Author:
- Rob Spoor
- Since:
- 2.2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFileAttributeViewMetadata.BuilderA builder forFileAttributeViewMetadataobjects.static classFileAttributeViewMetadata.OperationThe possible file attribute operations.
-
Field Summary
Fields Modifier and Type Field Description static FileAttributeViewMetadataACLMetadata forAclFileAttributeView.static FileAttributeViewMetadataBASICMetadata forBasicFileAttributeView.static FileAttributeViewMetadataDOSMetadata forDosFileAttributeView.static FileAttributeViewMetadataFILE_OWNERMetadata forFileOwnerAttributeView.static FileAttributeViewMetadataPOSIXMetadata 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.TypeattributeType(String attributeName)Returns the type for a specific attribute.static FileAttributeViewMetadata.BuilderforView(Class<? extends FileAttributeView> viewType)Creates a builder forFileAttributeViewMetadataobjects.booleansupportsAttribute(String attributeName)Checks whether or not an attribute is supported by the view this metadata object applies to.booleansupportsAttribute(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.StringtoString()StringviewName()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:
trueif the given attribute is supported by the view this metadata object applies to, orfalseotherwise.
-
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:
trueif the given attribute is supported by the view this metadata object applies to for the given operation, orfalseotherwise.- Throws:
NullPointerException- If the given operation isnull.
-
forView
public static FileAttributeViewMetadata.Builder forView(Class<? extends FileAttributeView> viewType)
Creates a builder forFileAttributeViewMetadataobjects.- Parameters:
viewType- The type of the view created metadata objects apply to.- Returns:
- The created builder.
- Throws:
NullPointerException- If the given view type isnull.
-
-