Class JXESchemaDefinition

java.lang.Object
com.io7m.jxe.core.JXESchemaDefinition
All Implemented Interfaces:
JXESchemaDefinitionType

public final class JXESchemaDefinition extends Object implements JXESchemaDefinitionType
The type of schema definitions. A schema definition is typically used with a JXEHardenedDispatchingResolver to resolve schemas from internal Java resources. When an XML parser is required to locate the XSD schema for a namespace n, it consults the map of schema definitions and, if a schema exists with the given namespace URI, passes the fileIdentifier() to the dispatching resolver which then uses that identifier to open location().
  • Method Details

    • namespace

      public URI namespace()
      Specified by:
      namespace in interface JXESchemaDefinitionType
      Returns:
      The schema namespace URI
    • fileIdentifier

      public String fileIdentifier()
      Specified by:
      fileIdentifier in interface JXESchemaDefinitionType
      Returns:
      The file identifier used to load the schema
    • location

      public URL location()
      Specified by:
      location in interface JXESchemaDefinitionType
      Returns:
      The schema location
    • withNamespace

      public final JXESchemaDefinition withNamespace(URI value)
      Copy the current immutable object by setting a value for the namespace attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for namespace
      Returns:
      A modified copy of the this object
    • withFileIdentifier

      public final JXESchemaDefinition withFileIdentifier(String value)
      Copy the current immutable object by setting a value for the fileIdentifier attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for fileIdentifier
      Returns:
      A modified copy of the this object
    • withLocation

      public final JXESchemaDefinition withLocation(URL value)
      Copy the current immutable object by setting a value for the location attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for location
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of JXESchemaDefinition that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: namespace, fileIdentifier.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value JXESchemaDefinition with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • of

      public static JXESchemaDefinition of(URI namespace, String fileIdentifier, URL location)
      Construct a new immutable JXESchemaDefinition instance.
      Parameters:
      namespace - The value for the namespace attribute
      fileIdentifier - The value for the fileIdentifier attribute
      location - The value for the location attribute
      Returns:
      An immutable JXESchemaDefinition instance
    • copyOf

      public static JXESchemaDefinition copyOf(JXESchemaDefinitionType instance)
      Creates an immutable copy of a JXESchemaDefinitionType value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable JXESchemaDefinition instance
    • builder

      public static JXESchemaDefinition.Builder builder()
      Creates a builder for JXESchemaDefinition.
       JXESchemaDefinition.builder()
          .setNamespace(java.net.URI) // required namespace
          .setFileIdentifier(String) // required fileIdentifier
          .setLocation(java.net.URL) // required location
          .build();
       
      Returns:
      A new JXESchemaDefinition builder