當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。