JWebAssembly/src/de/inetsoftware/classparser/ConstantInvokeDynamic.java

70 lines
2.0 KiB
Java
Raw Normal View History

2019-10-26 12:23:36 +02:00
/*
2020-01-25 21:17:42 +01:00
Copyright 2019 - 2020 Volker Berlin (i-net software)
2019-10-26 12:23:36 +02:00
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package de.inetsoftware.classparser;
/**
* @author Volker Berlin
*/
2020-01-25 21:17:42 +01:00
public class ConstantInvokeDynamic {
2019-10-26 12:23:36 +02:00
private final ConstantNameAndType nameAndType;
2020-01-25 21:17:42 +01:00
private final int bootstrapMethodIndex;
2019-10-26 12:23:36 +02:00
/**
* Invoke dynamic info in the constant pool.
* https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.4.10
*
* @param bootstrapMethodAttrIndex
* a valid index into the bootstrap_methods array of the bootstrap method table
* @param nameAndType
* the name and type
*/
ConstantInvokeDynamic( int bootstrapMethodAttrIndex, ConstantNameAndType nameAndType ) {
2020-01-25 21:17:42 +01:00
this.bootstrapMethodIndex = bootstrapMethodAttrIndex;
2019-10-26 12:23:36 +02:00
this.nameAndType = nameAndType;
}
/**
2020-01-25 21:17:42 +01:00
* The simple name of the generated method of the single function interface.
*
* @return the name
2019-10-26 12:23:36 +02:00
*/
public String getName() {
return nameAndType.getName();
}
/**
2020-02-27 11:25:41 +01:00
* Get the signature of the factory method. For example "()Ljava.lang.Runnable;" for the lamba expression
* "<code>Runnable run = () -&gt; foo();</code>"
2020-01-25 21:17:42 +01:00
*
* @return the type
2019-10-26 12:23:36 +02:00
*/
2020-01-25 21:17:42 +01:00
public String getType() {
return nameAndType.getType();
2019-10-26 12:23:36 +02:00
}
/**
2020-01-25 21:17:42 +01:00
* Get the index to the bootstrap methods.
*
* @return the index
2019-10-26 12:23:36 +02:00
*/
2020-01-25 21:17:42 +01:00
public int getBootstrapMethodIndex() {
return bootstrapMethodIndex;
2019-10-26 12:23:36 +02:00
}
2020-01-25 21:17:42 +01:00
}