io.neow3j.compiler.NeoEvent Maven / Gradle / Ivy
The newest version!
package io.neow3j.compiler;
import io.neow3j.devpack.annotations.EventParameterNames;
import io.neow3j.types.ContractParameter;
import io.neow3j.devpack.annotations.DisplayName;
import io.neow3j.protocol.core.response.ContractManifest.ContractABI.ContractEvent;
import io.neow3j.utils.ClassUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.AnnotationNode;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldNode;
import static io.neow3j.compiler.AsmHelper.extractTypeParametersFromSignature;
import static java.lang.String.format;
public class NeoEvent {
private final static String PARAM_NAME_PREFIX = "arg";
private final String displayName;
private final List params;
private final String namespace;
private final FieldNode asmVariable;
public NeoEvent(FieldNode asmVariable, ClassNode owner) {
Optional displayNameAnnOpt = AsmHelper.getAnnotationNode(asmVariable, DisplayName.class);
if (displayNameAnnOpt.isPresent()) {
displayName = (String) displayNameAnnOpt.get().values.get(1);
} else {
displayName = asmVariable.name;
}
Optional paramNamesAnnOpt = AsmHelper.getAnnotationNode(asmVariable, EventParameterNames.class);
if (paramNamesAnnOpt.isPresent()) {
List