Tabnine Logo
UnionDefinition$Builder.build
Code IndexAdd Tabnine to your IDE (free)

How to use
build
method
in
com.palantir.conjure.spec.UnionDefinition$Builder

Best Java code snippets using com.palantir.conjure.spec.UnionDefinition$Builder.build (Showing top 4 results out of 315)

origin: palantir/conjure

public static TypeDefinition parseUnionType(
    TypeName name,
    com.palantir.conjure.parser.types.complex.UnionTypeDefinition def,
    ConjureTypeParserVisitor.ReferenceTypeResolver typeResolver) {
  UnionDefinition unionType = UnionDefinition.builder()
      .typeName(name)
      .union(parseField(def.union(), typeResolver))
      .docs(def.docs().map(Documentation::of))
      .build();
  UnionDefinitionValidator.validateAll(unionType);
  return TypeDefinition.union(unionType);
}
origin: palantir/conjure

@Test
public void testUnionMemberKeyMustNotBeIllegalJavaIdentifier() {
  ImmutableList.of("%foo", "foo@").forEach(key -> {
    FieldDefinition fieldDefinition = FieldDefinition.builder()
        .fieldName(FieldName.of(key))
        .type(Type.primitive(PrimitiveType.STRING))
        .build();
    assertThatThrownBy(() ->
        UnionDefinitionValidator.validateAll(UnionDefinition.builder()
            .union(fieldDefinition)
            .typeName(TypeName.of("string", ""))
            .build()))
        .isInstanceOf(IllegalArgumentException.class)
          .hasMessageStartingWith(
              String.format("Union member key must be a valid Java identifier: %s", key));
  });
}
origin: palantir/conjure

@Test
public void testUnionMemberKeyMustNotBeEmpty() {
  FieldDefinition fieldDefinition = FieldDefinition.builder()
      .fieldName(FieldName.of(""))
      .type(Type.primitive(PrimitiveType.STRING))
      .build();
  assertThatThrownBy(() ->
      UnionDefinitionValidator.validateAll(UnionDefinition.builder()
          .union(fieldDefinition)
          .typeName(TypeName.of("string", ""))
          .build()))
      .isInstanceOf(IllegalArgumentException.class)
      .hasMessageStartingWith("Union member key must not be empty");
}
origin: palantir/conjure

  @Test
  public void testUnionMemberKeyMustNotHaveTrailingUnderscore() {
    FieldDefinition fieldDefinition = FieldDefinition.builder()
        .fieldName(FieldName.of("foo_"))
        .type(Type.primitive(PrimitiveType.STRING))
        .build();
    assertThatThrownBy(() ->
        UnionDefinitionValidator.validateAll(UnionDefinition.builder()
            .union(fieldDefinition)
            .typeName(TypeName.of("string", ""))
            .build()))
      .isInstanceOf(IllegalArgumentException.class)
      .hasMessageStartingWith("Union member key must not end with an underscore: foo_");
  }
}
com.palantir.conjure.specUnionDefinition$Builderbuild

Popular methods of UnionDefinition$Builder

  • typeName
  • union
  • docs

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • setRequestProperty (URLConnection)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now