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

org.jruby.ast.java_signature.Annotation Maven / Gradle / Ivy

There is a newer version: 9.4.9.0
Show newest version
package org.jruby.ast.java_signature;

import java.util.List;

/**
 *
 */
public class Annotation implements AnnotationExpression {
    private String name;
    private List parameters;
    
    public Annotation(String name, List parameters) {
        this.name = name;
        this.parameters = parameters;
    }
    
    /**
     * modifiers and annotations can be mixed together in java signatures.
     */
    public boolean isAnnotation() {
        return true;
    }
    
    public String getName() {
        return name;
    }
    
    public List getParameters() {
        return parameters;
    }
    
    @Override
    public String toString() {
        return name + toStringParameters();
    }
    
    public String toStringParameters() {
        int length = parameters.size();
        if (length == 0) return "";
        
        StringBuilder buf = new StringBuilder("(");
        for (int i = 0; i < length - 1; i++) {
            buf.append(parameters.get(i)).append(", ");
        }
        buf.append(parameters.get(length - 1)).append(')');
        
        return buf.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy