Record Class ScriptDef
java.lang.Object
java.lang.Record
io.micronaut.python.processing.visitor.ScriptDef
- Record Components:
name- The name of the script/module.packageName- The package name of the script.functions- The functions defined at module level.attributes- The attributes defined at module level.documentation- The script documentation string.decorators- The annotations invoked at module level.
- All Implemented Interfaces:
ElementDef
public record ScriptDef(String name, String packageName, List<FunctionDef> functions, List<AttributeDef> attributes, String documentation, List<DecoratorDef> decorators)
extends Record
implements ElementDef
A ScriptDef node represents a Python script/module definition.
Scripts are module-level constructs that can have attributes (module variables)
and functions (module-level functions).
ScriptDef(identifier name, list[FunctionDef] functions, list[AttributeDef] attributes)
-
Constructor Summary
ConstructorsConstructorDescriptionScriptDef(String name, String packageName, List<FunctionDef> functions, List<AttributeDef> attributes, String documentation) Backwards-compatible constructor for scripts without module annotations.ScriptDef(String name, String packageName, List<FunctionDef> functions, List<AttributeDef> attributes, String documentation, List<DecoratorDef> decorators) Creates an instance of aScriptDefrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theattributesrecord component.Returns the value of thedecoratorsrecord component.Returns the value of thedocumentationrecord component.booleanIndicates whether some other object is "equal to" this one.Returns the value of thefunctionsrecord component.inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.Returns the value of thepackageNamerecord component.static StringtoJavaClassName(String moduleName) Converts a Python module name into the Java simple name used for its generated stub.final StringtoString()Returns a string representation of this record class.withAttribute(AttributeDef attribute) withFunction(FunctionDef function)
-
Constructor Details
-
ScriptDef
public ScriptDef(String name, String packageName, List<FunctionDef> functions, List<AttributeDef> attributes, String documentation, List<DecoratorDef> decorators) Creates an instance of aScriptDefrecord class.- Parameters:
name- the value for thenamerecord componentpackageName- the value for thepackageNamerecord componentfunctions- the value for thefunctionsrecord componentattributes- the value for theattributesrecord componentdocumentation- the value for thedocumentationrecord componentdecorators- the value for thedecoratorsrecord component
-
ScriptDef
public ScriptDef(String name, String packageName, List<FunctionDef> functions, List<AttributeDef> attributes, String documentation) Backwards-compatible constructor for scripts without module annotations.- Parameters:
name- The script namepackageName- The package namefunctions- The functionsattributes- The attributesdocumentation- The documentation
-
ScriptDef
-
-
Method Details
-
withFunction
-
withAttribute
-
qualifiedName
-
toJavaClassName
Converts a Python module name into the Java simple name used for its generated stub. Separators and underscores are treated as word boundaries, and names beginning with a digit are prefixed with an underscore.- Parameters:
moduleName- The Python module name without the.pysuffix- Returns:
- A valid Java class name
-
equals
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 withObjects::equals(Object,Object). -
hashCode
-
toString
-
name
Returns the value of thenamerecord component.- Specified by:
namein interfaceElementDef- Returns:
- the value of the
namerecord component
-
packageName
Returns the value of thepackageNamerecord component.- Returns:
- the value of the
packageNamerecord component
-
functions
-
attributes
Returns the value of theattributesrecord component.- Returns:
- the value of the
attributesrecord component
-
documentation
Returns the value of thedocumentationrecord component.- Returns:
- the value of the
documentationrecord component
-
decorators
Returns the value of thedecoratorsrecord component.- Specified by:
decoratorsin interfaceElementDef- Returns:
- the value of the
decoratorsrecord component
-