@Override public <T> ExtractedRuleSource<T> newInstance(Class<T> source) { return Cast.uncheckedCast(ruleSource); } }
public static <T> Collection<? extends T> checkedCast(Class<T> type, Collection<?> input) { for (Object o : input) { cast(type, o); } return Cast.uncheckedCast(input); }
public O transform(I input) { return Cast.cast(outputType, input); } }
public O transform(I input) { return Cast.cast(outputType, input); } }
/** * Creates an empty action set. */ public static <T> ImmutableActionSet<T> empty() { return Cast.uncheckedCast(EMPTY); }
public static <T> Collection<? extends T> checkedCast(Class<T> type, Collection<?> input) { for (Object o : input) { cast(type, o); } return Cast.uncheckedCast(input); }
private String typeName(Type type) { if (type == null) { return null; } return type instanceof Class ? Cast.cast(Class.class, type).getName() : type.toString(); }
public ImplementationInfoImpl(ModelType<PUBLIC> publicType, ImplementationRegistration<?> implementationRegistration, Set<ModelType<?>> internalViews) { this.publicType = publicType; this.internalViews = internalViews; this.implementationRegistration = Cast.uncheckedCast(implementationRegistration); }
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); }
@Override public Map<File, IncludedBuild> getIncludedBuilds() { return Cast.uncheckedCast(includedBuilds); }
@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 static <T> Provider<T> notDefined() { return Cast.uncheckedCast(NULL_PROVIDER); }
private static Iterable<File> toFiles(Object value) { if (value == null) { return Collections.emptySet(); } else if (value instanceof Map) { return uncheckedCast(((Map) value).values()); } else { return uncheckedCast(value); } } }
@Override public <A extends ModelSchemaAspect> A getAspect(Class<A> aspectType) { return Cast.uncheckedCast(aspects.get(aspectType)); }
@Nullable @Override public Class<T> getType() { return Cast.uncheckedCast(value.getClass()); }
@Nullable @Override public ModelReference<S> getSubjectReference() { return Cast.uncheckedCast(references.isEmpty() ? null : references.get(0)); }
@Override public <T> T getSnapshotter(Class<? extends T> type) { FileCollectionSnapshotter snapshotter = snapshotters.get(type); if (snapshotter == null) { throw new IllegalStateException(String.format("No snapshotter registered with type '%s'", type.getName())); } return uncheckedCast(snapshotter); } }
public void applyImperative(@Nullable String pluginId, Plugin<?> plugin) { // TODO validate that the plugin accepts this kind of argument Plugin<T> cast = uncheckedCast(plugin); cast.apply(target); }
@Override ImmutableActionSet<T> doAdd(Action<? super T> action) { if (action.equals(singleAction)) { return this; } ImmutableSet<Action<? super T>> of = Cast.uncheckedCast(ImmutableSet.of(singleAction, action)); return new CompositeSet<T>(of); }
@Override protected List<T> toMutationSafe(Collection<?> backingCollection) { return new ListBackedCollection<T>(Cast.<List<T>>uncheckedCast(backingCollection), state, elementType); } }