org.apache.flink.api.java.Utils.getGenericTypeTree()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(99)

本文整理了Java中org.apache.flink.api.java.Utils.getGenericTypeTree()方法的一些代码示例,展示了Utils.getGenericTypeTree()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.getGenericTypeTree()方法的具体详情如下:
包路径:org.apache.flink.api.java.Utils
类名称:Utils
方法名:getGenericTypeTree

Utils.getGenericTypeTree介绍

暂无

代码示例

代码示例来源:origin: apache/flink

private static String getGenericTypeTree(Class<?> type, int indent) {
  String ret = "";
  for (Field field : type.getDeclaredFields()) {
    if (Modifier.isStatic(field.getModifiers()) || Modifier.isTransient(field.getModifiers())) {
      continue;
    }
    ret += StringUtils.repeat(' ', indent) + field.getName() + ":" + field.getType().getName() +
      (field.getType().isEnum() ? " (is enum)" : "") + "\n";
    if (!field.getType().isPrimitive()) {
      ret += getGenericTypeTree(field.getType(), indent + 4);
    }
  }
  return ret;
}

代码示例来源:origin: apache/flink

private static <T> String getSerializerTree(TypeInformation<T> ti, int indent) {
  String ret = "";
  if (ti instanceof CompositeType) {
    ret += StringUtils.repeat(' ', indent) + ti.getClass().getSimpleName() + "\n";
    CompositeType<T> cti = (CompositeType<T>) ti;
    String[] fieldNames = cti.getFieldNames();
    for (int i = 0; i < cti.getArity(); i++) {
      TypeInformation<?> fieldType = cti.getTypeAt(i);
      ret += StringUtils.repeat(' ', indent + 2) + fieldNames[i] + ":" + getSerializerTree(fieldType, indent);
    }
  } else {
    if (ti instanceof GenericTypeInfo) {
      ret += StringUtils.repeat(' ', indent) + "GenericTypeInfo (" + ti.getTypeClass().getSimpleName() + ")\n";
      ret += getGenericTypeTree(ti.getTypeClass(), indent + 4);
    } else {
      ret += StringUtils.repeat(' ', indent) + ti.toString() + "\n";
    }
  }
  return ret;
}

代码示例来源:origin: org.apache.flink/flink-java

private static String getGenericTypeTree(Class<?> type, int indent) {
  String ret = "";
  for (Field field : type.getDeclaredFields()) {
    if (Modifier.isStatic(field.getModifiers()) || Modifier.isTransient(field.getModifiers())) {
      continue;
    }
    ret += StringUtils.repeat(' ', indent) + field.getName() + ":" + field.getType().getName() +
      (field.getType().isEnum() ? " (is enum)" : "") + "\n";
    if (!field.getType().isPrimitive()) {
      ret += getGenericTypeTree(field.getType(), indent + 4);
    }
  }
  return ret;
}

代码示例来源:origin: com.alibaba.blink/flink-java

private static String getGenericTypeTree(Class<?> type, int indent) {
  String ret = "";
  for (Field field : type.getDeclaredFields()) {
    if (Modifier.isStatic(field.getModifiers()) || Modifier.isTransient(field.getModifiers())) {
      continue;
    }
    ret += StringUtils.repeat(' ', indent) + field.getName() + ":" + field.getType().getName() +
      (field.getType().isEnum() ? " (is enum)" : "") + "\n";
    if (!field.getType().isPrimitive()) {
      ret += getGenericTypeTree(field.getType(), indent + 4);
    }
  }
  return ret;
}

代码示例来源:origin: org.apache.flink/flink-java

private static <T> String getSerializerTree(TypeInformation<T> ti, int indent) {
  String ret = "";
  if (ti instanceof CompositeType) {
    ret += StringUtils.repeat(' ', indent) + ti.getClass().getSimpleName() + "\n";
    CompositeType<T> cti = (CompositeType<T>) ti;
    String[] fieldNames = cti.getFieldNames();
    for (int i = 0; i < cti.getArity(); i++) {
      TypeInformation<?> fieldType = cti.getTypeAt(i);
      ret += StringUtils.repeat(' ', indent + 2) + fieldNames[i] + ":" + getSerializerTree(fieldType, indent);
    }
  } else {
    if (ti instanceof GenericTypeInfo) {
      ret += StringUtils.repeat(' ', indent) + "GenericTypeInfo (" + ti.getTypeClass().getSimpleName() + ")\n";
      ret += getGenericTypeTree(ti.getTypeClass(), indent + 4);
    } else {
      ret += StringUtils.repeat(' ', indent) + ti.toString() + "\n";
    }
  }
  return ret;
}

代码示例来源:origin: com.alibaba.blink/flink-java

private static <T> String getSerializerTree(TypeInformation<T> ti, int indent) {
  String ret = "";
  if (ti instanceof CompositeType) {
    ret += StringUtils.repeat(' ', indent) + ti.getClass().getSimpleName() + "\n";
    CompositeType<T> cti = (CompositeType<T>) ti;
    String[] fieldNames = cti.getFieldNames();
    for (int i = 0; i < cti.getArity(); i++) {
      TypeInformation<?> fieldType = cti.getTypeAt(i);
      ret += StringUtils.repeat(' ', indent + 2) + fieldNames[i] + ":" + getSerializerTree(fieldType, indent);
    }
  } else {
    if (ti instanceof GenericTypeInfo) {
      ret += StringUtils.repeat(' ', indent) + "GenericTypeInfo (" + ti.getTypeClass().getSimpleName() + ")\n";
      ret += getGenericTypeTree(ti.getTypeClass(), indent + 4);
    } else {
      ret += StringUtils.repeat(' ', indent) + ti.toString() + "\n";
    }
  }
  return ret;
}

相关文章