Package com.regnosys.rosetta.generator
Class GeneratorScope<Scope extends GeneratorScope<Scope>>
java.lang.Object
com.regnosys.rosetta.generator.GeneratorScope<Scope>
- Direct Known Subclasses:
JavaScope
-
Constructor Summary
ConstructorsModifierConstructorDescriptionGeneratorScope(String description) protectedGeneratorScope(String description, Scope parent) -
Method Summary
Modifier and TypeMethodDescriptionabstract ScopechildScope(String description) Create a child scope from this one.voidclose()Mark this scope as closed.Create an identifier for the given named Rosetta object.createIdentifier(Object obj, String name) Define the desired name for a Rosetta object in this scope.voidcreateKeySynonym(Object key, Object keyWithIdentifier) Create an synonym between an object and an already existing identifiable object.voidcreateSynonym(Object key, GeneratedIdentifier identifier) Create another key for a given identifier.createUniqueIdentifier(String name) Create a new identifier with the desired name that is guaranteed not to clash with any identifiers defined before.escapeName(String name) getActualName(GeneratedIdentifier identifier) Get the actual name of the given identifier.getIdentifier(Object obj) Get the generated identifier of the given Rosetta object in the current scope, if it exists.Get the generated identifier of the given Rosetta object in the current scope, or throw if it does not exist.Get the generated identifier of the given Rosetta object in the current scope, or create a new one if it doesn't exist.getOrCreateIdentifier(Object obj, String name) Get the generated identifier of the given Rosetta object in the current scope, or create a new one with the given desired name if it doesn't exist.booleanisClosed()abstract booleanisValidIdentifier(String name) Determine whether `name` is a valid identifier in the target language.protected GeneratedIdentifieroverwriteIdentifier(Object obj, String name) toString()
-
Constructor Details
-
GeneratorScope
-
GeneratorScope
-
-
Method Details
-
childScope
Create a child scope from this one. The implementation should simply call the constructor, e.g., `return new MyScope(this.implicitVarUtil, this);`. -
isValidIdentifier
Determine whether `name` is a valid identifier in the target language. E.g., this method should return `false` if `name` is a keyword in the target language. -
escapeName
-
isClosed
public boolean isClosed() -
getParent
-
getDebugInfo
-
toString
-
getIdentifiers
-
getIdentifier
Get the generated identifier of the given Rosetta object in the current scope, if it exists. -
getIdentifierOrThrow
Get the generated identifier of the given Rosetta object in the current scope, or throw if it does not exist. -
overwriteIdentifier
-
createIdentifier
Define the desired name for a Rosetta object in this scope.- Throws:
IllegalStateException- if this scope is closed.IllegalStateException- if this scope already contains an identifier for `obj`.
-
createIdentifier
Create an identifier for the given named Rosetta object.- Throws:
IllegalStateException- if this scope is closed.IllegalStateException- if this scope already contains an identifier for `obj`.
-
createUniqueIdentifier
Create a new identifier with the desired name that is guaranteed not to clash with any identifiers defined before.- Throws:
IllegalStateException- if this scope is closed.
-
getOrCreateIdentifier
Get the generated identifier of the given Rosetta object in the current scope, or create a new one with the given desired name if it doesn't exist. -
getOrCreateIdentifier
Get the generated identifier of the given Rosetta object in the current scope, or create a new one if it doesn't exist. -
createKeySynonym
Create an synonym between an object and an already existing identifiable object.- Throws:
IllegalStateException- if this scope is closed.IllegalStateException- if this scope already contains an identifier for `key`.IllegalStateException- if this scope does not contain an identifier for `keyWithIdentifier`.
-
createSynonym
Create another key for a given identifier.- Throws:
IllegalStateException- if this scope is closed.IllegalStateException- if this scope already contains an identifier for `key`.
-
close
public void close()Mark this scope as closed. New identifiers cannot be added to a closed scope.- Throws:
IllegalStateException- if this scope is closed.
-
getActualName
Get the actual name of the given identifier. Also closes the scope and its parent scopes if they weren't closed yet. -
getTakenNames
-