Example usage for org.apache.thrift TFieldRequirementType DEFAULT

List of usage examples for org.apache.thrift TFieldRequirementType DEFAULT

Introduction

In this page you can find the example usage for org.apache.thrift TFieldRequirementType DEFAULT.

Prototype

byte DEFAULT

To view the source code for org.apache.thrift TFieldRequirementType DEFAULT.

Click Source Link

Usage

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

License:Apache License

static RequirementType of(byte requirementType) {
    switch (requirementType) {
    case TFieldRequirementType.REQUIRED:
        return RequirementType.REQUIRED;
    case TFieldRequirementType.OPTIONAL:
        return RequirementType.OPTIONAL;
    case TFieldRequirementType.DEFAULT:
        return RequirementType.DEFAULT;
    default://from   w  w  w .j a va  2s.c o m
        throw new IllegalArgumentException("unknown requirement type: " + requirementType);
    }
}

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

License:Apache License

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:/*from   ww  w  .ja  va  2  s  .c  o  m*/
        throw new IllegalArgumentException("unknown requirement type: " + value);
    }
}

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

License:Apache License

@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))))));
}

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

License:Apache License

@Test
public void testNewExceptionInfo() throws Exception {
    final ExceptionInfo exception = newExceptionInfo(FooServiceException.class, emptyMap());

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