Record Class SuperArgumentDef
java.lang.Object
java.lang.Record
io.micronaut.python.processing.model.SuperArgumentDef
- Record Components:
source- The argument source text, for diagnosticskeyword- The keyword when the argument was passed by keyword, otherwisenullparameterName- The name of the constructor parameter the argument refers to, otherwisenulltype- The static Python type of the argument when it is known (str,int,float,bool,Noneor the called class), otherwisenullconflictingCall- The source of anothersuper().__init__(...)call of the same constructor that passes different arguments, otherwisenull
public record SuperArgumentDef(String source, @Nullable String keyword, @Nullable String parameterName, @Nullable TypeRef type, @Nullable String conflictingCall)
extends Record
One argument of the
super().__init__(...) call in a Python constructor.
The processor records what it can tell about the argument without running the code: a reference to a constructor parameter, a literal (or f-string) with its Python type, a call of a class, or nothing at all. The stub generator uses the recorded type to pick the Java super constructor that the argument reaches when the Python class extends a Java class.
- Since:
- 5.2.0
- Author:
- Micronaut Team
-
Constructor Summary
ConstructorsConstructorDescriptionSuperArgumentDef(String source, @Nullable String keyword, @Nullable String parameterName, @Nullable TypeRef type) SuperArgumentDef(String source, @Nullable String keyword, @Nullable String parameterName, @Nullable TypeRef type, @Nullable String conflictingCall) Creates an instance of aSuperArgumentDefrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic SuperArgumentDefconflicting(String source, String conflictingCall) The record of a constructor callingsuper().__init__(...)in more than one way: the arguments of the first call, with the source of a differing call.Returns the value of theconflictingCallrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanbooleanbooleanbooleanisSpread()keyword()Returns the value of thekeywordrecord component.static SuperArgumentDefAn argument passed by keyword.static SuperArgumentDefAn argument that refers to a constructor parameter.Returns the value of theparameterNamerecord component.source()Returns the value of thesourcerecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.static SuperArgumentDefAn argument of a known static type.static SuperArgumentDefAn argument whose type the processor cannot tell.
-
Constructor Details
-
SuperArgumentDef
public SuperArgumentDef(String source, @Nullable @Nullable String keyword, @Nullable @Nullable String parameterName, @Nullable @Nullable TypeRef type, @Nullable @Nullable String conflictingCall) Creates an instance of aSuperArgumentDefrecord class.- Parameters:
source- the value for thesourcerecord componentkeyword- the value for thekeywordrecord componentparameterName- the value for theparameterNamerecord componenttype- the value for thetyperecord componentconflictingCall- the value for theconflictingCallrecord component
-
SuperArgumentDef
-
-
Method Details
-
parameter
An argument that refers to a constructor parameter.- Parameters:
source- The source textparameterName- The parameter name- Returns:
- The argument
-
typed
An argument of a known static type.- Parameters:
source- The source texttype- The Python type- Returns:
- The argument
-
unknown
An argument whose type the processor cannot tell.- Parameters:
source- The source text- Returns:
- The argument
-
keyword
An argument passed by keyword.- Parameters:
source- The source textkeyword- The keyword- Returns:
- The argument
-
conflicting
The record of a constructor callingsuper().__init__(...)in more than one way: the arguments of the first call, with the source of a differing call. A Python class extending a Java class has one Java super constructor, so the calls have to agree.- Parameters:
source- The source of the first callconflictingCall- The source of a call that differs- Returns:
- The argument
-
isConflicting
public boolean isConflicting()- Returns:
- Whether another
super().__init__(...)call of the constructor passes different arguments
-
isSpread
public boolean isSpread()- Returns:
- Whether the argument spreads the constructor's own
*argsor**kwargsinto the call
-
isParameter
public boolean isParameter()- Returns:
- Whether the argument refers to a constructor parameter
-
isKeyword
public boolean isKeyword()- Returns:
- Whether the argument was passed by keyword
-
toString
-
hashCode
-
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). -
source
-
keyword
-
parameterName
Returns the value of theparameterNamerecord component.- Returns:
- the value of the
parameterNamerecord component
-
type
-
conflictingCall
Returns the value of theconflictingCallrecord component.- Returns:
- the value of the
conflictingCallrecord component
-