Class Definitions
- java.lang.Object
-
- manifold.preprocessor.definitions.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#defineand#undefdirectives in the compiling source file. Parent definitions correspond with the following:-
build.propertiesfiles 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. SeeBuildVariantSymbols.
#defineand#undefare limited to the file scope. This means#definedefinitions are not available to other files. Similarly, parent definitions masked with#undefare not affected in other files.
-
-
Field Summary
Fields Modifier and Type Field Description static StringBUILD_PROPERTIES
-
Constructor Summary
Constructors Modifier Constructor Description Definitions(manifold.api.fs.IFile definitionsSource)protectedDefinitions(Definitions root, manifold.api.fs.IFile definitionsSource, Map<String,String> definitions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Stringdefine(String def)Definedefin the source file's local definition space.Stringdefine(String def, String value)Definedefin the source file's local definition space withvalue.booleanequals(Object o)protected DefinitionsgetParent()protected DefinitionsgetRoot()protected manifold.api.fs.IFilegetSourceFile()StringgetValue(String def)inthashCode()booleanisDefined(String def)protected Map<String,String>loadEnvironmentDefinitions()protected Map<String,String>loadJavacDefinitions()protected DefinitionsloadParentDefinitions()protected DefinitionsmakeBuildPropertiesDefinitions()Stringundef(String def)Removedeffrom the File's local definition space.
-
-
-
Field Detail
-
BUILD_PROPERTIES
public static final String BUILD_PROPERTIES
- See Also:
- Constant Field Values
-
-
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
-
getRoot
protected Definitions getRoot()
-
getSourceFile
protected manifold.api.fs.IFile getSourceFile()
-
getParent
protected Definitions getParent()
-
loadParentDefinitions
protected Definitions loadParentDefinitions()
-
makeBuildPropertiesDefinitions
protected Definitions makeBuildPropertiesDefinitions()
-
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, String value)
Definedefin the source file's local definition space withvalue.
-
undef
public String undef(String def)
Removedeffrom the File's local definition space. Note ifdefis defined in a parent scope e.g., a properties file, it remains defined. In other words#undefapplies exclusively to the source file scope.
-
-