public class Method extends java.lang.Object
ClassData.methods
,
filled using #addMethod(String sNameJava, String sCName, int modifier, LocalIdents.IdentInfos returnType, ClassData[] paramsType)
and there derivatives.
ClassData#searchMethod(String, List, boolean)
with given name and given actual ParametersModifier and Type | Field and Description |
---|---|
org.vishia.java2C.ClassData |
declaringClass
The class which declares the implementation of the method.
|
org.vishia.java2C.ClassData |
firstDeclaringClass
The class which declares the method primary.
|
int |
mode
Some mode bits, ones of
modeNoThCxt , modeStatic . |
static int |
modeCtor
Set if it is a ctor.
|
static int |
modeCtorAnonymous
Set if it is a ctor of an anonymous class.
|
static int |
modeCtorNonStatic
Set if it is a ctor of a non-static inner class.
|
static int |
modeNoStacktrace |
static int |
modeNoThCxt
Modifier bit, when set the method has ThCxt as last argument.
|
static int |
modeOverrideable
Modifier bit, when set the method is overrideable (virtual).
|
static int |
modeReturnNew
Modifier bit, when set the method returns a new created instance which isn't activated for garbabe collection.
|
static int |
modeReturnNonPersistring
Modifier bit, when set, the method returns a StringJc-instance, which's String is replaced in the thread context
or it isn't persistent in other way.
|
static int |
modeReturnThis
Modifier bit, when set the method returns the same instance as the calling one.
|
static int |
modeStatic
Modifier bit, when set the method is static.
|
static int |
modeUnknownMethod |
boolean |
need_thCxt
Set if _thCxt is need in method calls
|
FieldData[] |
paramsType
All argument type of the method.
|
Method |
primaryMethod
Reference to a primary method if the method overloads another method, else null.
|
FieldData |
returnType
Return type of the method.
|
java.lang.String |
sCName
Name of the method used in C, with suffixes.
|
java.lang.String |
sImplementationName
Name of the implementation of the method, null if not exists (interface).
|
java.lang.String |
sJavaName
Name of the method used in Java.
|
java.lang.String |
sKeyName
Search name of method in Map
ClassData.methods . |
java.lang.String |
sMethodTypeName
The first name of the method in an overridden-sequence. |
java.lang.String |
sNameUnambiguous
Name of the method in method tables, base name of the method.
|
java.lang.String |
sPathToBase
If the method is declared in a base class or interface too, it is the path necessary to address
the base class or interface started from
ythis |
java.lang.String |
sPathToMtbl
If the method is declared in a base class or interface too, it is the path to the method table-part.
|
static java.lang.String |
sVersion
Version, history and license.
|
Constructor and Description |
---|
Method(org.vishia.java2C.ClassData declaringClass,
Method primaryMethodP,
java.lang.String sKeyName,
java.lang.String sNameJava,
java.lang.String sNameUnambiguous,
java.lang.String sImplementationName,
int modifier,
FieldData returnType,
FieldData[] params,
java.lang.String sPathToMtbl,
java.lang.String sPathToBase)
Initializes a method to store in ClassData.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
gen_MethodDefinition()
Gets the definition of a method head for the C-code.
|
java.lang.String |
gen_MethodForwardDeclaration()
Gets the definition of a method head for the C-code.
|
java.lang.String |
gen_MethodHeadDefinition()
Gets the definition of a method (C-code), used in second pass.
|
int |
getIdxMtbl()
Returns -1 if it is a final method, or 0..., the index in the InheritanceInfo.
|
LocalIdents |
getMethodIdents() |
boolean |
isAmbigous()
Returns true, if more as one method with the same java name and the same number of arguments exists.
|
boolean |
isOverrideable()
Returns true if the method is able to override (dynamic linked) in an inheriting class.
|
boolean |
isReturnNew()
Returns true if the method returns a new instance which isn't activated for garbage collection.
|
boolean |
isReturnNonPersistring()
Returns true if the method returns a new instance which isn't activated for garbage collection.
|
boolean |
isReturnThis()
Returns true if the method returns its own calling instance.
|
boolean |
isStatic()
Returns true if the method is static.
|
boolean |
isUnknownMethod()
Returns true if the method is auto-created while used, it is not defined.
|
boolean |
noStacktrace()
Returns true if the method is able to override (dynamic linked) in an inheriting class.
|
void |
putFieldIdent(FieldData field) |
void |
setMethodHeadDefiniton(java.lang.String description,
java.lang.String retType,
java.lang.String def)
Sets the definiton of a method (C-code).
|
void |
setMethodIdents(LocalIdents methodIdents) |
java.lang.String |
toString()
Helpfull for debugging in eclipse.
|
java.lang.String |
writeStruct()
Writes the structure information of the method for file.stc.
|
public static final java.lang.String sVersion
FieldData.modeAccess
for method arguments and set ClassData.CastInfo.kCastAccessDiff
to force a access conversion.
public final java.lang.String sJavaName
public final java.lang.String sKeyName
ClassData.methods
. It is the sJavaName
plus #9
where 9
symbols the number of arguments.public final java.lang.String sCName
public final java.lang.String sMethodTypeName
The first name of the method in an overridden-sequence. The method has the postfix
of the first declaring interfaces or class, see declaringClass
.
This identifier is used to build the MT_NAME
-identifier in the method table,
see ClassData.gen_MethodTableDefinitionContent()
.
null
if the method doesn't override any other and the method won't be overridden.
public final java.lang.String sImplementationName
public final java.lang.String sNameUnambiguous
public final Method primaryMethod
public final java.lang.String sPathToMtbl
public final java.lang.String sPathToBase
ythis
public final FieldData[] paramsType
public final FieldData returnType
public final org.vishia.java2C.ClassData firstDeclaringClass
public org.vishia.java2C.ClassData declaringClass
public final boolean need_thCxt
public static final int modeCtor
public static final int modeCtorNonStatic
public static final int modeCtorAnonymous
public static final int modeNoThCxt
public static final int modeNoStacktrace
public static final int modeStatic
public static final int modeOverrideable
public static final int modeReturnThis
public static final int modeReturnNew
public static final int modeReturnNonPersistring
public static final int modeUnknownMethod
public final int mode
modeNoThCxt
, modeStatic
.public Method(org.vishia.java2C.ClassData declaringClass, Method primaryMethodP, java.lang.String sKeyName, java.lang.String sNameJava, java.lang.String sNameUnambiguous, java.lang.String sImplementationName, int modifier, FieldData returnType, FieldData[] params, java.lang.String sPathToMtbl, java.lang.String sPathToBase)
declaringClass
- The class which declares this method.primaryMethodP
- null
or the method of the super-class or interface.
If the method is not an implementation of a super- or interface-declared method,
it is null
sKeyName
- Name to searchsNameJava
- Name of the method in JavasNameUnambiguous
- Name of the method to translate in C. If more than 1 method
with the same sNameJava is given, the sCName should be unambiguous.
But it is without suffix of className.sImplementationName
- null if the implementation is not override-able.
If the method is override-able and this param is null, than the suffix for the
implementationName is "_F". Elsewhere it defines the sImplementationName-attribute of the class.modifier
- see mode
returnType
- The type of return. It isn't a Classdata, but a IdentInfo,
because some additional properties like return by value or reference should be present.params
- Array of all argument types.sPathToMtbl
- sPathToBase
- public void setMethodHeadDefiniton(java.lang.String description, java.lang.String retType, java.lang.String def)
public java.lang.String gen_MethodForwardDeclaration()
public java.lang.String gen_MethodDefinition()
public java.lang.String gen_MethodHeadDefinition()
public void putFieldIdent(FieldData field)
public boolean isAmbigous()
public boolean noStacktrace()
public boolean isOverrideable()
public boolean isReturnThis()
public boolean isReturnNew()
public boolean isReturnNonPersistring()
public boolean isStatic()
public boolean isUnknownMethod()
public java.lang.String writeStruct()
public int getIdxMtbl()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public final LocalIdents getMethodIdents()
public final void setMethodIdents(LocalIdents methodIdents)