[Kde-java] Qt and KDE java package names

Gert-Jan van der Heiden g.j.vanderheiden at genimen.com
Mon Aug 11 10:19:13 CEST 2003


> Good point. So would 'qt.Widget' or 'kde.Application' look ok, or do we
> really need those long names with 'org.kde' in them?

No, it just represents it's origin. It is used to quickly see which API is 
used in the code, and to organize large number of packages from different 
APIs.

> > You made a point here. But if you write a serious application, this isn't
> > an exception either. I mean, if you define your own slot and signals, but
> > I don't know if the current bindings can do that. Maybe the new version?
>
> Oh yes, thats no problem. I the connect() statement doesn't find a C++ slot
> or signal it assumes they are java ones. You don't have to declare
> slots/signals in advance (although you do in PerlQt and QtRuby).

HOT!

> The code special cases String. The problem is that there is no way of
> discovering which imports a java class has used via reflection - it's a
> compile time only thing. Here's the 'hacky' code from qtjava.java:
>
> 	/** Converts any unqualified class names in a signal or slot string to the
> fully qualified versions */
> 	public static String toFullyQualifiedClassName(String className) {
> 		if (className.equals("String")) {
> 			return "java.lang.String";
> 		} else if (className.equals("Date")) {
> 			return "java.util.Date";
> 		} else if (className.equals("Calendar")) {
> 			return "java.util.GregorianCalendar";
> 		} else if (className.equals("ArrayList")) {
> 			return "java.util.ArrayList";
> 		} else if (className.equals("ByteArrayOutputStream")) {
> 			return "java.io.ByteArrayOutputStream";
> 		} else if (className.equals("Job")) {
> 			return "org.kde.koala.Job";
> 		} else if (className.equals("Part")) {
> 			return "org.kde.koala.Part";
> 		} else if (className.equals("Slave")) {
> 			return "org.kde.koala.Slave";
> 		} else if (className.equals("DOMNode")) {
> 			return "org.kde.koala.DOMNode";
> 		} else if (className.startsWith("Q")) {
> 			return "org.kde.qt." + className;
> 		} else if (className.startsWith("K")) {
> 			return "org.kde.koala." + className;
> 		}
> 		return className;
> 	}

Ok, I see what you mean. 

Maybe you should always let the lazy b... eeh I mean programmer prefix the 
class name with package names.

Gert-Jan




More information about the Kde-java mailing list