This class provides a convenient base for Tuple implementations. This makes it easier to provide default implementations as the Tuple interface is evolved.
| 29 | * to provide default implementations as the Tuple interface is evolved. |
| 30 | */ |
| 31 | public abstract class AbstractTuple implements Tuple { |
| 32 | @Override |
| 33 | public Iterator<Object> iterator() { |
| 34 | return getAll().iterator(); |
| 35 | } |
| 36 | |
| 37 | @Override |
| 38 | public String toString() { |
| 39 | return TupleFormat.format(this); |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * {@inheritDoc} |
| 44 | */ |
| 45 | @Override |
| 46 | public String toDelimitedString(String delim) throws ExecException { |
| 47 | return Joiner.on(delim).useForNull("").join(this); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * {@inheritDoc} |
| 52 | */ |
| 53 | @Override |
| 54 | public byte getType(int fieldNum) throws ExecException { |
| 55 | return DataType.findType(get(fieldNum)); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * {@inheritDoc} |
| 60 | */ |
| 61 | @Override |
| 62 | public boolean isNull(int fieldNum) throws ExecException { |
| 63 | return (get(fieldNum) == null); |
| 64 | } |
| 65 | |
| 66 | @Override |
| 67 | public boolean equals(Object other) { |
| 68 | return (compareTo(other) == 0); |
| 69 | } |
| 70 | |
| 71 | @Override |
| 72 | public void reference(Tuple t) { |
| 73 | throw new RuntimeException("Tuple#reference(Tuple) is deprecated and should not be used"); |
| 74 | } |
| 75 | } |
nothing calls this directly
no outgoing calls
no test coverage detected