Class OwnerAttributeProvider


  • final class OwnerAttributeProvider
    extends AttributeProvider
    Attribute provider that provides the FileOwnerAttributeView ("owner").
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  OwnerAttributeProvider.View
      Implementation of FileOwnerAttributeView.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static com.google.common.collect.ImmutableSet<java.lang.String> ATTRIBUTES  
      private static java.nio.file.attribute.UserPrincipal DEFAULT_OWNER  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.google.common.collect.ImmutableMap<java.lang.String,​?> defaultValues​(java.util.Map<java.lang.String,​?> userProvidedDefaults)
      Returns a map containing the default attribute values for this provider.
      com.google.common.collect.ImmutableSet<java.lang.String> fixedAttributes()
      Returns the set of attributes that are always available from this provider.
      @Nullable java.lang.Object get​(File file, java.lang.String attribute)
      Returns the value of the given attribute in the given file or null if the attribute is not supported by this provider.
      java.lang.String name()
      Returns the view name that's used to get attributes from this provider.
      void set​(File file, java.lang.String view, java.lang.String attribute, java.lang.Object value, boolean create)
      Sets the value of the given attribute in the given file object.
      java.nio.file.attribute.FileOwnerAttributeView view​(FileLookup lookup, com.google.common.collect.ImmutableMap<java.lang.String,​java.nio.file.attribute.FileAttributeView> inheritedViews)
      Returns a view of the file located by the given lookup callback.
      java.lang.Class<java.nio.file.attribute.FileOwnerAttributeView> viewType()
      Returns the type of the view interface that this provider supports.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ATTRIBUTES

        private static final com.google.common.collect.ImmutableSet<java.lang.String> ATTRIBUTES
      • DEFAULT_OWNER

        private static final java.nio.file.attribute.UserPrincipal DEFAULT_OWNER
    • Constructor Detail

      • OwnerAttributeProvider

        OwnerAttributeProvider()
    • Method Detail

      • name

        public java.lang.String name()
        Description copied from class: AttributeProvider
        Returns the view name that's used to get attributes from this provider.
        Specified by:
        name in class AttributeProvider
      • fixedAttributes

        public com.google.common.collect.ImmutableSet<java.lang.String> fixedAttributes()
        Description copied from class: AttributeProvider
        Returns the set of attributes that are always available from this provider.
        Specified by:
        fixedAttributes in class AttributeProvider
      • defaultValues

        public com.google.common.collect.ImmutableMap<java.lang.String,​?> defaultValues​(java.util.Map<java.lang.String,​?> userProvidedDefaults)
        Description copied from class: AttributeProvider
        Returns a map containing the default attribute values for this provider. The keys of the map are attribute identifier strings (in "view:attribute" form) and the value for each is the default value that should be set for that attribute when creating a new file.

        The given map should be in the same format and contains user-provided default values. If the user provided any default values for attributes handled by this provider, those values should be checked to ensure they are of the correct type. Additionally, if any changes to a user-provided attribute are necessary (for example, creating an immutable defensive copy), that should be done. The resulting values should be included in the result map along with default values for any attributes the user did not provide a value for.

        Overrides:
        defaultValues in class AttributeProvider
      • get

        public @Nullable java.lang.Object get​(File file,
                                              java.lang.String attribute)
        Description copied from class: AttributeProvider
        Returns the value of the given attribute in the given file or null if the attribute is not supported by this provider.
        Specified by:
        get in class AttributeProvider
      • set

        public void set​(File file,
                        java.lang.String view,
                        java.lang.String attribute,
                        java.lang.Object value,
                        boolean create)
        Description copied from class: AttributeProvider
        Sets the value of the given attribute in the given file object. The create parameter indicates whether or not the value is being set upon creation of a new file via a user-provided FileAttribute.
        Specified by:
        set in class AttributeProvider
      • viewType

        public java.lang.Class<java.nio.file.attribute.FileOwnerAttributeView> viewType()
        Description copied from class: AttributeProvider
        Returns the type of the view interface that this provider supports.
        Specified by:
        viewType in class AttributeProvider
      • view

        public java.nio.file.attribute.FileOwnerAttributeView view​(FileLookup lookup,
                                                                   com.google.common.collect.ImmutableMap<java.lang.String,​java.nio.file.attribute.FileAttributeView> inheritedViews)
        Description copied from class: AttributeProvider
        Returns a view of the file located by the given lookup callback. The given map contains the views inherited by this view.
        Specified by:
        view in class AttributeProvider