Example usage for com.google.common.css.compiler.ast GssFunctionException GssFunctionException

List of usage examples for com.google.common.css.compiler.ast GssFunctionException GssFunctionException

Introduction

In this page you can find the example usage for com.google.common.css.compiler.ast GssFunctionException GssFunctionException.

Prototype

public GssFunctionException(String message) 

Source Link

Usage

From source file:com.google.gwt.resources.gss.ValueFunction.java

@Override
public List<CssValueNode> getCallResultNodes(List<CssValueNode> args, ErrorManager errorManager)
        throws GssFunctionException {
    if (args.size() == 0 || args.size() > 3) {
        throw new GssFunctionException(getName() + " function take one, two or three arguments");
    }//from  www.  j av a 2 s .  c  o  m

    String functionPath = args.get(0).getValue();
    String prefix = null;
    String suffix = null;

    if (args.size() > 1) {
        suffix = args.get(1).getValue();
    }

    if (args.size() > 2) {
        prefix = args.get(2).getValue();
    }

    CssDotPathNode cssDotPathNode = new CssDotPathNode(functionPath, prefix, suffix,
            args.get(0).getSourceCodeLocation());

    // TODO add validation : maybe add a compilation pass that will validate the the method exist
    // on the resource bundle

    return ImmutableList.of((CssValueNode) cssDotPathNode);
}