Package br.com.caelum.vraptor.controller

Examples of br.com.caelum.vraptor.controller.BeanClass


  @Override
  public Object get(Object key) {
    logger.debug("getting key {}", key);
   
    BeanClass beanClass = (BeanClass) key;
    final Class<?> controller = beanClass.getType();
    Class<?> linkToInterface = interfaces.get(controller);
    if (linkToInterface == null) {
      logger.debug("interface not found, creating one {}", controller);

      lock.lock();
View Full Code Here


      @Override
      public boolean matches(Object item) {
        if (!(item instanceof BeanClass)) {
          return false;
        }
        BeanClass other = (BeanClass) item;
        return other.getType().equals(type);
      }

      @Override
      public void describeTo(Description description) {
        description.appendText(" controller for " + type.getName());
View Full Code Here

    jsonDeserializers.add(new CalendarGsonConverter());
    jsonDeserializers.add(new DateGsonConverter());

    builder = new GsonBuilderWrapper(new MockInstanceImpl<>(jsonSerializers), new MockInstanceImpl<>(jsonDeserializers), new Serializee());
    deserializer = new GsonDeserialization(builder, provider, request, container, deserializeeInstance);
    BeanClass controllerClass = new DefaultBeanClass(DogController.class);

    noParameter = new DefaultControllerMethod(controllerClass, DogController.class.getDeclaredMethod("noParameter"));
    dogParameter = new DefaultControllerMethod(controllerClass, DogController.class.getDeclaredMethod("dogParameter", Dog.class));
    dateParameter = new DefaultControllerMethod(controllerClass, DogController.class.getDeclaredMethod("dateParameter", Date.class));
    dogAndIntegerParameter = new DefaultControllerMethod(controllerClass, DogController.class.getDeclaredMethod("dogAndIntegerParameter", Dog.class,
View Full Code Here

  }

  @Test
  public void shouldDeserializeFromGenericTypeOneParam() {
    InputStream stream = asStream("{'entity':{'name':'Brutus','age':7,'birthday':'2013-07-23T17:14:14-03:00'}}");
    BeanClass resourceClass = new DefaultBeanClass(DogGenericController.class);
    Method method = new Mirror().on(DogGenericController.class).reflect().method("method").withAnyArgs();
    ControllerMethod resource = new DefaultControllerMethod(resourceClass, method);
   
    Object[] deserialized = deserializer.deserialize(stream, resource);
View Full Code Here

  }

  @Test
  public void shouldDeserializeFromGenericTypeTwoParams() {
    InputStream stream = asStream("{'entity':{'name':'Brutus','age':7,'birthday':'2013-07-23T17:14:14-03:00'}, 'param': 'test', 'over': 'value'}");
    BeanClass resourceClass = new DefaultBeanClass(DogGenericController.class);
    Method method = new Mirror().on(DogGenericController.class).reflect().method("anotherMethod").withAnyArgs();
    ControllerMethod resource = new DefaultControllerMethod(resourceClass, method);
   
    Object[] deserialized = deserializer.deserialize(stream, resource);
View Full Code Here

  }

  private void registerRulesFor(Class<?> type) {
    RoutesParser parser = new PathAnnotationRoutesParser(router);

    BeanClass controllerClass = new DefaultBeanClass(type);
    List<Route> rules = parser.rulesFor(controllerClass);
    for (Route route : rules) {
      router.add(route);
    }
  }
View Full Code Here

  @Before
  public void setUp() throws Exception {
    provider = new ParanamerNameProvider();

    deserializer = new XStreamXMLDeserializer(provider, cleanInstance(new CalendarConverter()));
    BeanClass controllerClass = new DefaultBeanClass(DogController.class);
    BeanClass personControllerClass = new DefaultBeanClass(PersonController.class);

    woof = new DefaultControllerMethod(controllerClass, DogController.class.getDeclaredMethod("woof"));
    bark = new DefaultControllerMethod(controllerClass, DogController.class.getDeclaredMethod("bark", Dog.class));
    jump = new DefaultControllerMethod(controllerClass, DogController.class.getDeclaredMethod("jump", Dog.class, Integer.class));
    dropDead = new DefaultControllerMethod(controllerClass, DogController.class.getDeclaredMethod("dropDead", Integer.class, Dog.class));
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.controller.BeanClass

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.