design - Java nested package visibility -


Often when I am preparing some new components of this project, then I am creating a limit that I Can not do the right way ...

Imagine a package "component" and in this component package you have some public classes / interfaces that are naturally designed to share publicly And some class / interfaces (component specificist) in the internal package They should not be visible from outside the package ...

Now with the current possibilities of the current possibilities I can get it (violation of momentum) without exposing the material outside the "components" package Doing ...

How do you do this?

Yes, you can do this by using the internal keyword in some package name. There is a package

  com.myPackage.compoint   

You may have another package

  com.myPackage .compoint .internal.blahblah   

When you use keywords internally, it is not exposed to other jars and is not available for use outside the jar, but by another package Can be used inside the jar. Here internal package com.myPackage.component is below the hierarchy. As the "code" quoted by the package is not yet sorted - just the human pattern matching is done effectively for the "hierarchy" organization. That's why I meant this by moving the package forward.


Edit

You can define a class package by not giving class access to an example:

  class PackagePrivateClass { }   

You can import this class in a single package but outside the package it does not allow you to use it.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

C++ Array Type Not Assignable in Copy Constructor -