L
Lawrence D'Oliveiro
Consider a piece of code which wants to use two different classes,
com.example.android.sqlite.Useful and com.example.android.mysql.Useful. Your
only reasonable options are:
1) Choose one to specify in an import statement so you can use its name
unqualified. The other class will have to be referred to by its fully
qualified name
2) Don’t bother importing either, use the full name for both.
There is no way you can do something like
import com.example.android.sqlite;
import com.example.android.mysql;
and then be able to refer to the classes as sqlite.Useful and mysql.Useful.
Why not?
Another possibility would be the option of renaming them, Python-style, e.g.
import com.example.android.sqlite.Useful as SQLiteUseful;
import com.example.android.mysql.Useful as MySQLUseful;
This lets the client code manage its own namespace, independently of the
providers’ namespaces.
com.example.android.sqlite.Useful and com.example.android.mysql.Useful. Your
only reasonable options are:
1) Choose one to specify in an import statement so you can use its name
unqualified. The other class will have to be referred to by its fully
qualified name
2) Don’t bother importing either, use the full name for both.
There is no way you can do something like
import com.example.android.sqlite;
import com.example.android.mysql;
and then be able to refer to the classes as sqlite.Useful and mysql.Useful.
Why not?
Another possibility would be the option of renaming them, Python-style, e.g.
import com.example.android.sqlite.Useful as SQLiteUseful;
import com.example.android.mysql.Useful as MySQLUseful;
This lets the client code manage its own namespace, independently of the
providers’ namespaces.