public Object get(String property) throws PropertyAccessException {
   EventPropertyGetter getter = revisionEventType.getGetter(property);
   if (getter == null) {
     return null;
   }
   return getter.get(this);
 }
  public Object getFragment(EventBean obj) {
    Object underlying = obj.getUnderlying();

    // The underlying is expected to be a map
    if (!(underlying instanceof Map)) {
      throw new PropertyAccessException(
          "Mismatched property getter to event bean type, "
              + "the underlying data object is not of type java.lang.Map");
    }

    Map map = (Map) underlying;

    Object value = map.get(propertyMap);
    if (value == null) {
      return null;
    }
    if (!value.getClass().isArray()) {
      return null;
    }
    if (Array.getLength(value) <= index) {
      return null;
    }
    Object valueMap = Array.get(value, index);
    if (!(valueMap instanceof Map)) {
      if (value instanceof EventBean) {
        return eventBeanEntryGetter.getFragment((EventBean) value);
      }
      return null;
    }

    // If the map does not contain the key, this is allowed and represented as null
    EventBean eventBean = eventAdapterService.adaptorForTypedMap((Map) valueMap, innerType);
    return eventBeanEntryGetter.getFragment(eventBean);
  }
Example #3
0
 public Object getFragment(String propertyExpression) {
   EventPropertyGetter getter = eventType.getGetter(propertyExpression);
   if (getter == null) {
     throw new PropertyAccessException(
         "Property named '" + propertyExpression + "' is not a valid property name for this type");
   }
   return getter.getFragment(this);
 }
Example #4
0
  public void testGetGetter() {
    EventPropertyGetter getter =
        nested[0].getGetter(
            (BeanEventType) event.getEventType(), SupportEventAdapterService.getService());
    assertEquals("nestedValue", getter.get(event));

    getter =
        nested[1].getGetter(
            (BeanEventType) event.getEventType(), SupportEventAdapterService.getService());
    assertEquals("nestedNestedValue", getter.get(event));
  }
 public Object evaluate(
     Object target,
     EventBean[] eventsPerStream,
     boolean isNewData,
     ExprEvaluatorContext exprEvaluatorContext) {
   if (!(target instanceof EventBean)) {
     return null;
   }
   return getter.get((EventBean) target);
 }
  public Object getMap(Map<String, Object> map) throws PropertyAccessException {
    Object value = map.get(propertyMap);
    if (value == null) {
      return null;
    }
    if (!value.getClass().isArray()) {
      return null;
    }
    if (Array.getLength(value) <= index) {
      return null;
    }
    Object valueMap = Array.get(value, index);
    if (!(valueMap instanceof Map)) {
      if (value instanceof EventBean) {
        return eventBeanEntryGetter.get((EventBean) value);
      }
      return null;
    }

    // If the map does not contain the key, this is allowed and represented as null
    EventBean eventBean = eventAdapterService.adaptorForTypedMap((Map) valueMap, innerType);
    return eventBeanEntryGetter.get(eventBean);
  }
 public Object evaluate(
     EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext exprEvaluatorContext) {
   Object value = reader.getValue();
   if (isPrimitive) {
     return value;
   }
   if (value == null) {
     return null;
   }
   EventBean theEvent = (EventBean) value;
   if (optSubPropName == null) {
     return theEvent.getUnderlying();
   }
   return eventTypeGetter.get(theEvent);
 }
 /**
  * Determine multikey for index access.
  *
  * @param theEvent to get properties from for key
  * @return multi key
  */
 protected Object getKey(EventBean theEvent) {
   return propertyGetter.get(theEvent);
 }
 private Object getKey(EventBean theEvent) {
   return propertyGetter.get(theEvent);
 }