src/JavaClassAccessor.st
branchjk_new_structure
changeset 1390 4a623c4ec05f
child 1430 9331b0e95098
equal deleted inserted replaced
1389:81c17056560f 1390:4a623c4ec05f
       
     1 "
       
     2  COPYRIGHT (c) 1996-2011 by Claus Gittinger
       
     3 
       
     4  New code and modifications done at SWING Research Group [1]:
       
     5 
       
     6  COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
       
     7                             SWING Research Group, Czech Technical University in Prague
       
     8 
       
     9  This software is furnished under a license and may be used
       
    10  only in accordance with the terms of that license and with the
       
    11  inclusion of the above copyright notice.   This software may not
       
    12  be provided or otherwise made available to, or used by, any
       
    13  other person.  No title to or ownership of the software is
       
    14  hereby transferred.
       
    15 
       
    16  [1] Code written at SWING Research Group contains a signature
       
    17      of one of the above copright owners. For exact set of such code,
       
    18      see the differences between this version and version stx:libjava
       
    19      as of 1.9.2010
       
    20 "
       
    21 "{ Package: 'stx:libjava' }"
       
    22 
       
    23 Object subclass:#JavaClassAccessor
       
    24 	instanceVariableNames:'name fullName package'
       
    25 	classVariableNames:''
       
    26 	poolDictionaries:''
       
    27 	category:'Languages-Java-Classes'
       
    28 !
       
    29 
       
    30 !JavaClassAccessor class methodsFor:'documentation'!
       
    31 
       
    32 copyright
       
    33 "
       
    34  COPYRIGHT (c) 1996-2011 by Claus Gittinger
       
    35 
       
    36  New code and modifications done at SWING Research Group [1]:
       
    37 
       
    38  COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
       
    39                             SWING Research Group, Czech Technical University in Prague
       
    40 
       
    41  This software is furnished under a license and may be used
       
    42  only in accordance with the terms of that license and with the
       
    43  inclusion of the above copyright notice.   This software may not
       
    44  be provided or otherwise made available to, or used by, any
       
    45  other person.  No title to or ownership of the software is
       
    46  hereby transferred.
       
    47 
       
    48  [1] Code written at SWING Research Group contains a signature
       
    49      of one of the above copright owners. For exact set of such code,
       
    50      see the differences between this version and version stx:libjava
       
    51      as of 1.9.2010
       
    52 
       
    53 "
       
    54 ! !
       
    55 
       
    56 !JavaClassAccessor class methodsFor:'instance creation'!
       
    57 
       
    58 fullName: aSymbol
       
    59 
       
    60     ^self new setFullName: aSymbol
       
    61 
       
    62     "Created: / 28-02-2012 / 19:20:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    63 ! !
       
    64 
       
    65 !JavaClassAccessor methodsFor:'accessing'!
       
    66 
       
    67 fullName
       
    68     ^ fullName
       
    69 !
       
    70 
       
    71 name
       
    72     "Returns Smalltalk name"
       
    73     ^name
       
    74 
       
    75     "Created: / 28-02-2012 / 19:48:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    76 !
       
    77 
       
    78 theClass
       
    79     | cls |
       
    80 
       
    81     cls := self theClassOrNil.
       
    82     cls isNil ifTrue:[cls := Java classForName: (fullName copyReplaceAll: $/ with: $.)].
       
    83     ^cls
       
    84 
       
    85     "Created: / 28-02-2012 / 19:22:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    86 !
       
    87 
       
    88 theClassOrNil
       
    89     ^JavaVM registry classNamed: fullName.
       
    90 
       
    91     "Created: / 28-02-2012 / 19:47:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    92 ! !
       
    93 
       
    94 !JavaClassAccessor methodsFor:'error handling'!
       
    95 
       
    96 doesNotUnderstand: aMessage
       
    97 
       
    98     ^aMessage sendTo: self theClass
       
    99 
       
   100     "Created: / 28-02-2012 / 19:37:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   101 ! !
       
   102 
       
   103 !JavaClassAccessor methodsFor:'initialization'!
       
   104 
       
   105 setFullName: aSymbol
       
   106     fullName := aSymbol.
       
   107     name := 'JAVA::' , ((fullName tokensBasedOn: $/) asStringWith: '::')
       
   108 
       
   109     "Created: / 28-02-2012 / 19:21:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   110 ! !
       
   111 
       
   112 !JavaClassAccessor methodsFor:'instance creation'!
       
   113 
       
   114 new
       
   115 
       
   116     ^self theClass new
       
   117 
       
   118     "Created: / 28-02-2012 / 19:34:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   119 !
       
   120 
       
   121 newCleared
       
   122 
       
   123     ^self theClass newCleared
       
   124 
       
   125     "Created: / 28-02-2012 / 19:34:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   126 ! !
       
   127 
       
   128 !JavaClassAccessor methodsFor:'printing & storing'!
       
   129 
       
   130 printOn:aStream
       
   131     aStream nextPutAll: 'JAVA '.
       
   132     (fullName tokensBasedOn: $/) 
       
   133         do:[:component|aStream nextPutAll: component]
       
   134         separatedBy:[aStream space].
       
   135 
       
   136     "Modified: / 28-02-2012 / 20:27:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   137 ! !
       
   138 
       
   139 !JavaClassAccessor methodsFor:'testing'!
       
   140 
       
   141 isBehavior
       
   142 
       
   143     ^true
       
   144 
       
   145     "Created: / 28-02-2012 / 19:36:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   146 !
       
   147 
       
   148 isClass
       
   149 
       
   150     ^true
       
   151 
       
   152     "Created: / 28-02-2012 / 20:00:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   153 !
       
   154 
       
   155 isJavaClass
       
   156 
       
   157     ^true
       
   158 
       
   159     "Created: / 28-02-2012 / 20:08:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   160 ! !
       
   161 
       
   162 !JavaClassAccessor class methodsFor:'documentation'!
       
   163 
       
   164 version_SVN
       
   165     ^ '$Id$'
       
   166 ! !