All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.qbicc.graph.literal.ConstructorLiteral Maven / Gradle / Ivy

There is a newer version: 0.77.0
Show newest version
package org.qbicc.graph.literal;

import org.qbicc.type.InstanceMethodType;
import org.qbicc.type.definition.element.ConstructorElement;
import org.qbicc.type.definition.element.ExecutableElement;

/**
 *
 */
public final class ConstructorLiteral extends InvokableLiteral {
    ConstructorLiteral(ConstructorElement element) {
        super(element);
    }

    ConstructorLiteral(ExecutableElement element) {
        this((ConstructorElement) element);
    }

    @Override
    public ConstructorElement getExecutable() {
        return (ConstructorElement) super.getExecutable();
    }

    @Override
    public InstanceMethodType getPointeeType() {
        return getExecutable().getType();
    }

    @Override
    public boolean equals(InvokableLiteral other) {
        return other instanceof ConstructorLiteral cl && equals(cl);
    }

    public boolean equals(ConstructorLiteral other) {
        return super.equals(other);
    }

    @Override
    public StringBuilder toReferenceString(StringBuilder b) {
        ConstructorElement element = getExecutable();
        String niceClass = element.getEnclosingType().getInternalName().replace('/', '.');
        return element.getDescriptor().toString(b.append('@').append(niceClass).append('#').append(""));
    }

    @Override
    public  R accept(LiteralVisitor visitor, T param) {
        return visitor.visit(param, this);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy