public class TypeClass extends Object implements Reference, Codec<Reference>
TypeClass
instances via their full name or via their
AppleScript 4char code.Constructor | Description |
---|---|
TypeClass() |
|
TypeClass(String name,
Chevron code) |
|
TypeClass(String objectReference,
String applicationReference) |
|
TypeClass(String name,
String code,
Class<?> applicationInterface,
TypeClass superClass) |
|
TypeClass(String name,
String code,
String applicationReference,
TypeClass superClass) |
|
TypeClass(String name,
String code,
String applicationReference,
Class<?> applicationInterface,
TypeClass superClass) |
Modifier and Type | Method | Description |
---|---|---|
TypeClass |
_decode(String objectReference,
String applicationReference) |
Parse the given reference and create a corresponding
Java object for it.
|
String |
_encode(Object reference) |
Encode the given object as valid AppleScript object reference.
|
TypeClass[] |
_getAppleScriptTypes() |
Array of AppleScript types that can be decoded
with this class.
|
Class<? extends Reference> |
_getJavaType() |
The type used in Java interfaces that this
Codec corresponds to. |
<T> T |
cast(Class<T> klass) |
Cast this object to another AppleScript type.
|
boolean |
equals(Object obj) |
|
static TypeClass |
fromClass(Class<?> klass) |
Read the class's
CLASS field to determine the TypeClass
represented by this Java class/interface. |
Class<?> |
getApplicationInterface() |
Return the main application class for the type represented by
this type class.
|
String |
getApplicationReference() |
Application reference.
|
Chevron |
getCode() |
Type code, with chevrons (e.g.
|
static TypeClass |
getInstance() |
Null instance used for
Codec implementation. |
String |
getName() |
|
String |
getObjectReference() |
Object reference.
|
TypeClass |
getSuperClass() |
|
TypeClass |
getTypeClass() |
Returns the AppleScript runtime class for this object.
|
int |
hashCode() |
|
TypeClass |
intern() |
Attempt to intern this instance of
TypeClass . |
boolean |
isAssignableFrom(TypeClass cls) |
Indicates whether the given class is assignable to this class.
|
boolean |
isInstance(Object object) |
Indicates whether the given object is an instance of this class.
|
boolean |
isInstanceOf(TypeClass typeClass) |
Indicates whether this object is an instance of the given
TypeClass . |
String |
toString() |
public TypeClass()
public TypeClass(String objectReference, String applicationReference)
objectReference
- object refapplicationReference
- app refpublic TypeClass(String name, Chevron code)
name
- e.g. user playlist
code
- e.g. «class cUsP»
public TypeClass(String name, String code, Class<?> applicationInterface, TypeClass superClass)
name
- e.g. user playlist
code
- e.g. «class cUsP»
applicationInterface
- application class this type belongs tosuperClass
- AppleScript super classpublic TypeClass(String name, String code, String applicationReference, TypeClass superClass)
name
- e.g. user playlist
code
- e.g. «class cUsP»
applicationReference
- application class this type belongs tosuperClass
- AppleScript super classpublic TypeClass(String name, String code, String applicationReference, Class<?> applicationInterface, TypeClass superClass)
name
- e.g. user playlist
code
- e.g. «class cUsP»
applicationReference
- application class this type belongs toapplicationInterface
- application class this type belongs tosuperClass
- AppleScript super classpublic String getObjectReference()
Reference
getObjectReference
in interface Reference
public String getApplicationReference()
Reference
getApplicationReference
in interface Reference
public static TypeClass getInstance()
Codec
implementation.public static TypeClass fromClass(Class<?> klass) throws NoSuchFieldException, IllegalAccessException
CLASS
field to determine the TypeClass
represented by this Java class/interface.klass
- klassNoSuchFieldException
- if reflective access to the field CLASS
failsIllegalAccessException
- if reflective access to the field CLASS
failspublic TypeClass getSuperClass()
public Class<?> getApplicationInterface()
intern()
to perform an application interface lookup based on a
set application reference.public String getName()
public Chevron getCode()
«class cUsP»
).«class cUsP»
public TypeClass intern()
TypeClass
.public boolean isAssignableFrom(TypeClass cls)
cls
- classClass.isAssignableFrom(Class)
public boolean isInstance(Object object)
object
- objectClass.isInstance(Object)
public TypeClass getTypeClass()
Reference
Note that the runtime may be different from the class corresponding to the Java interface you are currently using as a proxy, i.e. the Java interface may be less specialized.
getTypeClass
in interface Reference
public boolean isInstanceOf(TypeClass typeClass)
Reference
TypeClass
.isInstanceOf
in interface Reference
typeClass
- type classpublic <T> T cast(Class<T> klass)
Reference
public String _encode(Object reference)
Codec
public Class<? extends Reference> _getJavaType()
Codec
Codec
corresponds to.
In case a primitive type is available (e.g. Integer.TYPE
), that type
should be returned._getJavaType
in interface Codec<Reference>
public TypeClass[] _getAppleScriptTypes()
Codec
_getAppleScriptTypes
in interface Codec<Reference>