Package net.vidageek.mirror.dsl

Examples of net.vidageek.mirror.dsl.Mirror


    public String getLink() {
      Method method = null;

      if (getMethodsAmountWithSameName() > 1) {
        method = new Mirror().on(controller).reflect().method(methodName).withArgs(getClasses(args));
        if (method == null && args.isEmpty()) {
          throw new IllegalArgumentException("Ambiguous method '" + methodName + "' on " + controller + ". Try to add some parameters to resolve ambiguity, or use different method names.");
        }
      } else {
        method = findMethodWithName(controller, methodName);
View Full Code Here


      result.use(page()).forwardTo(referer);
    }
  }

  private void executeMethod(ResourceMethod method, Object instance) {
    new Mirror().on(instance).invoke().method(method.getMethod())
      .withArgs(provider.getParametersFor(method, new ArrayList<Message>(), localization.getBundle()));
  }
View Full Code Here

  private <T> MethodInvocation<T> throwValidationErrorOnFinalMethods(final Class<T> view, final List<Message> errors,
      final T viewInstance) {
    return new MethodInvocation<T>() {
      public Object intercept(T proxy, Method method, Object[] args, SuperMethod superMethod) {
        final Object instance = new Mirror().on(viewInstance).invoke().method(method).withArgs(args);
        Class type = method.getReturnType();
        if (type == void.class) {
          throw new ValidationException(errors);
        }
View Full Code Here

  private <T> MethodInvocation<T> throwValidationExceptionOnFirstInvocation(final List<Message> errors,
      final T instance) {
    return new MethodInvocation<T>() {
      public Object intercept(Object proxy, Method method, Object[] args, SuperMethod superMethod) {
        new Mirror().on(instance).invoke().method(method).withArgs(args);

        throw new ValidationException(errors);
      }
    };
  }
View Full Code Here

    @Override
    public String toString() {
      Method method = null;

      if (getMethodsAmountWithSameName() > 1) {
        method = new Mirror().on(controller).reflect().method(methodName).withArgs(getClasses(args));
        if (method == null && args.isEmpty()) {
          throw new IllegalArgumentException("Ambiguous method '" + methodName + "' on " + controller + ". Try to add some parameters to resolve ambiguity, or use different method names.");
        }
      } else {
        method = findMethodWithName(controller, methodName);
View Full Code Here

        "set" + StringUtils.capitalize(fieldName), origin.getClass(), null);
     
      EmptyElementsRemoval removal = (EmptyElementsRemoval) context.get("removal");
      removal.add(newArray, setter, origin);

      new Mirror().on(origin).invoke().method(setter).withArgs(newArray);
    }
    array = newArray;
  }
  super.setProperty(context, array, key, value);
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  Object instantiate(Object target, Object property, Type type) {

    Class typeToInstantiate = (Class) ((ParameterizedType) type).getActualTypeArguments()[0];
    Object instance = new Mirror().on(typeToInstantiate).invoke().constructor().withoutArgs();

    // setting the position
    int position = (Integer) property;
    List list = (List) target;
    while (list.size() <= position) {
View Full Code Here

  } else {
    instance = nullHandler.instantiate(baseType);
  }
 
  Method setter = findMethod(target.getClass(), "set" + propertyCapitalized, target.getClass(), getter.getReturnType());
  new Mirror().on(target).invoke().method(setter).withArgs(instance);
  return instance;
  }
View Full Code Here

 
  if (proxifier.isProxy(target)) {
    targetClass = targetClass.getSuperclass();
  }
 
  return new Mirror().on(targetClass).reflect().method("get" + propertyCapitalized).withoutArgs();
  }
View Full Code Here

   
  if (proxifier.isProxy(target)) {
    targetClass = targetClass.getSuperclass();
  }
   
    return new Mirror().on(targetClass).reflect().method("set" + propertyCapitalized).withArgs(argument);
  }
View Full Code Here

TOP

Related Classes of net.vidageek.mirror.dsl.Mirror

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.