当前位置: 首页>>代码示例>>Java>>正文


Java ReflectionUtils.copy方法代码示例

本文整理汇总了Java中org.apache.hadoop.util.ReflectionUtils.copy方法的典型用法代码示例。如果您正苦于以下问题:Java ReflectionUtils.copy方法的具体用法?Java ReflectionUtils.copy怎么用?Java ReflectionUtils.copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.util.ReflectionUtils的用法示例。


在下文中一共展示了ReflectionUtils.copy方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: clone

import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
/**
 * Make a copy of a writable object using serialization to a buffer.
 * @param orig The object to copy
 * @return The copied object
 */
public static <T extends Writable> T clone(T orig, Configuration conf) {
  try {
    @SuppressWarnings("unchecked") // Unchecked cast from Class to Class<T>
    T newInst = ReflectionUtils.newInstance((Class<T>) orig.getClass(), conf);
    ReflectionUtils.copy(conf, orig, newInst);
    return newInst;
  } catch (IOException e) {
    throw new RuntimeException("Error writing/reading clone buffer", e);
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:16,代码来源:WritableUtils.java

示例2: nextKeyValue

import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
@Override
public boolean nextKeyValue() throws IOException, InterruptedException {
  synchronized (outer) {
    if (!outer.nextKeyValue()) {
      return false;
    }
    key = ReflectionUtils.copy(outer.getConfiguration(),
                               outer.getCurrentKey(), key);
    value = ReflectionUtils.copy(conf, outer.getCurrentValue(), value);
    return true;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:MultithreadedMapper.java

示例3: nextKeyValue

import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
/** {@inheritDoc} */
public boolean nextKeyValue() throws IOException, InterruptedException {
  if (key == null) {
    key = createKey();
  }
  if (value == null) {
    value = createValue();
  }
  if (jc.flush(ivalue)) {
    ReflectionUtils.copy(conf, jc.key(), key);
    ReflectionUtils.copy(conf, emit(ivalue), value);
    return true;
  }
  if (ivalue == null) {
    ivalue = createTupleWritable();
  }
  jc.clear();
  final PriorityQueue<ComposableRecordReader<K,?>> q = 
          getRecordReaderQueue();
  K iterkey = createKey();
  while (q != null && !q.isEmpty()) {
    fillJoinCollector(iterkey);
    jc.reset(iterkey);
    if (jc.flush(ivalue)) {
      ReflectionUtils.copy(conf, jc.key(), key);
      ReflectionUtils.copy(conf, emit(ivalue), value);
      return true;
    }
    jc.clear();
  }
  return false;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:33,代码来源:MultiFilterRecordReader.java

示例4: next

import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
public boolean next(V val) throws IOException {
  boolean ret;
  if (ret = jc.flush(ivalue)) {
    ReflectionUtils.copy(getConf(), emit(ivalue), val);
  }
  return ret;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:MultiFilterRecordReader.java

示例5: nextKeyValue

import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
/**
 * Emit the next set of key, value pairs as defined by the child
 * RecordReaders and operation associated with this composite RR.
 */
public boolean nextKeyValue() 
    throws IOException, InterruptedException {
  if (key == null) {
    key = createKey();
  }
  if (jc.flush(value)) {
    ReflectionUtils.copy(conf, jc.key(), key);
    return true;
  }
  jc.clear();
  if (value == null) {
    value = createValue();
  }
  final PriorityQueue<ComposableRecordReader<K,?>> q = 
          getRecordReaderQueue();
  K iterkey = createKey();
  while (q != null && !q.isEmpty()) {
    fillJoinCollector(iterkey);
    jc.reset(iterkey);
    if (jc.flush(value)) {
      ReflectionUtils.copy(conf, jc.key(), key);
      return true;
    }
    jc.clear();
  }
  return false;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:32,代码来源:JoinRecordReader.java

示例6: next

import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
public boolean next(X val) throws IOException {
  if (iter.hasNext()) {
    ReflectionUtils.copy(conf, iter.next(), val);
    if (null == hold) {
      hold = WritableUtils.clone(val, null);
    } else {
      ReflectionUtils.copy(conf, val, hold);
    }
    return true;
  }
  return false;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:ArrayListBackedIterator.java

示例7: readFromQueue

import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private boolean readFromQueue() throws IOException, InterruptedException {
  KeyValuePair<KEYIN, VALUEIN> kv = null;

  // wait for input on queue
  kv = inputQueue.dequeue();
  if (kv.endOfInput) {
    return false;
  }
  key = (KEYIN) ReflectionUtils.newInstance(keyClass, conf);
  value = (VALUEIN) ReflectionUtils.newInstance(valueClass, conf);
  ReflectionUtils.copy(conf, kv.key, this.key);
  ReflectionUtils.copy(conf, kv.value, this.value);
  return true;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:Chain.java

示例8: writeToQueue

import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void writeToQueue(KEYOUT key, VALUEOUT value) throws IOException,
    InterruptedException {
  this.keyout = (KEYOUT) ReflectionUtils.newInstance(keyClass, conf);
  this.valueout = (VALUEOUT) ReflectionUtils.newInstance(valueClass, conf);
  ReflectionUtils.copy(conf, key, this.keyout);
  ReflectionUtils.copy(conf, value, this.valueout);

  // wait to write output to queuue
  outputQueue.enqueue(new KeyValuePair<KEYOUT, VALUEOUT>(keyout, valueout));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:Chain.java

示例9: nextKeyValue

import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
@Override
public boolean nextKeyValue() throws IOException, InterruptedException {
  synchronized (outer) {
    if (!outer.nextKeyValue()) {
      return false;
    }
    key = ReflectionUtils.copy(outer.getConfiguration(),
        outer.getCurrentKey(), key);
    value = ReflectionUtils.copy(conf, outer.getCurrentValue(), value);
    return true;
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:13,代码来源:MultithreadedTableMapper.java

示例10: testLengthIsSerialized

import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
/**
 * Length of region need to be properly serialized.
 * */
@Test
public void testLengthIsSerialized() throws Exception {
  TableSplit split1 = new TableSplit(TableName.valueOf("table"),
          "row-start".getBytes(),
          "row-end".getBytes(), "location", 666);

  TableSplit deserialized = new TableSplit(TableName.valueOf("table"),
          "row-start2".getBytes(),
          "row-end2".getBytes(), "location1");
  ReflectionUtils.copy(new Configuration(), split1, deserialized);

  Assert.assertEquals(666, deserialized.getLength());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:TestTableSplit.java

示例11: replay

import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
public boolean replay(V val) throws IOException {
  ReflectionUtils.copy(getConf(), emit(ivalue), val);
  return true;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:5,代码来源:MultiFilterRecordReader.java

示例12: replay

import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
public boolean replay(X val) throws IOException {
  ReflectionUtils.copy(conf, hold, val);
  return true;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:5,代码来源:ArrayListBackedIterator.java

示例13: key

import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
/**
 * Clone the key at the head of this RR into the object supplied.
 */
public void key(K qkey) throws IOException {
  ReflectionUtils.copy(conf, key, qkey);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:7,代码来源:WrappedRecordReader.java


注:本文中的org.apache.hadoop.util.ReflectionUtils.copy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。