Package org.pkl.core

Class ModuleSchema


  • public final class ModuleSchema
    extends java.lang.Object
    Describes the property, method and class members of a module.
    • Constructor Summary

      Constructors 
      Constructor Description
      ModuleSchema​(java.net.URI moduleUri, java.lang.String moduleName, boolean isAmend, @Nullable ModuleSchema supermodule, PClass moduleClass, @Nullable java.lang.String docComment, java.util.List<PObject> annotations, java.util.Map<java.lang.String,​PClass> classes, java.util.Map<java.lang.String,​TypeAlias> typeAliases, java.util.Map<java.lang.String,​java.net.URI> imports)
      Constructs a ModuleSchema instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​PClass> getAllClasses()
      Returns all classes defined in this module and its supermodules in declaration order.
      java.util.Map<java.lang.String,​TypeAlias> getAllTypeAliases()
      Returns all type aliases defined in this module and its supermodules in declaration order.
      java.util.List<PObject> getAnnotations()
      Returns the annotations of this module.
      java.util.Map<java.lang.String,​PClass> getClasses()
      Returns the classes defined in this module in declaration order.
      @Nullable java.lang.String getDocComment()
      Returns the doc comment of this module (if any).
      java.util.Map<java.lang.String,​java.net.URI> getImports()
      Returns the imports declared in this module.
      PClass getModuleClass()
      Returns the class of this module, which describes the properties and methods defined in this module.
      java.lang.String getModuleName()
      Returns the name of this module.
      java.net.URI getModuleUri()
      Returns the absolute URI from which this module was first loaded.
      java.lang.String getShortModuleName()
      Returns the last name part of a dot-separated getModuleName(), or the entire getModuleName() if it is not dot-separated.
      @Nullable ModuleSchema getSupermodule()
      Returns this module's supermodule, or null if this module does not amend or extend another module.
      java.util.Map<java.lang.String,​TypeAlias> getTypeAliases()
      Returns the type aliases defined in this module in declaration order.
      boolean isAmend()
      Tells if this module amends a module (namely getSupermodule()).
      boolean isExtend()
      Tells if this module extends a module (namely getSupermodule()).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ModuleSchema

        public ModuleSchema​(java.net.URI moduleUri,
                            java.lang.String moduleName,
                            boolean isAmend,
                            @Nullable ModuleSchema supermodule,
                            PClass moduleClass,
                            @Nullable java.lang.String docComment,
                            java.util.List<PObject> annotations,
                            java.util.Map<java.lang.String,​PClass> classes,
                            java.util.Map<java.lang.String,​TypeAlias> typeAliases,
                            java.util.Map<java.lang.String,​java.net.URI> imports)
        Constructs a ModuleSchema instance.
    • Method Detail

      • getModuleUri

        public java.net.URI getModuleUri()
        Returns the absolute URI from which this module was first loaded.
      • getModuleName

        public java.lang.String getModuleName()
        Returns the name of this module.

        Note that module names are not guaranteed to be unique, especially if they are not declared but inferred from the module URI.

      • getShortModuleName

        public java.lang.String getShortModuleName()
        Returns the last name part of a dot-separated getModuleName(), or the entire getModuleName() if it is not dot-separated.
      • getSupermodule

        public @Nullable ModuleSchema getSupermodule()
        Returns this module's supermodule, or null if this module does not amend or extend another module.
      • isAmend

        public boolean isAmend()
        Tells if this module amends a module (namely getSupermodule()).
      • isExtend

        public boolean isExtend()
        Tells if this module extends a module (namely getSupermodule()).
      • getDocComment

        public @Nullable java.lang.String getDocComment()
        Returns the doc comment of this module (if any).
      • getAnnotations

        public java.util.List<PObject> getAnnotations()
        Returns the annotations of this module.
      • getModuleClass

        public PClass getModuleClass()
        Returns the class of this module, which describes the properties and methods defined in this module.
      • getImports

        public java.util.Map<java.lang.String,​java.net.URI> getImports()
        Returns the imports declared in this module.

        Map keys are the identifiers by which imports are accessed within this module. Map values are the URIs of the imported modules.

        Does not cover import expressions.

      • getClasses

        public java.util.Map<java.lang.String,​PClass> getClasses()
        Returns the classes defined in this module in declaration order.
      • getAllClasses

        public java.util.Map<java.lang.String,​PClass> getAllClasses()
        Returns all classes defined in this module and its supermodules in declaration order. Supermodule classes are ordered before submodule classes.
      • getTypeAliases

        public java.util.Map<java.lang.String,​TypeAlias> getTypeAliases()
        Returns the type aliases defined in this module in declaration order.
      • getAllTypeAliases

        public java.util.Map<java.lang.String,​TypeAlias> getAllTypeAliases()
        Returns all type aliases defined in this module and its supermodules in declaration order. Supermodule type aliases are ordered before submodule type aliases.