Java 类org.apache.thrift.TFieldRequirementType 实例源码

项目:armeria    文件:ThriftDocServicePlugin.java   
private static FieldRequirement convertRequirement(byte value) {
    switch (value) {
        case TFieldRequirementType.REQUIRED:
            return FieldRequirement.REQUIRED;
        case TFieldRequirementType.OPTIONAL:
            return FieldRequirement.OPTIONAL;
        case TFieldRequirementType.DEFAULT:
            return FieldRequirement.DEFAULT;
        default:
            throw new IllegalArgumentException("unknown requirement type: " + value);
    }
}
项目:armeria    文件:ThriftDocServicePluginTest.java   
@Test
public void testNewExceptionInfo() throws Exception {
    final ExceptionInfo exception = newExceptionInfo(FooServiceException.class);

    assertThat(exception).isEqualTo(new ExceptionInfo(
            FooServiceException.class.getName(),
            ImmutableList.of(newFieldInfo(
                    FooServiceException.class,
                    new FieldMetaData("stringVal", TFieldRequirementType.DEFAULT,
                                      new FieldValueMetaData(TType.STRING, false))))));
}