837 "Created: / 20-01-1997 / 13:06:06 / cg" |
837 "Created: / 20-01-1997 / 13:06:06 / cg" |
838 "Modified: / 20-04-2012 / 18:35:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
838 "Modified: / 20-04-2012 / 18:35:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
839 ! |
839 ! |
840 |
840 |
841 package |
841 package |
842 "the package (as seen by a smalltalk programmer) |
842 "Return the package symbol of the class as seen by Smalltalk" |
843 extract from the fullName, (with '/'s) and prepend 'java:'" |
843 |
844 |
844 | packageAnnotation p i | |
845 |components p i| |
845 |
846 |
846 "/ First, look if the class is annotated by stx.libjava.annotation.Package. |
|
847 "/ If so, return annotation's value as package name... |
|
848 |
|
849 annotations notNil ifTrue:[ |
|
850 packageAnnotation := annotations runtimeVisible at: 'Lstx/libjava/annotation/Package;' ifAbsent:[ nil ]. |
|
851 packageAnnotation notNil ifTrue:[ |
|
852 ^ packageAnnotation value |
|
853 ]. |
|
854 ]. |
|
855 |
|
856 "/ If not, extract java package name and prepend java:. |
|
857 "/ For default package, return java:(default). |
847 i := binaryName lastIndexOf:$/. |
858 i := binaryName lastIndexOf:$/. |
848 p := binaryName copyTo:i - 1. |
859 p := binaryName copyTo:i - 1. |
849 p size == 0 ifTrue:[ |
860 p isEmpty ifTrue:[ |
850 ^ 'java' |
861 ^ #'java:(default)' |
851 ]. |
862 ]. |
852 "/ components := fullName asCollectionOfSubstringsSeparatedBy:$/. |
|
853 "/ components size > 1 ifTrue:[ |
|
854 "/ p := (components copyWithoutLast:1) asStringWith:$/ |
|
855 "/ ] ifFalse:[ |
|
856 "/ p := fullName |
|
857 "/ ]. |
|
858 |
|
859 ^ 'java:' , p |
863 ^ 'java:' , p |
860 |
864 |
861 " |
865 " |
862 Java allClasses first fullName |
866 Java allClasses first fullName |
863 Java allClasses first package |
867 Java allClasses first package |
864 Java allClasses first javaPackage |
868 Java allClasses first javaPackage |
865 " |
869 " |
|
870 |
|
871 "Modified: / 30-07-2014 / 20:09:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
866 ! |
872 ! |
867 |
873 |
868 protectionDomain |
874 protectionDomain |
869 ^ protectionDomain |
875 ^ protectionDomain |
870 ! |
876 ! |