com.system.InternalProperty
class, which is used both in com.system.persist.PropertyManager
and in com.system.network.PropertyUpdater
, then the InternalProperty
should be declared public
.
class InternalProperty
{
private final int c;
InternalProperty( int c)
{
this .c = c;
}
int getC()
{
return c;
}
}
* This source code was highlighted with Source Code Highlighter .
public
. Then the user will not be able to create an instance of such a class. In our example, it will look like this:public class InternalProperty
{
private final int c;
InternalProperty( int c)
{
this .c = c;
}
public int getC()
{
return c;
}
}
* This source code was highlighted with Source Code Highlighter .
@VisibleIn
annotation would be included. This annotation would be placed on a class, class field, or method and would expand the scope of the object. My code would look like this:@VisibleIn ( "com.system.network" )
@VisibleIn ( "com.system.persist" )
class InternalProperty
{
private final int c;
InternalProperty( int c)
{
this .c = c;
}
int getC()
{
return c;
}
}
* This source code was highlighted with Source Code Highlighter .
InternalProperty
would be visible in its package, in com.system.network
, and in com.system.persist
.
@VisibleIn
?Source: https://habr.com/ru/post/75468/