Esempio n. 1
0
  protected void setUp() {
    eventService = SupportEventAdapterService.getService();
    EventType underlyingEventTypeSimple =
        eventService.addBeanType("underlyingSimpleBean", SupportBeanSimple.class, true, true, true);
    EventType underlyingEventTypeCombined =
        eventService.addBeanType(
            "underlyingCombinedBean", SupportBeanCombinedProps.class, true, true, true);

    Map<String, Object> typeMap = new HashMap<String, Object>();
    typeMap.put("string", String.class);
    typeMap.put("int", Integer.class);

    EventTypeMetadata meta = EventTypeMetadata.createWrapper("test", true, false, false);
    eventTypeSimple =
        new WrapperEventType(meta, "mytype", 1, underlyingEventTypeSimple, typeMap, eventService);
    eventTypeCombined =
        new WrapperEventType(meta, "mytype", 1, underlyingEventTypeCombined, typeMap, eventService);
    properties = new HashMap<String, Object>();
    properties.put("string", "xx");
    properties.put("int", 11);

    EventBean wrappedSimple = eventService.adapterForBean(new SupportBeanSimple("eventString", 0));
    eventBeanSimple =
        eventService.adapterForTypedWrapper(wrappedSimple, properties, eventTypeSimple);

    EventBean wrappedCombined =
        eventService.adapterForBean(SupportBeanCombinedProps.makeDefaultBean());
    eventBeanCombined =
        eventService.adapterForTypedWrapper(wrappedCombined, properties, eventTypeCombined);
  }
 public EventBean wrap(Object underlying) {
   EventBean bean = eventAdapterService.adapterForTypedBean(underlying, beanEventType);
   return eventAdapterService.adapterForTypedWrapper(
       bean, Collections.<String, Object>emptyMap(), wrapperEventType);
 }