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

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

Introduction

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

Prototype

byte SET

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

Click Source Link

Usage

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

License:Apache License

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

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");
    }// w  w w  .  j  av a  2 s . co  m
    // 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");
    }/*from   w w w  . j  a  va 2s .c  o m*/
    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  v a2 s .  c o  m*/
    firstInnerField = true;
    inner = true;
}

From source file:com.facebook.swift.codec.internal.TProtocolReader.java

License:Apache License

public <E> Set<E> readSetField(ThriftCodec<Set<E>> setCodec) throws Exception {
    if (!checkReadState(TType.SET)) {
        return null;
    }/*from  ww w. j ava2s . c  om*/
    currentField = null;
    Set<E> fieldValue = setCodec.read(protocol);
    protocol.readFieldEnd();
    return fieldValue;
}

From source file:com.facebook.swift.codec.internal.TProtocolWriter.java

License:Apache License

public <E> void writeSetField(String name, short id, ThriftCodec<Set<E>> codec, Set<E> set) throws Exception {
    if (set == null) {
        return;//from   w w  w  .  j a v  a 2  s. c  om
    }

    protocol.writeFieldBegin(new TField(name, TType.SET, id));
    codec.write(set, protocol);
    protocol.writeFieldEnd();
}

From source file:com.linecorp.armeria.common.thrift.ThriftUtil.java

License:Apache License

/**
 * Converts the specified {@link FieldValueMetaData} into its corresponding Java type.
 *//*from  w  ww  .j a v  a 2 s. com*/
public static Class<?> toJavaType(FieldValueMetaData metadata) {
    switch (metadata.type) {
    case TType.BOOL:
        return Boolean.class;
    case TType.BYTE:
        return Byte.class;
    case TType.DOUBLE:
        return Double.class;
    case TType.ENUM:
        return Enum.class;
    case TType.I16:
        return Short.class;
    case TType.I32:
        return Integer.class;
    case TType.I64:
        return Long.class;
    case TType.LIST:
        return List.class;
    case TType.MAP:
        return Map.class;
    case TType.SET:
        return Set.class;
    case TType.STRING:
        return String.class;
    case TType.STRUCT:
        return ((StructMetaData) metadata).structClass;
    case TType.VOID:
        return Void.class;
    }

    // Should never reach here.
    throw new Error();
}

From source file:com.linecorp.armeria.server.docs.SetInfo.java

License:Apache License

static SetInfo of(SetMetaData setMetaData, Map<String, String> docStrings) {
    requireNonNull(setMetaData, "setMetaData");

    assert setMetaData.type == TType.SET;
    assert !setMetaData.isBinary();

    return new SetInfo(of(setMetaData.elemMetaData, docStrings));
}

From source file:com.linecorp.armeria.server.docs.SetInfoTest.java

License:Apache License

@Test
public void testOf() throws Exception {
    final SetInfo set = SetInfo.of(new SetMetaData(TType.SET, new FieldValueMetaData(TType.I64, false)));

    assertThat(set, is(SetInfo.of(TypeInfo.of(ValueType.I64, false))));
}

From source file:com.linecorp.armeria.server.docs.ValueType.java

License:Apache License

static ValueType of(byte type) {
    switch (type) {
    case TType.STOP:
        return ValueType.STOP;
    case TType.VOID:
        return ValueType.VOID;
    case TType.BOOL:
        return ValueType.BOOL;
    case TType.BYTE:
        return ValueType.BYTE;
    case TType.DOUBLE:
        return ValueType.DOUBLE;
    case TType.I16:
        return ValueType.I16;
    case TType.I32:
        return ValueType.I32;
    case TType.I64:
        return ValueType.I64;
    case TType.STRING:
        return ValueType.STRING;
    case TType.STRUCT:
        return ValueType.STRUCT;
    case TType.MAP:
        return ValueType.MAP;
    case TType.SET:
        return ValueType.SET;
    case TType.LIST:
        return ValueType.LIST;
    case TType.ENUM:
        return ValueType.ENUM;
    default:// w w  w  . jav a  2  s  . c o  m
        throw new IllegalArgumentException("unknown field value type: " + type);
    }
}