Skip to content

Instantly share code, notes, and snippets.

@mrueegg
Created March 9, 2017 17:12
Show Gist options
  • Save mrueegg/f19154eac3e370d3ca8f2c164f1aa12f to your computer and use it in GitHub Desktop.
Save mrueegg/f19154eac3e370d3ca8f2c164f1aa12f to your computer and use it in GitHub Desktop.
Java SOY function adapter for the Scala implementation
public class UserNavSoyFunctionAdapter implements SoyServerFunction<String>, SoyClientFunction {
private final UserNavSoyFunction adaptee;
public UserNavSoyFunctionAdapter(UserNavSoyFunction adaptee) {
this.adaptee = adaptee;
}
@Override
public JsExpression generate(JsExpression... jsExpressions) {
Seq<JsExpression> scalaExpressions = scala.collection.JavaConversions.asScalaBuffer(
Arrays.asList(jsExpressions)
).seq();
return adaptee.generate(scalaExpressions);
}
@Override
public String apply(Object... objects) {
Seq<Object> scalaObjects = scala.collection.JavaConversions.asScalaBuffer(
Arrays.asList(objects)
).seq();
return adaptee.apply(scalaObjects);
}
@Override
public String getName() {
return adaptee.getName();
}
@Override
public Set<Integer> validArgSizes() {
return adaptee.validArgSizes();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment