Abbreviated type names in java

Is there a way to shorten type names in java. Something similar to typedef in C ++ or similar to using namespaces?
For example, if I have a type "org.w3c.dom.Node" and I don’t want to write
this full name every time, but I also don’t want to import the whole file,
but only locally define the type "Node" as "org.w3c .dom.Node "by one method?

+3


source to share


2 answers


No, there is no way to create an alias "locally" (I'm taking it "locally", which is what you mean in the method, since you said you didn't want to do import

at the top of a file that is "local" to a file).



+5


source


You don't want to import this class for the entire file, but what about moving the method (s) that require org.w3c.dom.Node to a new file that has this import?



+2


source







All Articles