コード例 #1
0
 private Simple next(DataModelSource source) throws IOException {
   DataModelReflection next = source.next();
   if (next != null) {
     return SIMPLE.toObject(next);
   }
   return null;
 }
コード例 #2
0
 /**
  * Creates a new instance.
  *
  * @param conf current configuration
  * @param definition data type
  * @param pathExpression the source path (can include wildcard)
  * @throws IOException if failed to create instance
  * @throws IllegalArgumentException if some parameters were {@code null}
  */
 @SuppressWarnings("unchecked")
 public TemporaryDataModelSource(
     Configuration conf, DataModelDefinition<?> definition, String pathExpression)
     throws IOException {
   this.conf = conf;
   this.definition = (DataModelDefinition<Object>) definition;
   this.object = definition.toObject(definition.newReflection().build());
   Path path = new Path(pathExpression);
   this.fs = path.getFileSystem(conf);
   FileStatus[] list = fs.globStatus(path);
   List<Path> paths = new ArrayList<>();
   for (int i = 0; i < list.length; i++) {
     paths.add(list[i].getPath());
   }
   this.rest = paths.iterator();
 }