Class CBTypeDeclarationVariant

java.lang.Object
com.io7m.cedarbridge.schema.compiled.internal.CBTypeDeclarationVariant
All Implemented Interfaces:
CBTypeDeclarationType, CBVariantType

public final class CBTypeDeclarationVariant extends Object implements CBVariantType
A variant type declaration.
  • Constructor Details

    • CBTypeDeclarationVariant

      public CBTypeDeclarationVariant(String inName)
      Construct a variant type declaration.
      Parameters:
      inName - The type name
  • Method Details

    • addTypeParameter

      public void addTypeParameter(CBTypeParameter parameter)
      Add a type parameter.
      Parameters:
      parameter - The parameter
    • addCase

      public void addCase(CBVariantCase caseV)
      Add a variant case.
      Parameters:
      caseV - The case
    • setExternalName

      public void setExternalName(String newExternalPackage, String newExternalName)
      Set the external name.
      Parameters:
      newExternalPackage - The external package
      newExternalName - The external name
    • cases

      public List<CBVariantCaseType> cases()
      Specified by:
      cases in interface CBVariantType
      Returns:
      The cases of the variant type in declaration order
    • owner

      public CBPackageType owner()
      Specified by:
      owner in interface CBTypeDeclarationType
      Returns:
      The package that owns this declaration
    • name

      public String name()
      Specified by:
      name in interface CBTypeDeclarationType
      Returns:
      The package-unique declaration name
    • parameters

      public List<CBTypeParameterType> parameters()
      Specified by:
      parameters in interface CBTypeDeclarationType
      Returns:
      The type parameters, if any, in declaration order
    • external

      public Optional<CBExternalName> external()
      Specified by:
      external in interface CBTypeDeclarationType
      Returns:
      The external name, if any
    • documentation

      public List<String> documentation()
      Specified by:
      documentation in interface CBTypeDeclarationType
      Returns:
      Documentation for the type declaration
    • setOwner

      public void setOwner(CBPackage newOwner)
      Set the owner.
      Parameters:
      newOwner - The new owner
    • setDocumentation

      public void setDocumentation(List<String> text)
      Set the documentation.
      Parameters:
      text - The text