Enum Class SchemaNotation

java.lang.Object
java.lang.Enum<SchemaNotation>
org.refcodes.schema.SchemaNotation
All Implemented Interfaces:
Serializable, Comparable<SchemaNotation>, Constable, SchemaVisitor<String>

public enum SchemaNotation extends Enum<SchemaNotation> implements SchemaVisitor<String>

Predefined schema notations backed by SchemaVisitor implementations.

Each enum constant wraps a SchemaVisitor that renders a Schema into a textual notation (for example JSON, XML, or PlantUML).

As SchemaNotation implements SchemaVisitor, it can be used directly with Schema.visit(SchemaVisitor) or via Schema.toNotation(SchemaNotation).

  • Enum Constant Details

  • Method Details

    • values

      public static SchemaNotation[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static SchemaNotation valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • visit

      public String visit(Schema aSchema)

      Visits the given Schema instance and returns the produced result.

      Implementations typically traverse the schema recursively and aggregate results from child schemas.

      Specified by:
      visit in interface SchemaVisitor<String>
      Parameters:
      aSchema - the schema to visit
      Returns:
      the result produced by the visitor