Class FileAttributeViewCollection
- java.lang.Object
-
- com.github.robtimus.filesystems.attribute.FileAttributeViewCollection
-
public final class FileAttributeViewCollection extends Object
An immutable collection of file attribute views. Each view is represented as aFileAttributeViewMetadataobject. Instances of this class can be used to implement several methods inFileStore,FileSystemandFileSystemProvider.- Author:
- Rob Spoor
- Since:
- 2.2
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsView(Class<? extends FileAttributeView> type)Returns whether or not this collection contains a specific view.booleancontainsView(String name)Returns whether or not this collection contains a specific view.FileAttributeViewMetadatagetView(String name)Returns aFileAttributeViewMetadataobject representing a specific view.StringtoString()Set<String>viewNames()Returns the names of all contained views.static FileAttributeViewCollectionwithViews(FileAttributeViewMetadata... views)Creates a new collection of file attribute views.
-
-
-
Method Detail
-
withViews
public static FileAttributeViewCollection withViews(FileAttributeViewMetadata... views)
Creates a new collection of file attribute views.- Parameters:
views- TheFileAttributeViewMetadataobjects representing the views in the created collection.- Returns:
- The created collection.
- Throws:
NullPointerException- If any of the givenFileAttributeViewMetadataobjects is null.IllegalStateException- If any of theFileAttributeViewMetadataobjects have duplicate view names.
-
containsView
public boolean containsView(Class<? extends FileAttributeView> type)
Returns whether or not this collection contains a specific view.- Parameters:
type- The type of file attribute view to check.- Returns:
trueif this collection contains the given view, orfalseotherwise.- See Also:
FileStore.supportsFileAttributeView(Class)
-
containsView
public boolean containsView(String name)
Returns whether or not this collection contains a specific view.- Parameters:
name- The name of the file attribute view to check.- Returns:
trueif this collection contains the given view, orfalseotherwise.- See Also:
FileStore.supportsFileAttributeView(String)
-
viewNames
public Set<String> viewNames()
Returns the names of all contained views.- Returns:
- An unmodifiable set with the names of all contained views.
- See Also:
FileSystem.supportedFileAttributeViews()
-
getView
public FileAttributeViewMetadata getView(String name)
Returns aFileAttributeViewMetadataobject representing a specific view.- Parameters:
name- The name of the view to return aFileAttributeViewMetadataobject for.- Returns:
- A
FileAttributeViewMetadataobject representing the given view. - Throws:
UnsupportedOperationException- If no view with the given name is contained in this collection.- See Also:
containsView(String)
-
-