Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

197
Vistas
How to hide an interface in another interface?

I want to write an Android library, which in turn uses another Androd library.

Let's say I want to write libHigh which uses another libLow

There is an interface in libLow:

interface LowLevelInterface{
   fun methodA()
}

and I implement this in my higher level library libHigh:

open class OpenClassImpl : LowLevelInterface {
  override fun methodA(){//..}
}

It is an 'open' class, because later in app layer I expect to extend from OpenClassImpl. But I dont want to make the interface 'LowLevelInterface' visible for later upper app level usage.

How can I hide the interface from libLow for the upper app level?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

It depends on your existing code whether this will work, or how much effort it will be, but you could have a property implementing the interface instead of doing it directly:

open class OpenClassImpl {
    // or protected/private
    internal val lowLevelImpl: LowLevelInterface = { 
        // can access privates of OpenClassImpl here
    }
}

and change the relevant calls to pass it.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda