JavaClass.st
changeset 684 d5ee4cc0ffc2
parent 679 8983c2db7e24
child 686 aa412739da79
--- a/JavaClass.st	Wed Aug 16 15:04:56 2000 +0000
+++ b/JavaClass.st	Wed Aug 23 12:19:29 2000 +0000
@@ -706,6 +706,25 @@
     ^ self
 !
 
+javaPackage
+    "the javaPackage - as seen by a java programmer.
+     (with '/'s replaced by dots) extract from the fullName"
+
+    |components|
+
+    components := fullName asCollectionOfSubstringsSeparatedBy:$/.
+    components size > 1 ifTrue:[
+        ^ (components copyWithoutLast:1) asStringWith:$.
+    ].
+    ^ fullName
+
+    "
+     Java allClasses first fullName    
+     Java allClasses first javaPackage  
+     Java allClasses first package      
+    "
+!
+
 lastName
     ^ fullName copyFrom:(fullName lastIndexOf:$/)+1
 
@@ -735,19 +754,23 @@
 !
 
 package
-    "extract from the fullName"
+    "the package (as seen by a smalltalk programmer)
+     extract from the fullName, (with '/'s) and prepend 'java:'"
 
-    |components|
+    |components p|
 
     components := fullName asCollectionOfSubstringsSeparatedBy:$/.
     components size > 1 ifTrue:[
-	^ (components copyWithoutLast:1) asStringWith:$/
+        p := (components copyWithoutLast:1) asStringWith:$/
+    ] ifFalse:[
+        p := fullName
     ].
-    ^ fullName
+    ^ 'java:' , p
 
     "
-     Java allClasses first fullName
-     Java allClasses first package  
+     Java allClasses first fullName   
+     Java allClasses first package    
+     Java allClasses first javaPackage  
     "
 !
 
@@ -1750,6 +1773,6 @@
 !JavaClass class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaClass.st,v 1.114 2000/08/15 14:35:33 cg Exp $'
+    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaClass.st,v 1.115 2000/08/23 12:19:29 cg Exp $'
 ! !
 JavaClass initialize!