/** * Obtains the element at the given index. * * @param <T> Element type. * @param elementIndex The element index. * @return The element, cast to {@code T}. */ protected final <T> T get(int elementIndex) { return Classes.cast(elements[elementIndex]); }
public <T> T getObjective() { return Classes.cast(objective); }
public <T> T getResult() { return Classes.cast(result); }
public static <A, B, C> Triple<A, B, C> empty() { return Classes.cast(EMPTY); }
private O self() { return Classes.cast(this); }
public <T> T getMetadata() { return Classes.cast(metadata); }
public <T> T getObjective() { return Classes.cast(objective); }
static <T> FieldPatch<T> ofNull() { return Classes.cast(NULL_INSTANCE); }
private M self() { return Classes.cast(this); } }
/** * Assigns a {@link Supplier} for a given class {@code type}, to be returned for all * future invocations of {@link ScopedResolver#lookup}. * * @param <T> Value type. * @param type The class type. * @param supplier The supplier for the mapped {@code type}. * @return The previously assigned {@link Supplier}, or {@code null} if this mapping was * not assigned. */ public <T> T assign(Class<T> type, Supplier<? extends T> supplier) { return Classes.cast(map.put(type, Classes.cast(supplier))); }
/** * Resets the mapping for the given {@code type}, leaving it in an unassigned state. * * @param <T> Value type. * @param type The class type. * @return The previously assigned {@link Supplier}, or {@code null} if this mapping was * not assigned. */ public <T> Supplier<T> reset(Class<T> type) { return Classes.cast(map.remove(type)); } }
/** * Creates a new array initialised with default values to a desired length. * * @param <T> Array type. * @param array The original array to mimic. * @param newLength The length of the new array. * @return The new array instance. */ public static <T> T clear(T array, int newLength) { return allocate(Classes.<Class<T>>cast(array.getClass()), newLength); }
private void onMessage(MessageContext context, Message message) { final Consumer<?> callback = pending.remove(message.getXid()); if (callback != null) { callback.accept(Classes.cast(message)); } } }
@Override public <T> LinearFutureTask<T> submit(Runnable task, T result) { return Classes.cast(super.submit(task, result)); }
private static LogService instantiateLogService(String logServiceClassName) { return Exceptions.wrap(() -> Classes.cast(Class.forName(logServiceClassName).getDeclaredConstructor().newInstance()), ServiceInstantiationException::new); }
@Override public List<Runnable> shutdownNow() { return Classes.cast(shutdownNow(true)); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (obj instanceof StandardFieldPatch) { return baseEquals(Classes.cast(obj)); } else { return false; } }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (obj instanceof Iso8601FieldPatch) { return baseEquals(Classes.cast(obj)); } else { return false; } }
@Override public <T> LinearFutureTask<T> submit(Callable<T> task) { return Classes.cast(super.submit(task)); }
public static void registerSerializers(SimpleModule module) { module .addSerializer(new StandardFieldPatchSerializer()) .addDeserializer(Classes.cast(FieldPatch.class), new StandardFieldPatchDeserializer()); }