Esempio n. 1
0
  /** {@inheritDoc} */
  @Override
  public boolean apply(@Nullable T1 t1, @Nullable T2 t2) {
    lazyCompile();

    if (expr != null) {
      JexlContext ctx = new MapContext();

      ctx.set(var1, t1);
      ctx.set(var2, t2);

      for (Map.Entry<String, Object> e : map.entrySet()) {
        ctx.set(e.getKey(), e.getValue());
      }

      try {
        Object obj = expr.evaluate(ctx);

        if (obj instanceof Boolean) {
          return (Boolean) obj;
        }
      } catch (Exception ex) {
        throw F.wrap(ex);
      }
    }

    return false;
  }
 /** {@inheritDoc} */
 @Override
 public <T> T affinityKey() {
   try {
     return (T) job.getDeployment().annotatedValue(job.getJob(), GridCacheAffinityMapped.class);
   } catch (GridException e) {
     throw F.wrap(e);
   }
 }
 /** {@inheritDoc} */
 @Override
 public String cacheName() {
   try {
     return (String) job.getDeployment().annotatedValue(job.getJob(), GridCacheName.class);
   } catch (GridException e) {
     throw F.wrap(e);
   }
 }