* @throws IllegalArgumentException 引数に{@code null}が指定された場合
*/
public void addOperatorHelper(ExecutableElement helperMethod) {
Precondition.checkMustNotBeNull(helperMethod, "helperMethod"); //$NON-NLS-1$
ModelFactory f = context.environment.getFactory();
ImportBuilder ib = context.importer;
Jsr269 conv = new Jsr269(f);
List<Expression> parameterTypeLiterals = Lists.create();
for (VariableElement parameter : helperMethod.getParameters()) {
TypeMirror type = context.environment.getErasure(parameter.asType());
parameterTypeLiterals.add(new TypeBuilder(f, ib.resolve(conv.convert(type)))
.dotClass()
.toExpression());
}
Expression attribute = new TypeBuilder(f, ib.toType(OperatorHelper.class))
.newObject(new Expression[] {
// name
Models.toLiteral(f, helperMethod.getSimpleName().toString()),
// parameter types
new TypeBuilder(f, ib.toType(Arrays.class))
.method("asList", new TypeBuilder(f, ib.toType(Class.class))
.parameterize(f.newWildcard())
.array(1)
.newArray(f.newArrayInitializer(parameterTypeLiterals))
.toExpression())
.toExpression()