本文整理匯總了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);
}
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
示例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;
}
}
示例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());
}
示例11: replay
import org.apache.hadoop.util.ReflectionUtils; //導入方法依賴的package包/類
public boolean replay(V val) throws IOException {
ReflectionUtils.copy(getConf(), emit(ivalue), val);
return true;
}
示例12: replay
import org.apache.hadoop.util.ReflectionUtils; //導入方法依賴的package包/類
public boolean replay(X val) throws IOException {
ReflectionUtils.copy(conf, hold, val);
return true;
}
示例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);
}