Examples of instanceFor()


Examples of br.com.caelum.vraptor.ioc.Container.instanceFor()

            String fieldName = ctx.getCurrentEvaluation().getPrevious().getNode().toString();
            Object origin = ctx.getCurrentEvaluation().getPrevious().getSource();
            Method setter = ReflectionBasedNullHandler.findMethod(origin.getClass(),
                    "set" + Info.capitalize(fieldName), origin.getClass(), null);
            Container container = (Container) context.get(Container.class);
            EmptyElementsRemoval removal = container.instanceFor(EmptyElementsRemoval.class);
            removal.add(array, setter, origin);
            try {
                setter.invoke(origin, array);
            } catch (IllegalArgumentException e) {
                // TODO better
View Full Code Here

Examples of br.com.caelum.vraptor.ioc.Container.instanceFor()

          // suckable ognl doesnt support dependency injection or
          // anything alike... just that suckable context... therefore
          // procedural
          // programming and ognl live together forever!
          Container container = (Container) context.get(Container.class);
          Converter<?> converter = container.instanceFor(Converters.class).to(type, container);
          ResourceBundle bundle = (ResourceBundle) context.get(ResourceBundle.class);
          Object result = converter.convert((String) value, type, bundle);
          super.setProperty(context, target, key, result);
          return;
        }
View Full Code Here

Examples of br.com.caelum.vraptor.ioc.Container.instanceFor()

    public <T> T instanceFor(Class<T> type) {
      Container container = containersByThread.get();
      if (container == null) {
        return picoContainer.getComponent(type);
      }
      return container.instanceFor(type);
    }

    public <T> boolean canProvide(Class<T> type) {
      return instanceFor(type) != null;
    }
View Full Code Here

Examples of br.com.caelum.vraptor.ioc.Container.instanceFor()

    GsonSerializerBuilder gsonBuilder =  new GsonBuilderWrapper(new MockInstanceImpl<>(jsonSerializers), new MockInstanceImpl<>(jsonDeserializers), new Serializee());
    GsonJSONSerialization jsonSerialization = new GsonJSONSerialization(response, extractor, gsonBuilder, environment);

    Container container = mock(Container.class);
    when(container.instanceFor(JSONSerialization.class)).thenReturn(jsonSerialization);
    when(container.instanceFor(XMLSerialization.class)).thenReturn(xmlSerialization);

    ResourceBundle bundle = new SingletonResourceBundle("message.cat", "Just another {0} in {1}");
    serialization = new I18nMessageSerialization(container , bundle);
  }
View Full Code Here

Examples of br.com.caelum.vraptor.ioc.Container.instanceFor()

    GsonSerializerBuilder gsonBuilder =  new GsonBuilderWrapper(new MockInstanceImpl<>(jsonSerializers), new MockInstanceImpl<>(jsonDeserializers), new Serializee());
    GsonJSONSerialization jsonSerialization = new GsonJSONSerialization(response, extractor, gsonBuilder, environment);

    Container container = mock(Container.class);
    when(container.instanceFor(JSONSerialization.class)).thenReturn(jsonSerialization);
    when(container.instanceFor(XMLSerialization.class)).thenReturn(xmlSerialization);

    ResourceBundle bundle = new SingletonResourceBundle("message.cat", "Just another {0} in {1}");
    serialization = new I18nMessageSerialization(container , bundle);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.