Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

195
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!