Search in sources :

Example 1 with IChainedResponder

use of weborb.client.IChainedResponder in project Android-SDK by Backendless.

the class Persistence method findById.

protected <E> void findById(E entity, List<String> relations, Integer relationsDepth, AsyncCallback<E> responder) {
    try {
        if (entity == null)
            throw new IllegalArgumentException(ExceptionMessage.NULL_ENTITY);
        IChainedResponder chainedResponder = new AdaptingResponder<E>((Class<E>) entity.getClass(), new PoJoAdaptingPolicy<E>());
        Object entityArg = ReflectionUtil.hasField(entity.getClass(), Persistence.DEFAULT_OBJECT_ID_FIELD) ? entity : FootprintsManager.getInstance().getObjectId(entity);
        Invoker.invokeAsync(PERSISTENCE_MANAGER_SERVER_ALIAS, "findById", new Object[] { BackendlessSerializer.getSimpleName(entity.getClass()), entityArg, relations, relationsDepth }, responder, chainedResponder);
    } catch (Throwable e) {
        if (responder != null)
            responder.handleFault(new BackendlessFault(e));
    }
}
Also used : AdaptingResponder(com.backendless.core.responder.AdaptingResponder) IChainedResponder(weborb.client.IChainedResponder) BackendlessFault(com.backendless.exceptions.BackendlessFault)

Aggregations

AdaptingResponder (com.backendless.core.responder.AdaptingResponder)1 BackendlessFault (com.backendless.exceptions.BackendlessFault)1 IChainedResponder (weborb.client.IChainedResponder)1