Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

205
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda