Package sizzle.functions

Examples of sizzle.functions.FunctionSpec


    return aggregators;
  }

  private void importFunction(final Method m) {
    final FunctionSpec annotation = m.getAnnotation(FunctionSpec.class);

    final String[] formalParameters = annotation.formalParameters();
    final SizzleType[] formalParameterTypes = new SizzleType[formalParameters.length];

    for (int i = 0; i < formalParameters.length; i++) {
      final String id = formalParameters[i];

      // check for varargs
      if (id.endsWith("..."))
        formalParameterTypes[i] = new SizzleVarargs(this.getType(id.substring(0, id.indexOf('.'))));
      else
        formalParameterTypes[i] = this.getType(id);
    }

    for (final String dep : annotation.typeDependencies())
      if (dep.endsWith(".proto"))
        this.importProto(dep);
      else if (dep.endsWith(".avro"))
        this.importAvro(dep);
      else
        throw new TypeException("unknown dependency in " + dep);

    this.setFunction(annotation.name(),
        new SizzleFunction(m.getDeclaringClass().getCanonicalName() + '.' + m.getName(), this.getType(annotation.returnType()), formalParameterTypes));
  }
View Full Code Here

TOP

Related Classes of sizzle.functions.FunctionSpec

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.