Use this SmartHandle as a test to guard target and fallback handles.

@param target   the "true" path for this handle's test
@param fallback the "false" path for this handle's test
@return a MethodHandle that performs the test and branch
774665
public MethodHandle guard(MethodHandle target, MethodHandle fallback) {
        return MethodHandles.guardWithTest(handle, target, fallback);
    }
401079
@NonNull
    public <T> T create(@NonNull Class<? extends T> clazz, @NonNull Fallback<T> fallback) {
        T t = create(clazz);
        return t != null ? t : fallback.get();
    }
789270
static <F, T> Function<F, T> fallback(
      Function<F, T> function, Function<? super F, ? extends T> defaultFunction) {
    return from -> {
      T result = function.apply(from);
      return result == null ? defaultFunction.apply(from) : result;
    };
  }
1126260
public static <T, P> AsyncCallback<T> map (AsyncCallback<P> target, final Function<T, P> f)
    {
        return new ChainedCallback<T, P>(target) {
            @Override public void onSuccess (T result) {
                forwardSuccess(f.apply(result));
            }
        };
    }
99371
public final void addTarget(@NotNull final Target target) {
        Contract.requireArgNotNull("target", target);
        if (targets == null) {
            targets = new ArrayList<>();
        }
        targets.add(target);
    }
298648
public static <T> T orElseIfNull(T target, T elseTarget) {
        return Optional.ofNullable(target).orElse(elseTarget);
    }
547776
@Nonnull
	public final LObjIntCharFunctionBuilder<T, R> withHandling(@Nonnull HandlingInstructions<RuntimeException, RuntimeException> handling) {
		Null.nonNullArg(handling, "handling");
		if (this.handling != null) {
			throw new UnsupportedOperationException("Handling is already set for this builder.");
		}
		this.handling = handling;
		return self();
	}
390662
function(method, args, options) {
            var that = this, methodHandler;

            options = options || {};

            var handler = this.getHandler(method);
            if (!handler) return Q.reject(new Error("No handler found for method: "+method));

            // Is offline
            if (!Offline.isConnected()) {
                methodHandler = handler.fallback;
            }
            methodHandler = methodHandler || handler.execute || this.defaultHandler.execute;

            // No default
            if (!methodHandler) {
                return Q.reject(new Error("No handler found for this method in this backend"));
            }

            return Q(methodHandler(args, options, method)).then(function(results) {
                if (handler.after) {
                    return Q.all([
                        Q(handler.after(args, results, options, method)),
                        Q((that.defaultHandler.after || function() {})(args, results, options, method))
                    ]).then(function() {
                        return Q(results);
                    }, function() {
                        return Q(results);
                    });
                }
                return results;
            });
        }
692311
public static Map<String, Object> resolveTo(Map<String, Object> root, Map<String, Object> target)
	{
		resolve(target, root, "");
		return target;
	}
510686
public static <R> Retryer<R> of(Callable<R> target) {
        return new Retryer<R>(target);
    }
1375045
static List<EventMethod> getMethodsForTarget(@NonNull Object target) {
        if (target instanceof Class) {
            return getMethodsFromClass((Class<?>) target, true);
        } else {
            return getMethodsFromClass(target.getClass(), false);
        }
    }
184452
@GwtIncompatible
  public static PathSubject assertThat(@NullableDecl Path target) {
    return assertAbout(PathSubject.paths()).that(target);
  }
321160
public static Object invokeMethod(Object target, String method, Object... args) {
    try {
      return InvokerHelper.invokeMethod(target, method, args);
    } catch (InvokerInvocationException e) {
      ExceptionUtil.sneakyThrow(e.getCause());
      return null; // never reached
    }
  }
115943
protected static MethodHandle makeFallBack(MutableCallSite mc, Class<?> sender, String name, int callID, MethodType type, boolean safeNavigation, boolean thisCall, boolean spreadCall) {
            MethodHandle mh = MethodHandles.insertArguments(SELECT_METHOD, 0, mc, sender, name, callID, safeNavigation, thisCall, spreadCall, /*dummy receiver:*/ 1);
            mh =    mh.asCollector(Object[].class, type.parameterCount()).
                    asType(type);
            return mh;
        }
523375
public Object invoke(Object target, String... args) throws Exception
    {
        if (getter)
        {
            return field.get(target);
        }
        else
        {
            field.set(target, TypeConversion.parse(args[0], field.getType()));
            return null;
        }
    }
314639
public void targetAppears( TargetHandler targetItf ) {
		this.defaultTargetHandlerResolver.addTargetHandler( targetItf );

		// When a target is deployed, we may also have to update instance states.
		// Consider as an example when the DM restarts. Targets may be injected
		// before and after the pojo was started by iPojo.

		// See #519 for more details.
		// Notice we restore instances only when the DM was started (the messaging
		// must be ready). If it is not started, do nothing. The "start" method
		// will trigger the restoration.

		// We consider the DM is started if the timer is not null.
		if( this.timer != null )
			restoreInstancesFrom( targetItf );
	}
152606
static MethodInvoker reflective(final Object target, final Method method) {
        return new MethodInvoker() {

            @Override
            public void invoke() throws Exception {
                method.invoke(target);
            }

            @Override
            public void setTarget(Object target) {
            }
        };
    }