Returns an attribute view of the given type for the given file lookup callback, or {@code null}
if the view type is not supported.
767315
@Nullable
  <V extends FileAttributeView> V getFileAttributeView(FileLookup lookup, Class<V> type) {
    state.checkOpen();
    return attributes.getFileAttributeView(lookup, type);
  }
500490
public @ColorInt
    Integer getHighlightColor(@NonNull View view, @NonNull String attribute) {
        try {
            return attributeColors.get(new Pair<>(view.getId(), attribute));
        } catch (NullPointerException e) {
            return 0;
        }
    }
1367126
@SuppressWarnings("unchecked")
  public static <T extends View> T findViewById(View containerView, int viewId) {
    View foundView = containerView.findViewById(viewId);
    return (T) foundView;
  }
137594
public static <T extends TOP> Collection<T> selectFromAllViews(JCas jCas, Class<T> type)
    {
        Collection<T> result = new ArrayList<T>();

        try {
            Iterator<JCas> viewIterator = jCas.getViewIterator();
            while (viewIterator.hasNext()) {
                JCas next = viewIterator.next();

                result.addAll(JCasUtil.select(next, type));
            }

            return result;
        }
        catch (CASException ex) {
            throw new RuntimeException(ex);
        }
    }
998790
def __get_lookup(in_fn, selected_type=None):
  """"""
  lookup_func = None
  if selected_type is not None:
    lookup_func = get_lookup_by_filetype(selected_type)
  else:
    extension = os.path.splitext(in_fn)[1]
    lookup_func = get_lookup_by_file_extension(extension)
  assert(lookup_func is not None)
  return lookup_func
359490
public ImmutableMap<String, Object> readAttributes(File file, String attributes) {
    String view = getViewName(attributes);
    List<String> attrs = getAttributeNames(attributes);

    if (attrs.size() > 1 && attrs.contains(ALL_ATTRIBUTES)) {
      // attrs contains * and other attributes
      throw new IllegalArgumentException("invalid attributes: " + attributes);
    }

    Map<String, Object> result = new HashMap<>();
    if (attrs.size() == 1 && attrs.contains(ALL_ATTRIBUTES)) {
      // for 'view:*' format, get all keys for all providers for the view
      AttributeProvider provider = providersByName.get(view);
      readAll(file, provider, result);

      for (String inheritedView : provider.inherits()) {
        AttributeProvider inheritedProvider = providersByName.get(inheritedView);
        readAll(file, inheritedProvider, result);
      }
    } else {
      // for 'view:attr1,attr2,etc'
      for (String attr : attrs) {
        result.put(attr, getAttribute(file, view, attr));
      }
    }

    return ImmutableMap.copyOf(result);
  }
926866
@Override
    public <V extends FileAttributeView> V getFileAttributeView(final Path path, final Class<V> type,
        final LinkOption... options) {
        if (path == null) {
            throw new IllegalArgumentException("path must be specified");
        }
        if (type == null) {
            throw new IllegalArgumentException("type must be specified");
        }
        if (!type.isAssignableFrom(ShrinkWrapFileAttributeView.class)) {
            // Nope, we don't support this view
            return null;
        }
        if (!(path instanceof ShrinkWrapPath)) {
            throw new IllegalArgumentException("Only " + ShrinkWrapPath.class.getSimpleName() + " is supported");
        }
        return type.cast(new ShrinkWrapFileAttributeView(new ShrinkWrapFileAttributes((ShrinkWrapPath) path,
                getArchive(path))));
    }
541744
public void getImageAttributes(
        final Map<String, String> attributes,
        final I_CmsSimpleCallback<Map<String, String>> callback) {

        boolean requiresLink = false;

        for (Entry<Attribute, I_CmsFormWidget> entry : m_fields.entrySet()) {
            String val = entry.getValue().getFormValueAsString();
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(val)) {
                continue;
            }
            if (entry.getKey() == Attribute.linkPath) {
                requiresLink = true;
            } else {
                attributes.put(entry.getKey().name(), val);
            }
        }
        if (requiresLink) {
            CmsCoreProvider.get().substituteLinkForRootPath(
                m_fields.get(Attribute.linkPath).getFormValueAsString(),
                new I_CmsSimpleCallback<String>() {

                    public void execute(String arg) {

                        attributes.put(Attribute.linkPath.name(), arg);
                        callback.execute(attributes);
                    }
                });
        } else {
            callback.execute(attributes);
        }
    }
