@Test public void testGetFileAttributeView_isNullForUnsupportedView() { final File file = Directory.create(0); FileLookup fileLookup = new FileLookup() { @Override public File lookup() throws IOException { return file; } }; assertThat(service.getFileAttributeView(fileLookup, PosixFileAttributeView.class)).isNull(); }
@SuppressWarnings("unchecked") @NullableDecl public <V extends FileAttributeView> V getFileAttributeView(FileLookup lookup, Class<V> type) { AttributeProvider provider = providersByViewType.get(type); if (provider != null) { return (V) provider.view(lookup, createInheritedViews(lookup, provider)); } return null; }
AttributeService { @SuppressWarnings("unchecked") @NullableDecl public <V extends FileAttributeView> V getFileAttributeView(FileLookup lookup, Class<V> type) { AttributeProvider provider = providersByViewType.get(type); if (provider != null) { return (V) provider.view(lookup, createInheritedViews(lookup, provider)); } return null; } }
AttributeService { @SuppressWarnings("unchecked") @NullableDecl public <V extends FileAttributeView> V getFileAttributeView(FileLookup lookup, Class<V> type) { AttributeProvider provider = providersByViewType.get(type); if (provider != null) { return (V) provider.view(lookup, createInheritedViews(lookup, provider)); } return null; } AttributeService(Configuration configuration);  AttributeService(
      Iterable<? extends AttributeProvider> providers, Map<String, ?> userProvidedDefaults); }
AttributeService { @SuppressWarnings("unchecked") @NullableDecl public <V extends FileAttributeView> V getFileAttributeView(FileLookup lookup, Class<V> type) { AttributeProvider provider = providersByViewType.get(type); if (provider != null) { return (V) provider.view(lookup, createInheritedViews(lookup, provider)); } return null; } AttributeService(Configuration configuration);  AttributeService(
      Iterable<? extends AttributeProvider> providers, Map<String, ?> userProvidedDefaults); ImmutableSet<String> supportedFileAttributeViews(); boolean supportsFileAttributeView(Class<? extends FileAttributeView> type); void setInitialAttributes(File file, FileAttribute<?>... attrs); void copyAttributes(File file, File copy, AttributeCopyOption copyOption); Object getAttribute(File file, String attribute); Object getAttribute(File file, String view, String attribute); void setAttribute(File file, String attribute, Object value, boolean create); @SuppressWarnings("unchecked") @NullableDecl V getFileAttributeView(FileLookup lookup, Class<V> type); ImmutableMap<String, Object> readAttributes(File file, String attributes); @SuppressWarnings("unchecked") A readAttributes(File file, Class<A> type); }
AttributeService { @SuppressWarnings("unchecked") @NullableDecl public <V extends FileAttributeView> V getFileAttributeView(FileLookup lookup, Class<V> type) { AttributeProvider provider = providersByViewType.get(type); if (provider != null) { return (V) provider.view(lookup, createInheritedViews(lookup, provider)); } return null; } AttributeService(Configuration configuration);  AttributeService(
      Iterable<? extends AttributeProvider> providers, Map<String, ?> userProvidedDefaults); ImmutableSet<String> supportedFileAttributeViews(); boolean supportsFileAttributeView(Class<? extends FileAttributeView> type); void setInitialAttributes(File file, FileAttribute<?>... attrs); void copyAttributes(File file, File copy, AttributeCopyOption copyOption); Object getAttribute(File file, String attribute); Object getAttribute(File file, String view, String attribute); void setAttribute(File file, String attribute, Object value, boolean create); @SuppressWarnings("unchecked") @NullableDecl V getFileAttributeView(FileLookup lookup, Class<V> type); ImmutableMap<String, Object> readAttributes(File file, String attributes); @SuppressWarnings("unchecked") A readAttributes(File file, Class<A> type);  }