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

com.strobel.decompiler.languages.java.ast.MethodGroupExpression Maven / Gradle / Ivy

There is a newer version: 2.5.0.Final
Show newest version
/*
 * MethodGroupExpression.java
 *
 * Copyright (c) 2013 Mike Strobel
 *
 * This source code is based on Mono.Cecil from Jb Evain, Copyright (c) Jb Evain;
 * and ILSpy/ICSharpCode from SharpDevelop, Copyright (c) AlphaSierraPapa.
 *
 * This source code is subject to terms and conditions of the Apache License, Version 2.0.
 * A copy of the license can be found in the License.html file at the root of this distribution.
 * By using this source code in any fashion, you are agreeing to be bound by the terms of the
 * Apache License, Version 2.0.
 *
 * You must not remove this notice, or any other, from this software.
 */

package com.strobel.decompiler.languages.java.ast;

import com.strobel.decompiler.patterns.INode;
import com.strobel.decompiler.patterns.Match;
import com.strobel.decompiler.patterns.Role;

public class MethodGroupExpression extends Expression {
    public final static Role CLOSURE_ARGUMENT_RULE = new Role<>("ClosureArgument", Expression.class, Expression.NULL);
    public final static TokenRole DOUBLE_COLON_ROLE = new TokenRole("::", TokenRole.FLAG_OPERATOR);

    public MethodGroupExpression( int offset, final Expression target, final String methodName) {
        super( offset);
        setTarget(target);
        setMethodName(methodName);
    }

    
    public final AstNodeCollection getClosureArguments() {
        return getChildrenByRole(CLOSURE_ARGUMENT_RULE);
    }

    public final JavaTokenNode getDoubleColonToken() {
        return getChildByRole(DOUBLE_COLON_ROLE);
    }

    public final String getMethodName() {
        return getChildByRole(Roles.IDENTIFIER).getName();
    }

    public final void setMethodName(final String name) {
        setChildByRole(Roles.IDENTIFIER, Identifier.create(name));
    }

    public final Identifier getMethodNameToken() {
        return getChildByRole(Roles.IDENTIFIER);
    }

    public final void setMethodNameToken(final Identifier token) {
        setChildByRole(Roles.IDENTIFIER, token);
    }

    public final Expression getTarget() {
        return getChildByRole(Roles.TARGET_EXPRESSION);
    }

    public final void setTarget(final Expression value) {
        setChildByRole(Roles.TARGET_EXPRESSION, value);
    }

    @Override
    public  R acceptVisitor(final IAstVisitor visitor, final T data) {
        return visitor.visitMethodGroupExpression(this, data);
    }

    @Override
    public boolean matches(final INode other, final Match match) {
        return false;
    }

    @Override
    public boolean isReference() {
        return true;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy