Class Definitions

  • Direct Known Subclasses:
    ServiceDefinitions

    public class Definitions
    extends Object
    Models definitions as a hierarchy of maps. Searches for a definition in leaf-first order where the leaf definitions are controlled by the #define and #undef directives in the compiling source file. Parent definitions correspond with the following:
    • build.properties files in the source file's directory ancestry
    • Custom compiler arguments provided by the -Akey[=value] javac command line option
    • Compiler and JVM environment settings such as Java source version, JPMS mode, operating system, etc.
    • Custom service provider implementations of SymbolProvider. See BuildVariantSymbols.
    Note the effects of #define and #undef are limited to the file scope. This means #define definitions are not available to other files. Similarly, parent definitions masked with #undef are not affected in other files.
    • Constructor Detail

      • Definitions

        public Definitions​(manifold.api.fs.IFile definitionsSource)
      • Definitions

        protected Definitions​(Definitions root,
                              manifold.api.fs.IFile definitionsSource,
                              Map<String,​String> definitions)
    • Method Detail

      • getSourceFile

        protected manifold.api.fs.IFile getSourceFile()
      • loadParentDefinitions

        protected Definitions loadParentDefinitions()
      • makeBuildPropertiesDefinitions

        protected Definitions makeBuildPropertiesDefinitions()
      • loadJavacDefinitions

        protected Map<String,​String> loadJavacDefinitions()
      • loadEnvironmentDefinitions

        protected Map<String,​String> loadEnvironmentDefinitions()
      • clear

        public void clear()
      • isDefined

        public boolean isDefined​(String def)
        Returns:
        True if there is a definition having name def, regardless of its value.
      • define

        public String define​(String def)
        Define def in the source file's local definition space.
      • define

        public String define​(String def,
                             String value)
        Define def in the source file's local definition space with value.
      • undef

        public String undef​(String def)
        Remove def from the File's local definition space. Note if def is defined in a parent scope e.g., a properties file, it remains defined. In other words #undef applies exclusively to the source file scope.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object