RepoPilot

How do their APIs compare?

About karumi/dexter · 2 messages · last activity 9/7/2026

Question

How do their APIs compare?

RepoPilot

Good comparison question since these two libraries operate at completely different layers, but I can contrast what's visible in the data.

karumi/dexter — Android runtime-permissions API

Dexter exposes a small, fluent builder-style API oriented around a single concern: requesting Android runtime permissions.

  • Entry point: Dexter.withContext(activity) chained with .withPermission(permission) (or presumably a multi-permission variant), .withListener(listener), and .check() to trigger the actual request, as shown in the README usage example [README.md:L1-L20 excerpt / usage section].
  • Callback-based results: Rather than returning a value synchronously (impossible given Android's async permission dialog), Dexter uses listener interfaces:
    • PermissionListener for single permissions, with onPermissionGranted(PermissionGrantedResponse), onPermissionDenied(PermissionDeniedResponse), and onPermissionRationaleShouldBeShown(PermissionRequest, PermissionToken) [README.md:L174-L186].
    • MultiplePermissionsListener for batches, backed by MultiplePermissionsReport [dexter/src/main/java/com/karumi/dexter/listener/multi/BaseMultiplePermissionsListener.java:L1-L27].
  • Convenience base classes: BasePermissionListener [dexter/src/main/java/com/karumi/dexter/listener/single/BasePermissionListener.java:L1-L27] and BaseMultiplePermissionsListener let consumers override only the callbacks they care about, rather than implementing every interface method.
  • **Control-flow token:[REDACTED] PermissionToken.continuePermissionRequest() is a distinctive API idiom — because Android pauses the request pipeline while a rationale is being shown, Dexter forces the caller to explicitly resume the flow via this token, blocking further Dexter calls until it's invoked [README.md:L174-L186].

Overall, Dexter's API surface is narrow, synchronous-looking (fluent chain) but async in effect, and entirely UI/permission-domain specific.

netflix/hystrix — resilience/circuit-breaker API

Hystrix's API is broader and infrastructure-oriented, aimed at wrapping arbitrary remote calls with fault tolerance. From the retrieved data, the surface includes:

  • Command/closure abstractions: ClosureCommand, ClosureFactory/AsyncClosureFactory [hystrix-contrib/hystrix-javanica/.../AsyncClosureFactory.java:L1-L23], and Closure (wrapping a Method + instance) [.../closure/Closure.java:L1-L23] — these back the Javanica annotation-driven module, letting methods be turned into Hystrix commands via reflection rather than manual subclassing.
  • Caching support: HystrixGeneratedCacheKey / DefaultHystrixGeneratedCacheKey for request caching keys [.../cache/DefaultHystrixGeneratedCacheKey.java:L1-L24], plus a dedicated exception type HystrixCacheKeyGenerationException for cache-key generation failures [.../exception/HystrixCacheKeyGenerationException.java:L1-L22].
  • Metrics-as-streams architecture: Per the 1.5.0 changelog, Hystrix moved from aggregate structures (HystrixRollingNumber, HystrixRollingPercentile) toward stream-based primitives like HystrixCommandCompletionStream, letting consumers aggregate metrics however they want, including off-box [CHANGELOG.md:L207-L224].
  • Request-context lifecycle API: HystrixRequestContext was changed to implement Closeable [CHANGELOG.md:L200-L206], aligning it with Java's try-with-resources idiom.

Contrast

AspectDexterHystrix
DomainAndroid permissions UXDistributed-system fault tolerance
Core interactionListener callbacks + resumable tokenCommand objects, closures, streams
Async modelCallback-driven, paused via PermissionTokenAsync via AsyncClosureFactory, Rx-backed metrics streams
Extension mechanismBase listener classes to override select

Want to ask your own question?

Open chat for karumi/dexter

Public Q&A. Generated by RepoPilot from the actual source of karumi/dexter. AI answers can be incomplete or stale — verify before relying on them.