"{ Package: 'stx:libjava' }"
JavaRef2 subclass:#JavaClassRef2
instanceVariableNames:'name'
classVariableNames:''
poolDictionaries:''
category:'Languages-Java-Reader-Support-new'
!
!JavaClassRef2 class methodsFor:'instance creation'!
for: internalJavaClassName
"Create & return a new instance for arg."
^ self basicNew initializeFor: internalJavaClassName
"Modified: / 08-04-2011 / 17:31:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaClassRef2 methodsFor:'accessing'!
classLoader
owner ifNil:[^nil] ifNotNil:[^owner classLoader].
"Created: / 11-04-2011 / 21:52:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
javaClassName
"return java class name as written in java programs e.g. java.util.String
in case of array, return class name without square brackets"
| tmp |
tmp := (name replaceAll: '[' with: '').
^ tmp copyFrom: 2 to: tmp size -1.
"Created: / 08-04-2011 / 18:30:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
"Modified: / 11-04-2011 / 19:23:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
name
^ name.
"Created: / 08-04-2011 / 13:48:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaClassRef2 methodsFor:'array support'!
arrayDimensions
^ name occurrencesOf:$[.
"Created: / 08-04-2011 / 18:42:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
isJavaArrayClassRef
^ name startsWith:'['.
"Created: / 08-04-2011 / 18:40:40 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaClassRef2 methodsFor:'comparing'!
= anotherJavaClassRef
"superclass JavaRef2 says that I am responsible to implement this method"
anotherJavaClassRef isJavaClassRef ifFalse: [ ^ false ].
^ self name = anotherJavaClassRef name.
"Modified: / 08-04-2011 / 13:48:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
hash
^ name hash.
"Modified: / 08-04-2011 / 13:52:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaClassRef2 methodsFor:'initialization'!
initializeFor: internalJavaClassName
name := internalJavaClassName.
super initialize.
"Modified: / 08-04-2011 / 17:30:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaClassRef2 methodsFor:'private - resolving'!
findResolvedStaticValue
"Resolving static inner classes is not different from resolving any other class, it's only done in different circumstances"
^ self findResolvedValue.
"Created: / 28-04-2011 / 21:57:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
findResolvedValue
"Resolve reference and set valueCache."
valueCache := JavaResolver uniqueInstance
resolveClassIndentifiedByRef: self.
"Modified: / 08-04-2011 / 17:39:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaClassRef2 methodsFor:'queries'!
isJavaClassRef
^true.
"Created: / 11-04-2011 / 19:10:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaClassRef2 methodsFor:'resolving'!
invalidateForClass: internalJavaClassName
"Invalidate (means call invalidate) reference if it has something to do with given class (e.g Class named internalJavaClassName was unloaded).
Return true, if reference was invalidated."
name = internalJavaClassName ifTrue: [self invalidate. ^ true].
^ false.
"Modified: / 08-04-2011 / 16:06:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaClassRef2 class methodsFor:'documentation'!
version_SVN
^ '$Id$'
! !