public class WritableUnion extends Object implements Union, org.apache.hadoop.io.Writable
Modifier | Constructor and Description |
---|---|
protected |
WritableUnion(Class<?>... classes)
Creates a new instance.
|
protected |
WritableUnion(org.apache.hadoop.io.Writable... objects)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
Object |
getObject()
Returns the current object in union.
|
int |
getPosition()
Returns the current position in union.
|
void |
readFields(DataInput in) |
Object |
switchObject(int newPosition)
Switches position and get its object.
|
String |
toString() |
void |
write(DataOutput out) |
protected WritableUnion(Class<?>... classes)
classes
- element classesIllegalArgumentException
- if some parameters were null
protected WritableUnion(org.apache.hadoop.io.Writable... objects)
objects
- elementsIllegalArgumentException
- if some parameters were null
public final int getPosition()
Union
getPosition
in interface Union
public Object switchObject(int newPosition)
Union
switchObject
in interface Union
newPosition
- the position to setpublic final Object getObject()
Union
public void write(DataOutput out) throws IOException
write
in interface org.apache.hadoop.io.Writable
IOException
public void readFields(DataInput in) throws IOException
readFields
in interface org.apache.hadoop.io.Writable
IOException
Copyright © 2011–2019 Asakusa Framework Team. All rights reserved.