986637
@Override
    public <A extends BasicFileAttributes> A readAttributes(final Path path, final Class<A> type,
        final LinkOption... options) throws IOException {
        if (path == null) {
            throw new IllegalArgumentException("path must be specified");
        }
        if (type == null) {
            throw new IllegalArgumentException("type must be specified");
        }
        if (!type.isAssignableFrom(ShrinkWrapFileAttributes.class)) {
            throw new UnsupportedOperationException("Only supports " + ShrinkWrapFileAttributes.class.getSimpleName()
                + " type");
        }
        if (!(path instanceof ShrinkWrapPath)) {
            throw new IllegalArgumentException("Only " + ShrinkWrapPath.class.getSimpleName() + " is supported");
        }
        final ShrinkWrapPath swPath = (ShrinkWrapPath) path;
        if (!((ShrinkWrapFileSystem) swPath.getFileSystem()).getArchive().contains(path.toString())) {
            throw new NoSuchFileException(path.toString());
        }
        final A attributes = type.cast(new ShrinkWrapFileAttributes((ShrinkWrapPath) path, getArchive(path)));
        return attributes;
    }
150668
protected static <T> T checkType(String view, String attribute, Object value, Class<T> type) {
    checkNotNull(value);
    if (type.isInstance(value)) {
      return type.cast(value);
    }

    throw invalidType(view, attribute, value, type);
  }
247866
@Nullable
  public static AttributeProvider get(String view) {
    AttributeProvider provider = PROVIDERS.get(view);

    if (provider == null && view.equals("unix")) {
      // create a new UnixAttributeProvider per file system, as it does some caching that should be
      // cleaned up when the file system is garbage collected
      return new UnixAttributeProvider();
    }

    return provider;
  }
597873
public Attribute getLookupAttribute(String lookupAttrName) {
    return stream(getLookupAttributes())
        .filter(lookupAttr -> lookupAttr.getName().equals(lookupAttrName))
        .findFirst()
        .orElse(null);
  }
356901
public static Class<?> getColumnClass(CmsDataViewColumn.Type type) {

        if (type == Type.imageType) {
            return Component.class;
        } else {
            return type.getValueClass();
        }
    }
441819
protected File getFileRoot(Class type) {
        String path = getGroupsRootPath() + type.getName();
        File f = new File(path);
        return (f.exists()) ? f : null;
    }
887260
private static FileResource getFileResourceProto(final String fileName, final FileType type) throws IOException {
    File file = new File(fileName);
    if (file.exists()) {
      // It is a local file and can be added.
      if (file.isDirectory()) {
        // If it is a directory, create a JAR file of it and add that instead.
        file = toJar(file);
      }
      return FileResourceImpl.newBuilder()
          .setName(file.getName())
          .setPath(file.getPath())
          .setType(type)
          .build();
    } else {
      // The file isn't in the local filesytem. Assume that the file is actually a URI.
      // We then assume that the underlying resource manager knows how to deal with it.
      try {
        final URI uri = new URI(fileName);
        final String path = uri.getPath();
        final String name = path.substring(path.lastIndexOf('/') + 1);
        return FileResourceImpl.newBuilder()
            .setName(name)
            .setPath(uri.toString())
            .setType(type)
            .build();
      } catch (final URISyntaxException e) {
        throw new IOException("Unable to parse URI.", e);
      }
    }
  }
263159
public Type getLink()
        throws CacheReloadException
    {
        if (this.link == null) {
            Attribute.LOG.error("Access on Attribute Link without parent defintion: {}", this);
        }
        return Type.get(this.link);
    }
616394
<A extends BasicFileAttributes> A readAttributes(File file, Class<A> type) {
    state.checkOpen();
    return attributes.readAttributes(file, type);
  }