當前位置: 首頁>>代碼示例>>Java>>正文


Java VoidCoder.of方法代碼示例

本文整理匯總了Java中org.apache.beam.sdk.coders.VoidCoder.of方法的典型用法代碼示例。如果您正苦於以下問題:Java VoidCoder.of方法的具體用法?Java VoidCoder.of怎麽用?Java VoidCoder.of使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.beam.sdk.coders.VoidCoder的用法示例。


在下文中一共展示了VoidCoder.of方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: inferCoderFromObject

import org.apache.beam.sdk.coders.VoidCoder; //導入方法依賴的package包/類
/**
 * Attempt to infer the type for some very common Apache Beam parameterized types.
 *
 * <p>TODO: Instead, build a TypeDescriptor so that the {@link CoderRegistry} is invoked
 * for the type instead of hard coding the coders for common types.
 */
private static Coder<?> inferCoderFromObject(CoderRegistry registry, Object o)
    throws CannotProvideCoderException {
  if (o == null) {
    return VoidCoder.of();
  } else if (o instanceof TimestampedValue) {
    return TimestampedValueCoder.of(
        inferCoderFromObject(registry, ((TimestampedValue) o).getValue()));
  } else if (o instanceof List) {
    return ListCoder.of(inferCoderFromObjects(registry, ((Iterable) o)));
  } else if (o instanceof Set) {
    return SetCoder.of(inferCoderFromObjects(registry, ((Iterable) o)));
  } else if (o instanceof Collection) {
    return CollectionCoder.of(inferCoderFromObjects(registry, ((Iterable) o)));
  } else if (o instanceof Iterable) {
    return IterableCoder.of(inferCoderFromObjects(registry, ((Iterable) o)));
  } else if (o instanceof Map) {
    return MapCoder.of(
        inferCoderFromObjects(registry, ((Map) o).keySet()),
        inferCoderFromObjects(registry, ((Map) o).entrySet()));
  } else if (o instanceof KV) {
    return KvCoder.of(
        inferCoderFromObject(registry, ((KV) o).getKey()),
        inferCoderFromObject(registry, ((KV) o).getValue()));
  } else {
    return registry.getCoder(o.getClass());
  }
}
 
開發者ID:apache,項目名稱:beam,代碼行數:34,代碼來源:Create.java

示例2: getDefaultCoder

import org.apache.beam.sdk.coders.VoidCoder; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private <T> Coder<T> getDefaultCoder(Class<T> c) {
    if (Writable.class.isAssignableFrom(c)) {
        Class<? extends Writable> writableClass = (Class<? extends Writable>) c;
        return (Coder<T>) WritableCoder.of(writableClass);
    } else if (Void.class.equals(c)) {
        return (Coder<T>) VoidCoder.of();
    }
    // TODO: how to use registered coders here?
    throw new IllegalStateException("Cannot find coder for " + c);
}
 
開發者ID:Talend,項目名稱:components,代碼行數:12,代碼來源:ConfigurableHDFSFileSource.java

示例3: getAccumulatorCoder

import org.apache.beam.sdk.coders.VoidCoder; //導入方法依賴的package包/類
@Override
public Coder<Void> getAccumulatorCoder(CoderRegistry registry, Coder<Integer> inputCoder) {
  return (Coder) VoidCoder.of();
}
 
開發者ID:apache,項目名稱:beam,代碼行數:5,代碼來源:CombineTranslationTest.java


注:本文中的org.apache.beam.sdk.coders.VoidCoder.of方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。