public O transform(I input) { return Cast.cast(outputType, input); } }
public O transform(I input) { return Cast.cast(outputType, input); } }
private String typeName(Type type) { if (type == null) { return null; } return type instanceof Class ? Cast.cast(Class.class, type).getName() : type.toString(); }
public FileCollectionInternal resolveFiles(Object... paths) { if (paths.length == 1 && paths[0] instanceof FileCollection) { return Cast.cast(FileCollectionInternal.class, paths[0]); } return new DefaultConfigurableFileCollection(this, null, paths); }
public static <T> Collection<? extends T> checkedCast(Class<T> type, Collection<?> input) { for (Object o : input) { cast(type, o); } return Cast.uncheckedCast(input); }
public static <T> Collection<? extends T> checkedCast(Class<T> type, Collection<?> input) { for (Object o : input) { cast(type, o); } return Cast.uncheckedCast(input); }
@Override public UnionFileTree add(FileCollection source) { if (!(source instanceof FileTree)) { throw new UnsupportedOperationException(String.format("Can only add FileTree instances to %s.", getDisplayName())); } sourceTrees.add(Cast.cast(FileTreeInternal.class, source)); return this; } }
public FileTree plus(FileTree fileTree) { return new UnionFileTree(this, Cast.cast(FileTreeInternal.class, fileTree)); }
public FileTree plus(FileTree fileTree) { return new UnionFileTree(this, Cast.cast(FileTreeInternal.class, fileTree)); }
@Override public <T extends DeploymentHandle> T get(String name, Class<T> handleType) { lock.lock(); try { failIfStopped(); if (deployments.containsKey(name)) { return Cast.cast(handleType, deployments.get(name).getHandle()); } else { return null; } } finally { lock.unlock(); } }
public FileTreeInternal resolveFilesAsTree(Object... paths) { return Cast.cast(FileTreeInternal.class, resolveFiles(paths).getAsFileTree()); }
return Collections.singletonList(cast(type, thing)); } else { List<T> list = new ArrayList<T>();
return Collections.singletonList(cast(type, thing)); } else { List<T> list = new ArrayList<T>();
public void convertInto(Object element, Collection<? super FileCollectionInternal> result, PathToFileResolver fileResolver) { if (element instanceof DefaultFileCollectionResolveContext) { DefaultFileCollectionResolveContext nestedContext = (DefaultFileCollectionResolveContext) element; result.addAll(nestedContext.resolveAsFileCollections()); } else if (element instanceof FileCollection) { FileCollection fileCollection = (FileCollection) element; result.add(Cast.cast(FileCollectionInternal.class, fileCollection)); } else if (element instanceof MinimalFileTree) { MinimalFileTree fileTree = (MinimalFileTree) element; result.add(new FileTreeAdapter(fileTree)); } else if (element instanceof MinimalFileSet) { MinimalFileSet fileSet = (MinimalFileSet) element; result.add(new FileCollectionAdapter(fileSet)); } else if (element instanceof MinimalFileCollection) { throw new UnsupportedOperationException(String.format("Cannot convert instance of %s to FileTree", element.getClass().getSimpleName())); } else if (element instanceof TaskDependency) { // Ignore return; } else { result.add(new FileCollectionAdapter(new ListBackedFileSet(fileResolver.resolve(element)))); } } }
public void convertInto(Object element, Collection<? super FileTreeInternal> result, PathToFileResolver fileResolver) { if (element instanceof DefaultFileCollectionResolveContext) { DefaultFileCollectionResolveContext nestedContext = (DefaultFileCollectionResolveContext) element; result.addAll(nestedContext.resolveAsFileTrees()); } else if (element instanceof FileTree) { FileTree fileTree = (FileTree) element; result.add(Cast.cast(FileTreeInternal.class, fileTree)); } else if (element instanceof MinimalFileTree) { MinimalFileTree fileTree = (MinimalFileTree) element; result.add(new FileTreeAdapter(fileTree)); } else if (element instanceof MinimalFileSet) { MinimalFileSet fileSet = (MinimalFileSet) element; for (File file : fileSet.getFiles()) { convertFileToFileTree(file, result); } } else if (element instanceof FileCollection) { FileCollection fileCollection = (FileCollection) element; for (File file : fileCollection.getFiles()) { convertFileToFileTree(file, result); } } else if (element instanceof MinimalFileCollection) { throw new UnsupportedOperationException(String.format("Cannot convert instance of %s to FileTree", element.getClass().getSimpleName())); } else if (element instanceof TaskDependency) { // Ignore return; } else { convertFileToFileTree(fileResolver.resolve(element), result); } }