improve the constructor of FunctionName

This commit is contained in:
Volker Berlin 2018-11-25 14:33:35 +01:00
parent 51b58e2a79
commit c2683f4576

View File

@ -28,6 +28,12 @@ import de.inetsoftware.classparser.Member;
*/
public class FunctionName {
/**
* The Java class name.
*/
@Nonnull
public final String className;
/**
* The name in the WebAssembly.
*/
@ -40,6 +46,12 @@ public class FunctionName {
@Nonnull
public final String signatureName;
/**
* The signature
*/
@Nonnull
public final String signature;
/**
* Create a new instance from the given reference in the ConstantPool or parsed method.
*
@ -47,10 +59,36 @@ public class FunctionName {
* the Java method
*/
FunctionName( @Nonnull Member methodOrField ) {
String methodName = methodOrField.getName();
String className = methodOrField.getClassName();
fullName = className + '.' + methodName;
signatureName = fullName + methodOrField.getType();
this( methodOrField, methodOrField.getType() );
}
/**
* Create a new instance from the given reference in the ConstantPool and a special signature.
*
* @param methodOrField
* the Java method
* @param signature
* the Java signature
*/
FunctionName( @Nonnull Member methodOrField, String signature ) {
this( methodOrField.getClassName(), methodOrField.getName(), signature );
}
/**
* Create a new instance from the given values
*
* @param className
* the Java class name
* @param methodName
* the Java method name
* @param signature
* the Java signature
*/
FunctionName( String className, String methodName, String signature ) {
this.className = className;
this.fullName = className + '.' + methodName;
this.signatureName = fullName + signature;
this.signature = signature;
}
/**