public void work(PlasticMethod method) { boolean valid = method.isVoid() && method.getParameters().isEmpty(); if (!valid) { throw new RuntimeException( String.format( "Method %s is invalid: methods with the @PageReset annotation must return void, and have no parameters.", method.getMethodIdentifier())); } } };
public void work(PlasticMethod method) { if (!method.isVoid()) throw new RuntimeException(String.format("Method %s is a lifecycle method and should return void.", method .getMethodIdentifier())); if (!method.getParameters().isEmpty()) throw new RuntimeException(String.format("Method %s is a lifecycle method and should take no parameters.", method.getMethodIdentifier())); } };
RequestParameter parameterAnnotation = method.getParameters().get(i).getAnnotation(RequestParameter.class);
private void invokeMethod(InstructionBuilder builder, PlasticMethod method) { // First, tell the Event object what method is being invoked. builder.loadArgument(1); builder.loadConstant( method.getMethodIdentifier()); builder.invoke(Event.class, void.class, "setMethodDescription", String.class); builder.loadThis(); // Methods either take no parameters, or take a MarkupWriter parameter. if (method.getParameters().size() > 0) { builder.loadArgument(0); } builder.invokeVirtual(method); // Non-void methods will pass a value to the event. if (!method.isVoid()) { builder.boxPrimitive(method.getDescription().returnType); builder.loadArgument(1).swap(); builder.invoke(Event.class, boolean.class, "storeResult", Object.class); builder.when(Condition.NON_ZERO, JUST_RETURN); } }