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

com.redhat.ceylon.compiler.java.codegen.CharacterLiteralAnnotationTerm Maven / Gradle / Ivy

There is a newer version: 1.3.3
Show newest version
package com.redhat.ceylon.compiler.java.codegen;

import com.redhat.ceylon.langtools.tools.javac.tree.JCTree.JCAnnotation;
import com.redhat.ceylon.langtools.tools.javac.tree.JCTree.JCExpression;

public class CharacterLiteralAnnotationTerm extends LiteralAnnotationTerm {
    
    /** 
     * Sometimes we need an instance just for calling 
     * {@link #makeAtValue(ExpressionTransformer, String, JCExpression)} on.
     */
    public static final LiteralAnnotationTerm FACTORY = new CharacterLiteralAnnotationTerm(0);
    
    final int value;
    
    public CharacterLiteralAnnotationTerm(int value) {
        super();
        this.value = value;
    }
    @Override
    public com.redhat.ceylon.langtools.tools.javac.util.List makeAtValue(
            ExpressionTransformer exprGen, String name, JCExpression value) {
        return exprGen.makeAtCharacterValue(name, value);
    }
    @Override
    public JCExpression makeLiteral(ExpressionTransformer exprGen) {
        return exprGen.make().Literal(value);
    }
    @Override
    public com.redhat.ceylon.langtools.tools.javac.util.List makeExprs(ExpressionTransformer exprGen, com.redhat.ceylon.langtools.tools.javac.util.List value) {
        return exprGen.makeAtCharacterExprs(exprGen.make().NewArray(null,  null,  (com.redhat.ceylon.langtools.tools.javac.util.List)value));
    }
    @Override
    public String toString() {
        return "'" + new String(Character.toChars(value)) + "'";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy