0

Im building an API and i would like the following done maintaining the packages

com.example.objects
 -> public someObject (class)
     -> int someInt = 500;

com.example.database
 -> private database (class)
     -> void someMethod() {
          (i need access to someInt here)
        }

The problem comes because i need to access the constant someInt from someObject in the database methods. But at the same time i don't like outside users of the API to be able to see the value of someInt.

I can't find a way to do this without the two classes being inside the same package since (friend c++) relation doesn't exists in java and i don't want to force it since its considered a bad design in java.

Any suggestions?

LordSidious
  • 508
  • 5
  • 15

0 Answers0