Example usage for org.apache.thrift.meta_data FieldValueMetaData isStruct

List of usage examples for org.apache.thrift.meta_data FieldValueMetaData isStruct

Introduction

In this page you can find the example usage for org.apache.thrift.meta_data FieldValueMetaData isStruct.

Prototype

public boolean isStruct() 

Source Link

Usage

From source file:com.linecorp.armeria.server.thrift.ThriftDocServicePlugin.java

License:Apache License

@VisibleForTesting
static FieldInfo newFieldInfo(Class<?> parentType, FieldMetaData fieldMetaData) {
    requireNonNull(fieldMetaData, "fieldMetaData");
    final FieldValueMetaData fieldValueMetaData = fieldMetaData.valueMetaData;
    final TypeSignature typeSignature;

    if (fieldValueMetaData.isStruct() && fieldValueMetaData.isTypedef()
            && parentType.getSimpleName().equals(fieldValueMetaData.getTypedefName())) {
        // Handle the special case where a struct field refers to itself,
        // where the Thrift compiler handles it as a typedef.
        typeSignature = TypeSignature.ofNamed(parentType);
    } else {/*from  w w w .j  a va2  s. c o  m*/
        typeSignature = toTypeSignature(fieldValueMetaData);
    }

    return new FieldInfo(fieldMetaData.fieldName, convertRequirement(fieldMetaData.requirementType),
            typeSignature);
}