Record Class CsdlDocument

java.lang.Object
java.lang.Record
io.skipcheck.tm1.csdl.CsdlDocument
Record Components:
version - the edmx:Edmx Version, e.g. 4.0
schemas - the schemas, in document order

public record CsdlDocument(String version, List<CsdlSchema> schemas) extends Record
A parsed CSDL document ($metadata): its schemas, and lookups across them.

Lookups take a qualified name using either the namespace or the alias, so ibm.tm1.api.v1.Cube and tm1.Cube find the same type.

  • Field Details

    • SCHEMA_VERSION_TERM

      public static final String SCHEMA_VERSION_TERM
      The term holding the service's schema version.
      See Also:
  • Constructor Details

    • CsdlDocument

      public CsdlDocument(String version, List<CsdlSchema> schemas)
      Validates and copies the components.
  • Method Details

    • qualify

      public String qualify(String qualifiedName)
      Rewrites a qualified name to use its schema's namespace rather than its alias: tm1.Cube becomes ibm.tm1.api.v1.Cube. Names in other namespaces, such as Edm.String, are returned unchanged.
      Parameters:
      qualifiedName - a name qualified by namespace or alias
      Returns:
      the name qualified by namespace
    • schemaVersion

      public Optional<String> schemaVersion()
      The schema version from Core.SchemaVersion, e.g. 11.8.35, if declared.
      Returns:
      the schema version, or empty if no schema declares one
    • entityContainer

      public Optional<CsdlEntityContainer> entityContainer()
      The document's entity container, if any.
      Returns:
      the first schema's entity container, or empty if none has one
    • entityType

      public Optional<CsdlEntityType> entityType(String qualifiedName)
      The entity type with this qualified name.
      Parameters:
      qualifiedName - the type's name, qualified by namespace or alias
      Returns:
      the entity type, or empty if the document doesn't define it
    • complexType

      public Optional<CsdlComplexType> complexType(String qualifiedName)
      The complex type with this qualified name.
      Parameters:
      qualifiedName - the type's name, qualified by namespace or alias
      Returns:
      the complex type, or empty if the document doesn't define it
    • structuredType

      public Optional<CsdlStructuredType> structuredType(String qualifiedName)
      The entity or complex type with this qualified name.
      Parameters:
      qualifiedName - the type's name, qualified by namespace or alias
      Returns:
      the type, or empty if the document doesn't define it
    • enumType

      public Optional<CsdlEnumType> enumType(String qualifiedName)
      The enum type with this qualified name.
      Parameters:
      qualifiedName - the type's name, qualified by namespace or alias
      Returns:
      the enum type, or empty if the document doesn't define it
    • operations

      public List<CsdlOperation> operations(String qualifiedName)
      Every overload of the action or function with this qualified name.
      Parameters:
      qualifiedName - the operation's name, qualified by namespace or alias
      Returns:
      the overloads in document order, or an empty list if there are none
    • boundTo

      public List<CsdlOperation> boundTo(String qualifiedTypeName)
      The operations bound to this type (not collections of it), e.g. every tm1.Cube action.
      Parameters:
      qualifiedTypeName - the binding type's name, qualified by namespace or alias
      Returns:
      the bound operations in document order, or an empty list if there are none
    • typeHierarchy

      public List<CsdlStructuredType> typeHierarchy(String qualifiedName)
      A structured type followed by its base types, nearest first. Stops at a base type the document doesn't define, and at a cycle (which valid CSDL never has).
      Parameters:
      qualifiedName - the type's name, qualified by namespace or alias
      Returns:
      the type and its base types, or an empty list if the document doesn't define the type
    • qualifiedName

      public Optional<String> qualifiedName(CsdlStructuredType type)
      The qualified name, by namespace, of a type defined in one of this document's schemas.
      Parameters:
      type - the type to name
      Returns:
      its name qualified by namespace, or empty if it isn't in this document
    • structuredTypes

      public Stream<CsdlStructuredType> structuredTypes()
      Every structured type in the document.
      Returns:
      the entity and complex types, schema by schema, entity types first
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • version

      public String version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component
    • schemas

      public List<CsdlSchema> schemas()
      Returns the value of the schemas record component.
      Returns:
      the value of the schemas record component