public Object getValue(TaggedLogAPIEntity entity, String field) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { if (!entityClass.equals(entity.getClass())) { if ((entityClass.equals(GenericMetricEntity.class) && entity.getClass().equals(GenericMetricShadowEntity.class))) { GenericMetricShadowEntity e = (GenericMetricShadowEntity)entity; return e.getValue(); } else { throw new IllegalArgumentException("Invalid entity type: " + entity.getClass().getSimpleName()); } } final Method m = qualifierGetterMap.get(field); if (m == null) { // The field is a tag if (entity.getTags() != null) { return entity.getTags().get(field); } } if (m != null) { return m.invoke(entity); } return null; }
public Object getValue(TaggedLogAPIEntity entity, String field) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { if (!entityClass.equals(entity.getClass())) { if ((entityClass.equals(GenericMetricEntity.class) && entity.getClass().equals(GenericMetricShadowEntity.class))) { GenericMetricShadowEntity e = (GenericMetricShadowEntity)entity; return e.getValue(); } else { throw new IllegalArgumentException("Invalid entity type: " + entity.getClass().getSimpleName()); } } final Method m = qualifierGetterMap.get(field); if (m == null) { // The field is a tag if (entity.getTags() != null) { return entity.getTags().get(field); } } if (m != null) { return m.invoke(entity); } return null; }