Example usage for org.apache.thrift.protocol TType STRUCT

List of usage examples for org.apache.thrift.protocol TType STRUCT

Introduction

In this page you can find the example usage for org.apache.thrift.protocol TType STRUCT.

Prototype

byte STRUCT

To view the source code for org.apache.thrift.protocol TType STRUCT.

Click Source Link

Usage

From source file:com.bigdata.dastor.thrift.ColumnOrSuperColumn.java

License:Apache License

public void read(TProtocol iprot) throws TException {
    TField field;/* w w  w .j a  v  a  2  s  .  co  m*/
    iprot.readStructBegin();
    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) {
            break;
        }
        switch (field.id) {
        case 1: // COLUMN
            if (field.type == TType.STRUCT) {
                this.column = new Column();
                this.column.read(iprot);
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 2: // SUPER_COLUMN
            if (field.type == TType.STRUCT) {
                this.super_column = new SuperColumn();
                this.super_column.read(iprot);
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        default:
            TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    // check for required fields of primitive type, which can't be checked in the validate method
    validate();
}

From source file:com.bigdata.dastor.thrift.Deletion.java

License:Apache License

public void read(TProtocol iprot) throws TException {
    TField field;//from   w  ww. jav a 2s  .  c o  m
    iprot.readStructBegin();
    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) {
            break;
        }
        switch (field.id) {
        case 1: // TIMESTAMP
            if (field.type == TType.I64) {
                this.timestamp = iprot.readI64();
                setTimestampIsSet(true);
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 2: // SUPER_COLUMN
            if (field.type == TType.STRING) {
                this.super_column = iprot.readBinary();
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 3: // PREDICATE
            if (field.type == TType.STRUCT) {
                this.predicate = new SlicePredicate();
                this.predicate.read(iprot);
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        default:
            TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    // check for required fields of primitive type, which can't be checked in the validate method
    if (!isSetTimestamp()) {
        throw new TProtocolException(
                "Required field 'timestamp' was not found in serialized data! Struct: " + toString());
    }
    validate();
}

From source file:com.bigdata.dastor.thrift.KeySlice.java

License:Apache License

public void write(TProtocol oprot) throws TException {
    validate();// w w w  .  ja  v a 2s  .  com

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.key != null) {
        oprot.writeFieldBegin(KEY_FIELD_DESC);
        oprot.writeString(this.key);
        oprot.writeFieldEnd();
    }
    if (this.columns != null) {
        oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
        {
            oprot.writeListBegin(new TList(TType.STRUCT, this.columns.size()));
            for (ColumnOrSuperColumn _iter11 : this.columns) {
                _iter11.write(oprot);
            }
            oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
}

From source file:com.bigdata.dastor.thrift.Mutation.java

License:Apache License

public void read(TProtocol iprot) throws TException {
    TField field;//from  w ww  .j  a va2 s  .  co  m
    iprot.readStructBegin();
    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) {
            break;
        }
        switch (field.id) {
        case 1: // COLUMN_OR_SUPERCOLUMN
            if (field.type == TType.STRUCT) {
                this.column_or_supercolumn = new ColumnOrSuperColumn();
                this.column_or_supercolumn.read(iprot);
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 2: // DELETION
            if (field.type == TType.STRUCT) {
                this.deletion = new Deletion();
                this.deletion.read(iprot);
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        default:
            TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    // check for required fields of primitive type, which can't be checked in the validate method
    validate();
}

From source file:com.bigdata.dastor.thrift.SlicePredicate.java

License:Apache License

public void read(TProtocol iprot) throws TException {
    TField field;/*from  w  w w.  j a  va  2s  .c  o  m*/
    iprot.readStructBegin();
    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) {
            break;
        }
        switch (field.id) {
        case 1: // COLUMN_NAMES
            if (field.type == TType.LIST) {
                {
                    TList _list4 = iprot.readListBegin();
                    this.column_names = new ArrayList<byte[]>(_list4.size);
                    for (int _i5 = 0; _i5 < _list4.size; ++_i5) {
                        byte[] _elem6;
                        _elem6 = iprot.readBinary();
                        this.column_names.add(_elem6);
                    }
                    iprot.readListEnd();
                }
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 2: // SLICE_RANGE
            if (field.type == TType.STRUCT) {
                this.slice_range = new SliceRange();
                this.slice_range.read(iprot);
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        default:
            TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    // check for required fields of primitive type, which can't be checked in the validate method
    validate();
}

From source file:com.bigdata.dastor.thrift.SuperColumn.java

License:Apache License

public void write(TProtocol oprot) throws TException {
    validate();//from w w  w .j a v a2s  . co  m

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.name != null) {
        oprot.writeFieldBegin(NAME_FIELD_DESC);
        oprot.writeBinary(this.name);
        oprot.writeFieldEnd();
    }
    if (this.columns != null) {
        oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
        {
            oprot.writeListBegin(new TList(TType.STRUCT, this.columns.size()));
            for (Column _iter3 : this.columns) {
                _iter3.write(oprot);
            }
            oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
}

From source file:com.ebay.nest.io.sede.dynamic_type.DynamicSerDeStruct.java

License:Apache License

@Override
public byte getType() {
    return TType.STRUCT;
}

From source file:com.ebay.nest.io.sede.thrift.TCTLSeparatedProtocol.java

License:Apache License

@Override
public void writeMapBegin(TMap map) throws TException {
    // nesting not allowed!
    if (map.keyType == TType.STRUCT || map.keyType == TType.MAP || map.keyType == TType.LIST
            || map.keyType == TType.SET) {
        throw new TException("Not implemented: nested structures");
    }/*from w  w  w  . j  ava2 s.com*/
    // nesting not allowed!
    if (map.valueType == TType.STRUCT || map.valueType == TType.MAP || map.valueType == TType.LIST
            || map.valueType == TType.SET) {
        throw new TException("Not implemented: nested structures");
    }

    firstInnerField = true;
    isMap = true;
    inner = true;
    elemIndex = 0;
}

From source file:com.ebay.nest.io.sede.thrift.TCTLSeparatedProtocol.java

License:Apache License

@Override
public void writeListBegin(TList list) throws TException {
    if (list.elemType == TType.STRUCT || list.elemType == TType.MAP || list.elemType == TType.LIST
            || list.elemType == TType.SET) {
        throw new TException("Not implemented: nested structures");
    }//  w w w.j a  v  a 2s.  c  om
    firstInnerField = true;
    inner = true;
}

From source file:com.ebay.nest.io.sede.thrift.TCTLSeparatedProtocol.java

License:Apache License

@Override
public void writeSetBegin(TSet set) throws TException {
    if (set.elemType == TType.STRUCT || set.elemType == TType.MAP || set.elemType == TType.LIST
            || set.elemType == TType.SET) {
        throw new TException("Not implemented: nested structures");
    }//from  w ww .  j a  va 2  s  .  co  m
    firstInnerField = true;
    inner = true;
}