type clean up
This commit is contained in:
94
ridljar/com/sun/star/lib/uno/typedesc/FieldDescription.java
Normal file
94
ridljar/com/sun/star/lib/uno/typedesc/FieldDescription.java
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
/*************************************************************************
|
||||||
|
*
|
||||||
|
* $RCSfile: FieldDescription.java,v $
|
||||||
|
*
|
||||||
|
* $Revision: 1.1 $
|
||||||
|
*
|
||||||
|
* last change: $Author: kr $ $Date: 2001-05-08 09:34:17 $
|
||||||
|
*
|
||||||
|
* The Contents of this file are made available subject to the terms of
|
||||||
|
* either of the following licenses
|
||||||
|
*
|
||||||
|
* - GNU Lesser General Public License Version 2.1
|
||||||
|
* - Sun Industry Standards Source License Version 1.1
|
||||||
|
*
|
||||||
|
* Sun Microsystems Inc., October, 2000
|
||||||
|
*
|
||||||
|
* GNU Lesser General Public License Version 2.1
|
||||||
|
* =============================================
|
||||||
|
* Copyright 2000 by Sun Microsystems, Inc.
|
||||||
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License version 2.1, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||||
|
* MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Sun Industry Standards Source License Version 1.1
|
||||||
|
* =================================================
|
||||||
|
* The contents of this file are subject to the Sun Industry Standards
|
||||||
|
* Source License Version 1.1 (the "License"); You may not use this file
|
||||||
|
* except in compliance with the License. You may obtain a copy of the
|
||||||
|
* License at http://www.openoffice.org/license.html.
|
||||||
|
*
|
||||||
|
* Software provided under this License is provided on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||||
|
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||||
|
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||||
|
* See the License for the specific provisions governing your rights and
|
||||||
|
* obligations concerning the Software.
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||||
|
*
|
||||||
|
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||||
|
*
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s): _______________________________________
|
||||||
|
*
|
||||||
|
*
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
package com.sun.star.lib.uno.typedesc;
|
||||||
|
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
|
||||||
|
import com.sun.star.uno.IMethodDescription;
|
||||||
|
import com.sun.star.uno.ITypeDescription;
|
||||||
|
import com.sun.star.uno.IFieldDescription;
|
||||||
|
|
||||||
|
import com.sun.star.lib.uno.typeinfo.MemberTypeInfo;
|
||||||
|
|
||||||
|
public class FieldDescription extends MemberTypeInfo implements IFieldDescription {
|
||||||
|
ITypeDescription _iTypeDescription;
|
||||||
|
Field _field;
|
||||||
|
|
||||||
|
FieldDescription(MemberTypeInfo memberTypeInfo, Field field) {
|
||||||
|
super(memberTypeInfo.getName(), memberTypeInfo.getFlags());
|
||||||
|
|
||||||
|
_field = field;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITypeDescription getTypeDescription() {
|
||||||
|
if(_iTypeDescription == null)
|
||||||
|
_iTypeDescription = TypeDescription.getTypeDescription(this, getField().getType());
|
||||||
|
|
||||||
|
return _iTypeDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Field getField() {
|
||||||
|
return _field;
|
||||||
|
}
|
||||||
|
}
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: MethodDescription.java,v $
|
* $RCSfile: MethodDescription.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.3 $
|
* $Revision: 1.4 $
|
||||||
*
|
*
|
||||||
* last change: $Author: kr $ $Date: 2001-04-17 15:01:37 $
|
* last change: $Author: kr $ $Date: 2001-05-08 09:34:17 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -65,12 +65,16 @@ package com.sun.star.lib.uno.typedesc;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
|
||||||
|
import com.sun.star.uno.IMethodDescription;
|
||||||
|
import com.sun.star.uno.ITypeDescription;
|
||||||
|
|
||||||
|
|
||||||
import com.sun.star.lib.uno.typeinfo.MethodTypeInfo;
|
import com.sun.star.lib.uno.typeinfo.MethodTypeInfo;
|
||||||
import com.sun.star.lib.uno.typeinfo.ParameterTypeInfo;
|
import com.sun.star.lib.uno.typeinfo.ParameterTypeInfo;
|
||||||
import com.sun.star.lib.uno.typeinfo.TypeInfo;
|
import com.sun.star.lib.uno.typeinfo.TypeInfo;
|
||||||
|
|
||||||
|
|
||||||
public class MethodDescription extends MethodTypeInfo {
|
public class MethodDescription extends MethodTypeInfo implements IMethodDescription {
|
||||||
static private final TypeDescription __xInterface = TypeDescription.getTypeDescription(com.sun.star.uno.XInterface.class);
|
static private final TypeDescription __xInterface = TypeDescription.getTypeDescription(com.sun.star.uno.XInterface.class);
|
||||||
static private TypeDescription __xInterfaceArray;
|
static private TypeDescription __xInterfaceArray;
|
||||||
static private TypeDescription __xInterfaceArrayArray;
|
static private TypeDescription __xInterfaceArrayArray;
|
||||||
@@ -132,15 +136,15 @@ public class MethodDescription extends MethodTypeInfo {
|
|||||||
_return_sig = TypeDescription.getTypeDescription(this, resultClass);
|
_return_sig = TypeDescription.getTypeDescription(this, resultClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypeDescription[] getInSignature() {
|
public ITypeDescription[] getInSignature() {
|
||||||
return _in_sig;
|
return _in_sig;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypeDescription[] getOutSignature() {
|
public ITypeDescription[] getOutSignature() {
|
||||||
return _out_sig;
|
return _out_sig;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypeDescription getReturnSig() {
|
public ITypeDescription getReturnSignature() {
|
||||||
return _return_sig;
|
return _return_sig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: TypeDescription.java,v $
|
* $RCSfile: TypeDescription.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.7 $
|
* $Revision: 1.8 $
|
||||||
*
|
*
|
||||||
* last change: $Author: kr $ $Date: 2001-05-04 11:13:38 $
|
* last change: $Author: kr $ $Date: 2001-05-08 09:34:17 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -72,6 +72,9 @@ import java.lang.reflect.Modifier;
|
|||||||
|
|
||||||
import com.sun.star.uno.Any;
|
import com.sun.star.uno.Any;
|
||||||
import com.sun.star.uno.Enum;
|
import com.sun.star.uno.Enum;
|
||||||
|
import com.sun.star.uno.IFieldDescription;
|
||||||
|
import com.sun.star.uno.IMethodDescription;
|
||||||
|
import com.sun.star.uno.ITypeDescription;
|
||||||
import com.sun.star.uno.Type;
|
import com.sun.star.uno.Type;
|
||||||
import com.sun.star.uno.TypeClass;
|
import com.sun.star.uno.TypeClass;
|
||||||
import com.sun.star.uno.Union;
|
import com.sun.star.uno.Union;
|
||||||
@@ -94,15 +97,15 @@ import com.sun.star.lib.uno.typeinfo.TypeInfo;
|
|||||||
* methods, which may be changed or moved in the furture, so please
|
* methods, which may be changed or moved in the furture, so please
|
||||||
* do not use these methods.
|
* do not use these methods.
|
||||||
* <p>
|
* <p>
|
||||||
* @version $Revision: 1.7 $ $ $Date: 2001-05-04 11:13:38 $
|
* @version $Revision: 1.8 $ $ $Date: 2001-05-08 09:34:17 $
|
||||||
* @author Kay Ramme
|
* @author Kay Ramme
|
||||||
* @since UDK2.0
|
* @since UDK2.0
|
||||||
*/
|
*/
|
||||||
public class TypeDescription {
|
public class TypeDescription implements ITypeDescription {
|
||||||
/**
|
/**
|
||||||
* When set to true, enables various debugging output.
|
* When set to true, enables various debugging output.
|
||||||
*/
|
*/
|
||||||
public static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
|
|
||||||
public static final TypeDescription __void_TypeDescription = new TypeDescription(TypeClass.VOID, "void", "[Ljava.lang.Void;", void.class); // VOID
|
public static final TypeDescription __void_TypeDescription = new TypeDescription(TypeClass.VOID, "void", "[Ljava.lang.Void;", void.class); // VOID
|
||||||
public static final TypeDescription __char_TypeDescription = new TypeDescription(TypeClass.CHAR, "char", "[C", char.class); // CHAR
|
public static final TypeDescription __char_TypeDescription = new TypeDescription(TypeClass.CHAR, "char", "[C", char.class); // CHAR
|
||||||
@@ -121,7 +124,7 @@ public class TypeDescription {
|
|||||||
public static final TypeDescription __any_TypeDescription = new TypeDescription(TypeClass.ANY, "any", "[Ljava.lang.Object;", Object.class); // ANY
|
public static final TypeDescription __any_TypeDescription = new TypeDescription(TypeClass.ANY, "any", "[Ljava.lang.Object;", Object.class); // ANY
|
||||||
|
|
||||||
|
|
||||||
static private final Hashtable __classToTypeDescription = new Hashtable();
|
static private final Hashtable __classToTypeDescription = new Hashtable();
|
||||||
static private final Hashtable __typeNameToTypeDescription = new Hashtable();
|
static private final Hashtable __typeNameToTypeDescription = new Hashtable();
|
||||||
static private final Hashtable __typeClassToTypeName = new Hashtable();
|
static private final Hashtable __typeClassToTypeName = new Hashtable();
|
||||||
|
|
||||||
@@ -528,6 +531,25 @@ public class TypeDescription {
|
|||||||
return typeDescription;
|
return typeDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public ITypeDescription getTypeDescription(Type type) throws ClassNotFoundException {
|
||||||
|
ITypeDescription iTypeDescription = type.getTypeDescription();
|
||||||
|
|
||||||
|
if(iTypeDescription == null) {
|
||||||
|
if(type.getZClass() != null)
|
||||||
|
iTypeDescription = getTypeDescription(type.getZClass());
|
||||||
|
|
||||||
|
else if(type.getTypeClass() != null && type.getTypeClass() != TypeClass.UNKNOWN)
|
||||||
|
iTypeDescription = getTypeDescription(type.getTypeClass());
|
||||||
|
|
||||||
|
else if(type.getTypeName() != null)
|
||||||
|
iTypeDescription = getTypeDescription(type.getTypeName());
|
||||||
|
|
||||||
|
type.setTypeDescription(iTypeDescription);
|
||||||
|
}
|
||||||
|
|
||||||
|
return iTypeDescription;
|
||||||
|
}
|
||||||
|
|
||||||
static public TypeDescription getTypeDescription(TypeClass typeClass) {
|
static public TypeDescription getTypeDescription(TypeClass typeClass) {
|
||||||
TypeDescription typeDescription = null;
|
TypeDescription typeDescription = null;
|
||||||
|
|
||||||
@@ -548,11 +570,11 @@ public class TypeDescription {
|
|||||||
protected int _offset;
|
protected int _offset;
|
||||||
protected MethodDescription _methodDescriptionsByIndex[];
|
protected MethodDescription _methodDescriptionsByIndex[];
|
||||||
protected Hashtable _methodDescriptionsByName;
|
protected Hashtable _methodDescriptionsByName;
|
||||||
protected Hashtable _memberTypeInfosByName;
|
protected Hashtable _iFieldDescriptionsByName;
|
||||||
|
|
||||||
protected Field _fields[];
|
protected IFieldDescription _iFieldDescriptions[];
|
||||||
|
|
||||||
protected TypeDescription _componentType;
|
protected ITypeDescription _componentType;
|
||||||
|
|
||||||
|
|
||||||
private void _initByClass(Class zClass) {
|
private void _initByClass(Class zClass) {
|
||||||
@@ -588,7 +610,7 @@ public class TypeDescription {
|
|||||||
_typeClass = TypeClass.SEQUENCE;
|
_typeClass = TypeClass.SEQUENCE;
|
||||||
|
|
||||||
_componentType = getTypeDescription(zClass.getComponentType());
|
_componentType = getTypeDescription(zClass.getComponentType());
|
||||||
_typeName = "[]" + _componentType._typeName;
|
_typeName = "[]" + _componentType.getTypeName();
|
||||||
|
|
||||||
_arrayTypeName = "[" + _class.getName();
|
_arrayTypeName = "[" + _class.getName();
|
||||||
}
|
}
|
||||||
@@ -602,7 +624,6 @@ public class TypeDescription {
|
|||||||
if(superClass != null && superClass != Object.class)
|
if(superClass != null && superClass != Object.class)
|
||||||
_superType = getTypeDescription(superClass);
|
_superType = getTypeDescription(superClass);
|
||||||
|
|
||||||
_initFields();
|
|
||||||
_initMemberTypeInfos();
|
_initMemberTypeInfos();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -615,7 +636,6 @@ public class TypeDescription {
|
|||||||
if(superClass != null && superClass != Object.class)
|
if(superClass != null && superClass != Object.class)
|
||||||
_superType = getTypeDescription(superClass);
|
_superType = getTypeDescription(superClass);
|
||||||
|
|
||||||
_initFields();
|
|
||||||
_initMemberTypeInfos();
|
_initMemberTypeInfos();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -642,8 +662,8 @@ public class TypeDescription {
|
|||||||
_typeClass = TypeClass.SEQUENCE;
|
_typeClass = TypeClass.SEQUENCE;
|
||||||
|
|
||||||
_componentType = getTypeDescription(typeName.substring(2));
|
_componentType = getTypeDescription(typeName.substring(2));
|
||||||
_class = Class.forName(_componentType._arrayTypeName);
|
_class = Class.forName(_componentType.getArrayTypeName());
|
||||||
_arrayTypeName = "[" + _componentType._arrayTypeName;
|
_arrayTypeName = "[" + _componentType.getArrayTypeName();
|
||||||
|
|
||||||
__cyclicTypes.remove(typeName);
|
__cyclicTypes.remove(typeName);
|
||||||
}
|
}
|
||||||
@@ -653,21 +673,6 @@ public class TypeDescription {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _initFields() {
|
|
||||||
Field fields[] = _class.getFields();
|
|
||||||
|
|
||||||
int size = 0;
|
|
||||||
for(int i = 0; i < fields.length; ++ i)
|
|
||||||
if((fields[i].getModifiers() & (Modifier.STATIC | Modifier.TRANSIENT)) == 0) // neither static nor transient ?
|
|
||||||
++ size;
|
|
||||||
|
|
||||||
_fields = new Field[size];
|
|
||||||
size = 0;
|
|
||||||
for(int i = 0; i < fields.length; ++ i)
|
|
||||||
if((fields[i].getModifiers() & (Modifier.STATIC | Modifier.TRANSIENT)) == 0) // neither static nor transient ?
|
|
||||||
_fields[size ++] = fields[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
private void _initMethodTypeInfos() {
|
private void _initMethodTypeInfos() {
|
||||||
if(_methodDescriptionsByName != null)
|
if(_methodDescriptionsByName != null)
|
||||||
return;
|
return;
|
||||||
@@ -752,96 +757,94 @@ public class TypeDescription {
|
|||||||
|
|
||||||
private void _initMemberTypeInfos() {
|
private void _initMemberTypeInfos() {
|
||||||
TypeInfo typeInfos[] = __getTypeInfos(_class);
|
TypeInfo typeInfos[] = __getTypeInfos(_class);
|
||||||
Field fields[] = getFields();
|
Field fields[] = _class.getFields();
|
||||||
MemberTypeInfo memberTypeInfos[] = new MemberTypeInfo[fields.length];
|
int index = 0;
|
||||||
|
IFieldDescription iFieldDescriptions[] = new IFieldDescription[fields.length];
|
||||||
|
|
||||||
|
_iFieldDescriptionsByName = new Hashtable();
|
||||||
|
|
||||||
_memberTypeInfosByName = new Hashtable();
|
|
||||||
|
|
||||||
for(int i = 0; i < fields.length; ++ i) {
|
for(int i = 0; i < fields.length; ++ i) {
|
||||||
MemberTypeInfo memberTypeInfo = null;
|
if((fields[i].getModifiers() & (Modifier.STATIC | Modifier.TRANSIENT)) == 0) { // neither static nor transient ?
|
||||||
|
|
||||||
if(_superType != null)
|
IFieldDescription iFieldDescription = null;
|
||||||
memberTypeInfo = _superType.getMemberTypeInfo(fields[i].getName());
|
|
||||||
|
|
||||||
if(memberTypeInfo == null)
|
if(_superType != null)
|
||||||
memberTypeInfo = __findMemberTypeInfo(typeInfos, fields[i].getName());
|
iFieldDescription = _superType.getFieldDescription(fields[i].getName());
|
||||||
|
|
||||||
if(memberTypeInfo == null)
|
if(iFieldDescription == null) {
|
||||||
memberTypeInfo = new MemberTypeInfo(fields[i].getName(), 0);
|
MemberTypeInfo memberTypeInfo = __findMemberTypeInfo(typeInfos, fields[i].getName());
|
||||||
|
|
||||||
_memberTypeInfosByName.put(memberTypeInfo.getName(), memberTypeInfo);
|
if(memberTypeInfo == null)
|
||||||
|
memberTypeInfo = new MemberTypeInfo(fields[i].getName(), 0);
|
||||||
|
|
||||||
|
|
||||||
|
iFieldDescription = new FieldDescription(memberTypeInfo, fields[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
_iFieldDescriptionsByName.put(iFieldDescription.getName(), iFieldDescription);
|
||||||
|
iFieldDescriptions[index ++] = iFieldDescription;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_iFieldDescriptions = new IFieldDescription[index];
|
||||||
|
System.arraycopy(iFieldDescriptions, 0, _iFieldDescriptions, 0, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypeDescription getSuperType() {
|
public ITypeDescription getSuperType() {
|
||||||
return _superType;
|
return _superType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MethodDescription []getMethodDescriptions() {
|
public IMethodDescription []getMethodDescriptions() {
|
||||||
_initMethodTypeInfos();
|
_initMethodTypeInfos();
|
||||||
|
|
||||||
MethodDescription methodDescriptions[] = null;
|
IMethodDescription iMethodDescriptions[] = null;
|
||||||
|
|
||||||
if(_methodDescriptionsByIndex != null) {
|
if(_methodDescriptionsByIndex != null) {
|
||||||
methodDescriptions = new MethodDescription[_methodDescriptionsByIndex.length];
|
iMethodDescriptions = new IMethodDescription[_methodDescriptionsByIndex.length];
|
||||||
|
|
||||||
System.arraycopy(_methodDescriptionsByIndex, 0, methodDescriptions, 0, _methodDescriptionsByIndex.length);
|
System.arraycopy(_methodDescriptionsByIndex, 0, iMethodDescriptions, 0, _methodDescriptionsByIndex.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
return methodDescriptions;
|
return iMethodDescriptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MethodDescription getMethodDescription(int methodId) {
|
public IMethodDescription getMethodDescription(int methodId) {
|
||||||
_initMethodTypeInfos();
|
_initMethodTypeInfos();
|
||||||
|
|
||||||
MethodDescription methodDescription = null;
|
IMethodDescription iMethodDescription = null;
|
||||||
|
|
||||||
int relMethodId = methodId - (_offset - _methodDescriptionsByIndex.length);
|
int relMethodId = methodId - (_offset - _methodDescriptionsByIndex.length);
|
||||||
|
|
||||||
if(relMethodId >= 0 && relMethodId < _methodDescriptionsByIndex.length)
|
if(relMethodId >= 0 && relMethodId < _methodDescriptionsByIndex.length)
|
||||||
methodDescription = _methodDescriptionsByIndex[relMethodId];
|
iMethodDescription = _methodDescriptionsByIndex[relMethodId];
|
||||||
else if(_superType != null)
|
|
||||||
methodDescription = _superType.getMethodDescription(methodId);
|
|
||||||
|
|
||||||
return methodDescription;
|
else if(_superType != null)
|
||||||
|
iMethodDescription = _superType.getMethodDescription(methodId);
|
||||||
|
|
||||||
|
return iMethodDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MethodDescription getMethodDescription(String name) {
|
public IMethodDescription getMethodDescription(String name) {
|
||||||
_initMethodTypeInfos();
|
_initMethodTypeInfos();
|
||||||
|
|
||||||
MethodDescription methodDescription = (MethodDescription)_methodDescriptionsByName.get(name);
|
IMethodDescription iMethodDescription = (MethodDescription)_methodDescriptionsByName.get(name);
|
||||||
if(methodDescription == null && _superType != null)
|
if(iMethodDescription == null && _superType != null)
|
||||||
methodDescription = _superType.getMethodDescription(name);
|
iMethodDescription = _superType.getMethodDescription(name);
|
||||||
|
|
||||||
return methodDescription;
|
return iMethodDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MemberTypeInfo []getMemberTypeInfos() {
|
public IFieldDescription []getFieldDescriptions() {
|
||||||
MemberTypeInfo memberTypeInfos[] = null;
|
return _iFieldDescriptions;
|
||||||
|
|
||||||
if(_memberTypeInfosByName != null) {
|
|
||||||
memberTypeInfos = new MemberTypeInfo[_memberTypeInfosByName.size()];
|
|
||||||
|
|
||||||
Enumeration elements = _memberTypeInfosByName.elements();
|
|
||||||
int i = 0;
|
|
||||||
while(elements.hasMoreElements()) {
|
|
||||||
memberTypeInfos[i ++] = (MemberTypeInfo)elements.nextElement();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return memberTypeInfos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MemberTypeInfo getMemberTypeInfo(String name) {
|
public IFieldDescription getFieldDescription(String name) {
|
||||||
MemberTypeInfo memberTypeInfo = (MemberTypeInfo)_memberTypeInfosByName.get(name);
|
IFieldDescription iFieldDescription = (IFieldDescription)_iFieldDescriptionsByName.get(name);
|
||||||
if(memberTypeInfo == null && _superType != null)
|
if(iFieldDescription == null && _superType != null)
|
||||||
memberTypeInfo = _superType.getMemberTypeInfo(name);
|
iFieldDescription = _superType.getFieldDescription(name);
|
||||||
|
|
||||||
return memberTypeInfo;
|
return iFieldDescription;
|
||||||
}
|
|
||||||
|
|
||||||
public Field []getFields() {
|
|
||||||
return _fields;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -859,14 +862,14 @@ public class TypeDescription {
|
|||||||
* <p>
|
* <p>
|
||||||
* @return the <code>TypeDescription</code>
|
* @return the <code>TypeDescription</code>
|
||||||
*/
|
*/
|
||||||
public TypeDescription getComponentType() {
|
public ITypeDescription getComponentType() {
|
||||||
TypeDescription componentTypeDescription = null;
|
ITypeDescription iTypeDescription = null;
|
||||||
|
|
||||||
Class componentClass = getZClass().getComponentType();
|
Class componentClass = getZClass().getComponentType();
|
||||||
if(componentClass != null)
|
if(componentClass != null)
|
||||||
componentTypeDescription = getTypeDescription(componentClass);
|
iTypeDescription = getTypeDescription(componentClass);
|
||||||
|
|
||||||
return componentTypeDescription;
|
return iTypeDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: Any.java,v $
|
* $RCSfile: Any.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.2 $
|
* $Revision: 1.3 $
|
||||||
*
|
*
|
||||||
* last change: $Author: kr $ $Date: 2001-01-16 17:49:37 $
|
* last change: $Author: kr $ $Date: 2001-05-08 09:34:18 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -67,7 +67,7 @@ package com.sun.star.uno;
|
|||||||
* The UNO IDL type any is mapped to java type <code>java.lang.Object</code>.
|
* The UNO IDL type any is mapped to java type <code>java.lang.Object</code>.
|
||||||
* In special cases it is necessary to have an explicit any.
|
* In special cases it is necessary to have an explicit any.
|
||||||
* <p>
|
* <p>
|
||||||
* @version $Revision: 1.2 $ $ $Date: 2001-01-16 17:49:37 $
|
* @version $Revision: 1.3 $ $ $Date: 2001-05-08 09:34:18 $
|
||||||
* @author Kay Ramme
|
* @author Kay Ramme
|
||||||
* @since UDK1.0
|
* @since UDK1.0
|
||||||
*/
|
*/
|
||||||
@@ -95,13 +95,7 @@ public class Any {
|
|||||||
* @deprecated as of UDK 2.0
|
* @deprecated as of UDK 2.0
|
||||||
*/
|
*/
|
||||||
public Any(Class zInterface, Object object) {
|
public Any(Class zInterface, Object object) {
|
||||||
try {
|
_type = new Type(zInterface);
|
||||||
_type = new Type(zInterface);
|
|
||||||
}
|
|
||||||
catch(Throwable throwable) { // can not happen!
|
|
||||||
System.err.println(getClass().getName() + ".<init> - unexpected exception:" + throwable);
|
|
||||||
}
|
|
||||||
|
|
||||||
_object = object;
|
_object = object;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,26 +104,6 @@ public class Any {
|
|||||||
_object = object;
|
_object = object;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the type of the any.
|
|
||||||
* <p>
|
|
||||||
* @deprecated as of UDK 2.0
|
|
||||||
* <p>
|
|
||||||
* @return the type of the any.
|
|
||||||
*/
|
|
||||||
public Class getInterface() {
|
|
||||||
Class zClass = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
zClass = _type.getDescription();
|
|
||||||
}
|
|
||||||
catch(ClassNotFoundException classNotFoundException) { // can not happen
|
|
||||||
System.err.println(getClass().getName() + ".getInterface - unexpected exception:" + classNotFoundException);
|
|
||||||
}
|
|
||||||
|
|
||||||
return zClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the type of the any.
|
* Gets the type of the any.
|
||||||
* <p>
|
* <p>
|
||||||
|
89
ridljar/com/sun/star/uno/IFieldDescription.java
Normal file
89
ridljar/com/sun/star/uno/IFieldDescription.java
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
/*************************************************************************
|
||||||
|
*
|
||||||
|
* $RCSfile: IFieldDescription.java,v $
|
||||||
|
*
|
||||||
|
* $Revision: 1.1 $
|
||||||
|
*
|
||||||
|
* last change: $Author: kr $ $Date: 2001-05-08 09:34:18 $
|
||||||
|
*
|
||||||
|
* The Contents of this file are made available subject to the terms of
|
||||||
|
* either of the following licenses
|
||||||
|
*
|
||||||
|
* - GNU Lesser General Public License Version 2.1
|
||||||
|
* - Sun Industry Standards Source License Version 1.1
|
||||||
|
*
|
||||||
|
* Sun Microsystems Inc., October, 2000
|
||||||
|
*
|
||||||
|
* GNU Lesser General Public License Version 2.1
|
||||||
|
* =============================================
|
||||||
|
* Copyright 2000 by Sun Microsystems, Inc.
|
||||||
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License version 2.1, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||||
|
* MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Sun Industry Standards Source License Version 1.1
|
||||||
|
* =================================================
|
||||||
|
* The contents of this file are subject to the Sun Industry Standards
|
||||||
|
* Source License Version 1.1 (the "License"); You may not use this file
|
||||||
|
* except in compliance with the License. You may obtain a copy of the
|
||||||
|
* License at http://www.openoffice.org/license.html.
|
||||||
|
*
|
||||||
|
* Software provided under this License is provided on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||||
|
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||||
|
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||||
|
* See the License for the specific provisions governing your rights and
|
||||||
|
* obligations concerning the Software.
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||||
|
*
|
||||||
|
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||||
|
*
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s): _______________________________________
|
||||||
|
*
|
||||||
|
*
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
package com.sun.star.uno;
|
||||||
|
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The <code>IFieldDescription</code> describes non
|
||||||
|
* method members.
|
||||||
|
* <p>
|
||||||
|
* @version $Revision: 1.1 $ $ $Date: 2001-05-08 09:34:18 $
|
||||||
|
* @author Kay Ramme
|
||||||
|
* @since UDK3.0
|
||||||
|
*/
|
||||||
|
public interface IFieldDescription extends IMemberDescription {
|
||||||
|
/**
|
||||||
|
* Gives the name of this member.
|
||||||
|
* <p>
|
||||||
|
* @return the name
|
||||||
|
*/
|
||||||
|
ITypeDescription getTypeDescription();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gives native java field of this member.
|
||||||
|
* <p>
|
||||||
|
* @return the java field
|
||||||
|
*/
|
||||||
|
Field getField();
|
||||||
|
}
|
100
ridljar/com/sun/star/uno/IMemberDescription.java
Normal file
100
ridljar/com/sun/star/uno/IMemberDescription.java
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
/*************************************************************************
|
||||||
|
*
|
||||||
|
* $RCSfile: IMemberDescription.java,v $
|
||||||
|
*
|
||||||
|
* $Revision: 1.1 $
|
||||||
|
*
|
||||||
|
* last change: $Author: kr $ $Date: 2001-05-08 09:34:18 $
|
||||||
|
*
|
||||||
|
* The Contents of this file are made available subject to the terms of
|
||||||
|
* either of the following licenses
|
||||||
|
*
|
||||||
|
* - GNU Lesser General Public License Version 2.1
|
||||||
|
* - Sun Industry Standards Source License Version 1.1
|
||||||
|
*
|
||||||
|
* Sun Microsystems Inc., October, 2000
|
||||||
|
*
|
||||||
|
* GNU Lesser General Public License Version 2.1
|
||||||
|
* =============================================
|
||||||
|
* Copyright 2000 by Sun Microsystems, Inc.
|
||||||
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License version 2.1, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||||
|
* MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Sun Industry Standards Source License Version 1.1
|
||||||
|
* =================================================
|
||||||
|
* The contents of this file are subject to the Sun Industry Standards
|
||||||
|
* Source License Version 1.1 (the "License"); You may not use this file
|
||||||
|
* except in compliance with the License. You may obtain a copy of the
|
||||||
|
* License at http://www.openoffice.org/license.html.
|
||||||
|
*
|
||||||
|
* Software provided under this License is provided on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||||
|
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||||
|
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||||
|
* See the License for the specific provisions governing your rights and
|
||||||
|
* obligations concerning the Software.
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||||
|
*
|
||||||
|
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||||
|
*
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s): _______________________________________
|
||||||
|
*
|
||||||
|
*
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
package com.sun.star.uno;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The <code>IMemberDescription</code> is the base interface
|
||||||
|
* for members of UNO types <code>ITypeDescriptions</code>.
|
||||||
|
* <p>
|
||||||
|
* @version $Revision: 1.1 $ $ $Date: 2001-05-08 09:34:18 $
|
||||||
|
* @author Kay Ramme
|
||||||
|
* @since UDK3.0
|
||||||
|
*/
|
||||||
|
public interface IMemberDescription {
|
||||||
|
/**
|
||||||
|
* Gives the name of this member.
|
||||||
|
* <p>
|
||||||
|
* @return the name
|
||||||
|
*/
|
||||||
|
String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if this member is unsigned.
|
||||||
|
* <p>
|
||||||
|
* @return the unsigned state
|
||||||
|
*/
|
||||||
|
boolean isUnsigned();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if this member is an any.
|
||||||
|
* <p>
|
||||||
|
* @return the any state
|
||||||
|
*/
|
||||||
|
boolean isAny();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if this member is an interface.
|
||||||
|
* <p>
|
||||||
|
* @return the interface state
|
||||||
|
*/
|
||||||
|
boolean isInterface();
|
||||||
|
}
|
130
ridljar/com/sun/star/uno/IMethodDescription.java
Normal file
130
ridljar/com/sun/star/uno/IMethodDescription.java
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
/*************************************************************************
|
||||||
|
*
|
||||||
|
* $RCSfile: IMethodDescription.java,v $
|
||||||
|
*
|
||||||
|
* $Revision: 1.1 $
|
||||||
|
*
|
||||||
|
* last change: $Author: kr $ $Date: 2001-05-08 09:34:18 $
|
||||||
|
*
|
||||||
|
* The Contents of this file are made available subject to the terms of
|
||||||
|
* either of the following licenses
|
||||||
|
*
|
||||||
|
* - GNU Lesser General Public License Version 2.1
|
||||||
|
* - Sun Industry Standards Source License Version 1.1
|
||||||
|
*
|
||||||
|
* Sun Microsystems Inc., October, 2000
|
||||||
|
*
|
||||||
|
* GNU Lesser General Public License Version 2.1
|
||||||
|
* =============================================
|
||||||
|
* Copyright 2000 by Sun Microsystems, Inc.
|
||||||
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License version 2.1, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||||
|
* MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Sun Industry Standards Source License Version 1.1
|
||||||
|
* =================================================
|
||||||
|
* The contents of this file are subject to the Sun Industry Standards
|
||||||
|
* Source License Version 1.1 (the "License"); You may not use this file
|
||||||
|
* except in compliance with the License. You may obtain a copy of the
|
||||||
|
* License at http://www.openoffice.org/license.html.
|
||||||
|
*
|
||||||
|
* Software provided under this License is provided on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||||
|
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||||
|
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||||
|
* See the License for the specific provisions governing your rights and
|
||||||
|
* obligations concerning the Software.
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||||
|
*
|
||||||
|
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||||
|
*
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s): _______________________________________
|
||||||
|
*
|
||||||
|
*
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
package com.sun.star.uno;
|
||||||
|
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The <code>IMethodDescription</code> allows to examine a method
|
||||||
|
* in detail. It gives a view to java methods from a UNO point.
|
||||||
|
* <p>
|
||||||
|
* @version $Revision: 1.1 $ $ $Date: 2001-05-08 09:34:18 $
|
||||||
|
* @author Kay Ramme
|
||||||
|
* @since UDK3.0
|
||||||
|
*/
|
||||||
|
public interface IMethodDescription extends IMemberDescription {
|
||||||
|
/**
|
||||||
|
* Indicates if this method is <code>oneWay</code>,
|
||||||
|
* respectivly if this method may become executed asynchronously.
|
||||||
|
* <p>
|
||||||
|
* @return true means may execute asynchronously .
|
||||||
|
*/
|
||||||
|
boolean isOneway();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gives the relative index of this method in the declaring
|
||||||
|
* interface.
|
||||||
|
* <p>
|
||||||
|
* @return the realtive index of this method
|
||||||
|
*/
|
||||||
|
int getIndex();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if this method is const.
|
||||||
|
* <p>
|
||||||
|
* @return true means it is const.
|
||||||
|
*/
|
||||||
|
boolean isConst();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gives any array of <code>ITypeDescription> of
|
||||||
|
* the [in] parameters.
|
||||||
|
* <p>
|
||||||
|
* @return the in parameters
|
||||||
|
*/
|
||||||
|
ITypeDescription[] getInSignature();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gives any array of <code>ITypeDescription> of
|
||||||
|
* the [out] parameters.
|
||||||
|
* <p>
|
||||||
|
* @return the out parameters
|
||||||
|
*/
|
||||||
|
ITypeDescription[] getOutSignature();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gives the <code>ITypeDescription</code> of
|
||||||
|
* the return type.
|
||||||
|
* <p>
|
||||||
|
* @return the return type <code>ITypeDescription</code>
|
||||||
|
*/
|
||||||
|
ITypeDescription getReturnSignature();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gives native java method of this method.
|
||||||
|
* <p>
|
||||||
|
* @return the java methodd
|
||||||
|
*/
|
||||||
|
Method getMethod();
|
||||||
|
}
|
161
ridljar/com/sun/star/uno/ITypeDescription.java
Normal file
161
ridljar/com/sun/star/uno/ITypeDescription.java
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
/*************************************************************************
|
||||||
|
*
|
||||||
|
* $RCSfile: ITypeDescription.java,v $
|
||||||
|
*
|
||||||
|
* $Revision: 1.1 $
|
||||||
|
*
|
||||||
|
* last change: $Author: kr $ $Date: 2001-05-08 09:34:18 $
|
||||||
|
*
|
||||||
|
* The Contents of this file are made available subject to the terms of
|
||||||
|
* either of the following licenses
|
||||||
|
*
|
||||||
|
* - GNU Lesser General Public License Version 2.1
|
||||||
|
* - Sun Industry Standards Source License Version 1.1
|
||||||
|
*
|
||||||
|
* Sun Microsystems Inc., October, 2000
|
||||||
|
*
|
||||||
|
* GNU Lesser General Public License Version 2.1
|
||||||
|
* =============================================
|
||||||
|
* Copyright 2000 by Sun Microsystems, Inc.
|
||||||
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License version 2.1, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||||
|
* MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Sun Industry Standards Source License Version 1.1
|
||||||
|
* =================================================
|
||||||
|
* The contents of this file are subject to the Sun Industry Standards
|
||||||
|
* Source License Version 1.1 (the "License"); You may not use this file
|
||||||
|
* except in compliance with the License. You may obtain a copy of the
|
||||||
|
* License at http://www.openoffice.org/license.html.
|
||||||
|
*
|
||||||
|
* Software provided under this License is provided on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||||
|
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||||
|
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||||
|
* See the License for the specific provisions governing your rights and
|
||||||
|
* obligations concerning the Software.
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||||
|
*
|
||||||
|
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||||
|
*
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s): _______________________________________
|
||||||
|
*
|
||||||
|
*
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
package com.sun.star.uno;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The <code>ITypeDescription</code> allows to examine a type
|
||||||
|
* in detail (e.g. it is used for marshaling/unmarshaling).
|
||||||
|
* <p>
|
||||||
|
* @version $Revision: 1.1 $ $ $Date: 2001-05-08 09:34:18 $
|
||||||
|
* @author Kay Ramme
|
||||||
|
* @since UDK3.0
|
||||||
|
*/
|
||||||
|
public interface ITypeDescription {
|
||||||
|
/**
|
||||||
|
* Gets the <code>ITypeDescription</code> of the
|
||||||
|
* super, if it exists.
|
||||||
|
* <p>
|
||||||
|
* @return the <code>ITypeDescription</code>.
|
||||||
|
*/
|
||||||
|
ITypeDescription getSuperType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the <code>IMethodDescription</code> for every
|
||||||
|
* method, if this type is an interface. Otherwise
|
||||||
|
* returns <code>null</code>.
|
||||||
|
* <p>
|
||||||
|
* @return the <code>IMethodDescription[]</code>.
|
||||||
|
*/
|
||||||
|
IMethodDescription []getMethodDescriptions();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the <code>IMethodDescription</code> for the
|
||||||
|
* method with index methodId, if it exists, otherwise
|
||||||
|
* returns <code>null</code>.
|
||||||
|
* <p>
|
||||||
|
* @return the <code>IMethodDescription</code>.
|
||||||
|
*/
|
||||||
|
IMethodDescription getMethodDescription(int methodId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the <code>IMethodDescription</code> for the
|
||||||
|
* method with the name <code>name</code>, if it exists,
|
||||||
|
* otherwise returns <code>null</code>.
|
||||||
|
* <p>
|
||||||
|
* @return the <code>IMethodDescription</code>.
|
||||||
|
*/
|
||||||
|
IMethodDescription getMethodDescription(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the <code>IFieldDescription</code> for every
|
||||||
|
* field, if this type is an interface. Otherwise
|
||||||
|
* returns <code>null</code>.
|
||||||
|
* <p>
|
||||||
|
* @return the <code>IFieldDescription[]</code>.
|
||||||
|
*/
|
||||||
|
IFieldDescription []getFieldDescriptions();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the <code>IFieldDescription</code> for the
|
||||||
|
* field with the name <code>name</code>, if it exists,
|
||||||
|
* otherwise returns <code>null</code>.
|
||||||
|
* <p>
|
||||||
|
* @return the <code>IFieldDescription</code>.
|
||||||
|
*/
|
||||||
|
IFieldDescription getFieldDescription(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the IDL <code>TypeClass</code> of the type.
|
||||||
|
* <p>
|
||||||
|
* @return the <code>TypeClass</code>.
|
||||||
|
*/
|
||||||
|
TypeClass getTypeClass();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the component <code>ITypeDescription</code> if
|
||||||
|
* this is an array type, otherwise returns <code>null</code>.
|
||||||
|
* <p>
|
||||||
|
* @return the <code>ITypeDescription</code>
|
||||||
|
*/
|
||||||
|
ITypeDescription getComponentType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the type name.
|
||||||
|
* <p>
|
||||||
|
* @return the type name.
|
||||||
|
*/
|
||||||
|
String getTypeName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the array type name.
|
||||||
|
* <p>
|
||||||
|
* @return the array type name.
|
||||||
|
*/
|
||||||
|
String getArrayTypeName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the corresponding java class for the type.
|
||||||
|
* <p>
|
||||||
|
* @return the corresponding java class.
|
||||||
|
*/
|
||||||
|
Class getZClass();
|
||||||
|
}
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: Type.java,v $
|
* $RCSfile: Type.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.4 $
|
* $Revision: 1.5 $
|
||||||
*
|
*
|
||||||
* last change: $Author: kr $ $Date: 2001-02-19 10:07:03 $
|
* last change: $Author: kr $ $Date: 2001-05-08 09:34:18 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -62,9 +62,8 @@
|
|||||||
package com.sun.star.uno;
|
package com.sun.star.uno;
|
||||||
|
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.util.Hashtable;
|
||||||
//import java.lang.reflect.InstantiationException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Type class represents the IDL builtin type <code>type</code>.
|
* The Type class represents the IDL builtin type <code>type</code>.
|
||||||
@@ -72,13 +71,9 @@ import java.lang.reflect.InvocationTargetException;
|
|||||||
* The IDL type is not directly mapped to <code>java.lang.Class</code>,
|
* The IDL type is not directly mapped to <code>java.lang.Class</code>,
|
||||||
* because it can be necessary to describe a type which is unknown
|
* because it can be necessary to describe a type which is unknown
|
||||||
* to the java runtime system, e.g. for delaying the need of a class,
|
* to the java runtime system, e.g. for delaying the need of a class,
|
||||||
* so that it is possible to generate it one the fly.
|
* so that it is possible to generate it on the fly.
|
||||||
* <p>
|
* <p>
|
||||||
* The current implementations holds various <code>static</code> helper
|
* @version $Revision: 1.5 $ $ $Date: 2001-05-08 09:34:18 $
|
||||||
* methods, which may be changed or moved in the furture, so please
|
|
||||||
* do not use these methods.
|
|
||||||
* <p>
|
|
||||||
* @version $Revision: 1.4 $ $ $Date: 2001-02-19 10:07:03 $
|
|
||||||
* @author Markus Meyer
|
* @author Markus Meyer
|
||||||
* @author Kay Ramme
|
* @author Kay Ramme
|
||||||
* @since UDK1.0
|
* @since UDK1.0
|
||||||
@@ -87,326 +82,237 @@ public class Type {
|
|||||||
/**
|
/**
|
||||||
* When set to true, enables various debugging output.
|
* When set to true, enables various debugging output.
|
||||||
*/
|
*/
|
||||||
public static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
|
|
||||||
static private Method __getFromClass;
|
static private final String[] __typeClassToTypeName = new String[]{
|
||||||
static private Method __getFromName;
|
"void",
|
||||||
static private Method __getFromTypeClass;
|
"char",
|
||||||
|
"boolean",
|
||||||
|
"byte",
|
||||||
|
"short",
|
||||||
|
"unsigned short",
|
||||||
|
"long",
|
||||||
|
"unsigned long",
|
||||||
|
"hyper",
|
||||||
|
"unsigned hyper",
|
||||||
|
"float",
|
||||||
|
"double",
|
||||||
|
"string",
|
||||||
|
"type",
|
||||||
|
"any"
|
||||||
|
};
|
||||||
|
|
||||||
/* these variables will be removed with UDK 3.0 */
|
static private final Hashtable __javaClassToTypeName = new Hashtable();
|
||||||
static private Method __isTypeClassSimple;
|
|
||||||
static private Method __getTypeClass;
|
static private final Hashtable __typeNameToTypeClass = new Hashtable();
|
||||||
static private Method __getTypeName;
|
|
||||||
static private Method __getArrayTypeName;
|
|
||||||
static private Method __getZClass;
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
if(DEBUG) System.err.println("##### com.sun.star.uno.Type.<sinit>");
|
for(int i = 0; i < __typeClassToTypeName.length; ++ i)
|
||||||
|
__typeNameToTypeClass.put(__typeClassToTypeName[i], TypeClass.fromInt(i));
|
||||||
|
|
||||||
Throwable throwable = null;
|
__javaClassToTypeName.put(Void.class, "void");
|
||||||
|
__javaClassToTypeName.put(void.class, "void");
|
||||||
try {
|
__javaClassToTypeName.put(Character.class, "char");
|
||||||
Class typeDesc_Class = Class.forName("com.sun.star.lib.uno.typedesc.TypeDescription");
|
__javaClassToTypeName.put(char.class, "char");
|
||||||
|
__javaClassToTypeName.put(Boolean.class, "boolean");
|
||||||
__getFromName = typeDesc_Class.getMethod("getTypeDescription", new Class[]{String.class});
|
__javaClassToTypeName.put(boolean.class, "boolean");
|
||||||
__getFromClass = typeDesc_Class.getMethod("getTypeDescription", new Class[]{Class.class});
|
__javaClassToTypeName.put(Byte.class, "byte");
|
||||||
__getFromTypeClass = typeDesc_Class.getMethod("getTypeDescription", new Class[]{TypeClass.class});
|
__javaClassToTypeName.put(byte.class, "byte");
|
||||||
|
__javaClassToTypeName.put(Short.class, "short");
|
||||||
__isTypeClassSimple = typeDesc_Class.getMethod("isTypeClassSimple", new Class[]{TypeClass.class});
|
__javaClassToTypeName.put(short.class, "short");
|
||||||
|
__javaClassToTypeName.put(Integer.class, "long");
|
||||||
__getTypeClass = typeDesc_Class.getMethod("getTypeClass", new Class[]{});
|
__javaClassToTypeName.put(int.class, "long");
|
||||||
__getTypeName = typeDesc_Class.getMethod("getTypeName", new Class[]{});
|
__javaClassToTypeName.put(Long.class, "hyper");
|
||||||
__getArrayTypeName = typeDesc_Class.getMethod("getArrayTypeName", new Class[]{});
|
__javaClassToTypeName.put(long.class, "hyper");
|
||||||
__getZClass = typeDesc_Class.getMethod("getZClass", new Class[]{});
|
__javaClassToTypeName.put(Float.class, "float");
|
||||||
}
|
__javaClassToTypeName.put(float.class, "float");
|
||||||
catch(NoSuchMethodException noSuchMethodException) {
|
__javaClassToTypeName.put(Double.class, "double");
|
||||||
throwable = noSuchMethodException;
|
__javaClassToTypeName.put(double.class, "double");
|
||||||
}
|
__javaClassToTypeName.put(String.class, "string");
|
||||||
catch(ClassNotFoundException classNotFoundException) {
|
__javaClassToTypeName.put(Type.class, "type");
|
||||||
throwable = classNotFoundException;
|
__javaClassToTypeName.put(Any.class, "any");
|
||||||
}
|
__javaClassToTypeName.put(Object.class, "any");
|
||||||
|
|
||||||
if(throwable != null) {
|
|
||||||
String message = "com.sun.star.uno.Type.<sinit> - exception:" + throwable;
|
|
||||||
throwable.printStackTrace();
|
|
||||||
System.err.println(message);
|
|
||||||
throw new java.lang.RuntimeException(message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static private boolean __isTypeClassPrimitive(TypeClass typeClass) {
|
||||||
|
return typeClass.getValue() < 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected String _typeName;
|
||||||
|
protected Class _class;
|
||||||
|
protected TypeClass _typeClass;
|
||||||
|
|
||||||
|
protected ITypeDescription _iTypeDescription;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if the given <code>TypeClass</code> is simple.
|
* Constructs a new <code>Type</code> which defaults
|
||||||
|
* to <code>void</code>
|
||||||
* <p>
|
* <p>
|
||||||
* @deprecated as of UDK 2.0 (moved to com.sun.star.lib.uno.typedesc.TypeDescription)
|
* @since UDK3.0
|
||||||
* <p>
|
|
||||||
* @return <code>true</code> means simple
|
|
||||||
* @param typeClass the IDL typeClass
|
|
||||||
*/
|
*/
|
||||||
static public boolean isTypeClassSimple(TypeClass typeClass) {
|
public Type() {
|
||||||
boolean isSimple = false;
|
this(void.class);
|
||||||
|
|
||||||
try {
|
|
||||||
isSimple = ((Boolean)__isTypeClassSimple.invoke(null, new Object[]{typeClass})).booleanValue();
|
|
||||||
}
|
|
||||||
catch(IllegalAccessException illegalAccessException) {
|
|
||||||
}
|
|
||||||
catch(InvocationTargetException invocationTargetException) {
|
|
||||||
}
|
|
||||||
|
|
||||||
return isSimple;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new <code>Type</code> with
|
||||||
|
* the given <code>class</code>.
|
||||||
|
* <p>
|
||||||
|
* @since UDK3.0
|
||||||
|
* @param zClass the class of this type
|
||||||
|
*/
|
||||||
|
public Type(Class zClass) {
|
||||||
|
_class = zClass;
|
||||||
|
|
||||||
protected Object _typeDescription;
|
_typeName = (String)__javaClassToTypeName.get(zClass);
|
||||||
|
if(_typeName != null)
|
||||||
|
_typeClass = (TypeClass)__typeNameToTypeClass.get(_typeName);
|
||||||
|
|
||||||
protected void init(Class zClass) {
|
else {
|
||||||
Throwable throwable = null;
|
if(Enum.class.isAssignableFrom(zClass)) {
|
||||||
|
_typeClass = TypeClass.ENUM;
|
||||||
try {
|
_typeName = zClass.getName();
|
||||||
_typeDescription = __getFromClass.invoke(null, new Object[]{zClass});
|
}
|
||||||
|
else if(Union.class.isAssignableFrom(zClass)) {
|
||||||
|
_typeClass = TypeClass.UNION;
|
||||||
|
_typeName = zClass.getName();
|
||||||
|
}
|
||||||
|
else if(zClass.isInterface()) {
|
||||||
|
_typeClass = TypeClass.INTERFACE;
|
||||||
|
_typeName = zClass.getName();
|
||||||
|
}
|
||||||
|
else if(zClass.isArray()) {
|
||||||
|
_typeClass = TypeClass.SEQUENCE;
|
||||||
|
_typeName = "[]" + (new Type(_class.getComponentType()).getTypeName());
|
||||||
|
}
|
||||||
|
else if(Throwable.class.isAssignableFrom(zClass)) {
|
||||||
|
_typeClass = TypeClass.EXCEPTION;
|
||||||
|
_typeName = zClass.getName();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_typeClass = TypeClass.UNKNOWN;
|
||||||
|
_typeName = zClass.getName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(InvocationTargetException invocationTargetException) {
|
|
||||||
throwable = invocationTargetException.getTargetException();
|
|
||||||
}
|
|
||||||
catch(IllegalAccessException illegalAccessException) {
|
|
||||||
throwable = illegalAccessException;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(throwable != null)
|
|
||||||
throw new java.lang.RuntimeException(getClass().getName() + ".<init>(Class) - fatal - couldn't create typedescription - " + throwable + " " + zClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void init(TypeClass typeClass) {
|
|
||||||
Throwable throwable = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
_typeDescription = __getFromTypeClass.invoke(null, new Object[]{typeClass});
|
|
||||||
}
|
|
||||||
catch(InvocationTargetException invocationTargetException) {
|
|
||||||
throwable = invocationTargetException.getTargetException();
|
|
||||||
}
|
|
||||||
catch(IllegalAccessException illegalAccessException) {
|
|
||||||
throwable = illegalAccessException;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(throwable != null)
|
|
||||||
throw new java.lang.RuntimeException(getClass().getName() + ".<init>(TypeClass) - fatal - couldn't create typedescription - " + throwable + " " + typeClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void init(String typeName) throws ClassNotFoundException {
|
|
||||||
Throwable throwable = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
_typeDescription = __getFromName.invoke(null, new Object[]{typeName});
|
|
||||||
}
|
|
||||||
catch(InvocationTargetException invocationTargetException) {
|
|
||||||
throwable = invocationTargetException.getTargetException();
|
|
||||||
}
|
|
||||||
catch(IllegalAccessException illegalAccessException) {
|
|
||||||
throwable = illegalAccessException;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(throwable != null)
|
|
||||||
throw new java.lang.ClassNotFoundException(getClass().getName() + ".<init>(String) - fatal - couldn't create typedescription - " + throwable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new <code>Type</code> with
|
* Constructs a new <code>Type</code> with
|
||||||
* the given type description.
|
* the given type description.
|
||||||
* <p>
|
* <p>
|
||||||
|
* @since UDK3.0
|
||||||
* @param typeDescription a type description
|
* @param typeDescription a type description
|
||||||
*/
|
*/
|
||||||
public Type(Object typeDescription) {
|
public Type(ITypeDescription iTypeDescription) {
|
||||||
_typeDescription = typeDescription;
|
_typeName = iTypeDescription.getTypeName();
|
||||||
}
|
_typeClass = iTypeDescription.getTypeClass();
|
||||||
|
_iTypeDescription = iTypeDescription;
|
||||||
/**
|
|
||||||
* Constructs a new <code>Type</code> which defaults
|
|
||||||
* to <code>void</code>
|
|
||||||
* <p>
|
|
||||||
*/
|
|
||||||
public Type() {
|
|
||||||
init(void.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new <code>Type</code> with
|
|
||||||
* the given <code>class</code>.
|
|
||||||
* <p>
|
|
||||||
* @param zClass the class of this type
|
|
||||||
*/
|
|
||||||
public Type(Class zClass) throws Exception { // the exception is only for compatibility reasons
|
|
||||||
init(zClass);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new <code>Type</code> with
|
* Constructs a new <code>Type</code> with
|
||||||
* the given type name.
|
* the given type name.
|
||||||
* <p>
|
* <p>
|
||||||
|
* @since UDK3.0
|
||||||
* @param typeName the name of this type
|
* @param typeName the name of this type
|
||||||
*/
|
*/
|
||||||
public Type(String typeName) throws com.sun.star.uno.Exception, ClassNotFoundException { // the com.sun.star.uno.Exception is only for compatibility reasons
|
public Type(String typeName) {
|
||||||
init(typeName);
|
_typeClass = (TypeClass)__typeNameToTypeClass.get(typeName);
|
||||||
|
|
||||||
|
if(_typeClass == null)
|
||||||
|
_typeClass = TypeClass.UNKNOWN;
|
||||||
|
|
||||||
|
_typeName = typeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new <code>Type</code> with
|
* Constructs a new <code>Type</code> with
|
||||||
* the given <code>TypeClass</code>.
|
* the given <code>TypeClass</code>.
|
||||||
* <p>
|
* <p>
|
||||||
|
* @since UDK3.0
|
||||||
* @param typeClass the <code>TypeClass</code> of this type
|
* @param typeClass the <code>TypeClass</code> of this type
|
||||||
*/
|
*/
|
||||||
public Type(TypeClass typeClass) throws com.sun.star.uno.Exception {
|
public Type(TypeClass typeClass) throws IllegalArgumentException {
|
||||||
init(typeClass);
|
if(__isTypeClassPrimitive(typeClass)) {
|
||||||
}
|
_typeClass = typeClass;
|
||||||
|
_typeName = __typeClassToTypeName[typeClass.getValue()];
|
||||||
/**
|
|
||||||
* @deprecated as of UDK 2.0
|
|
||||||
*/
|
|
||||||
public Type(TypeClass typeClass, String typeName) throws com.sun.star.uno.Exception {
|
|
||||||
if(typeName != null) {
|
|
||||||
try {
|
|
||||||
init(typeName);
|
|
||||||
}
|
|
||||||
catch(ClassNotFoundException classNotFoundException) {
|
|
||||||
throw new Exception(classNotFoundException.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
init(typeClass);
|
throw new IllegalArgumentException(typeClass + " is not primitive");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated as of UDK 2.0
|
* Gives the type description of this type.
|
||||||
*/
|
|
||||||
public Type(TypeClass typeClass, String typeName, Class zClass) throws com.sun.star.uno.Exception {
|
|
||||||
this(typeClass, typeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated as of UDK 2.0
|
|
||||||
*/
|
|
||||||
public Type(TypeClass typeClass, String typeName, String arrayTypeName, Class zClass) throws com.sun.star.uno.Exception {
|
|
||||||
this(typeClass, typeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gives the the type description of this type.
|
|
||||||
* <p>
|
* <p>
|
||||||
|
* @since UDK3.0
|
||||||
* @return the type description
|
* @return the type description
|
||||||
*/
|
*/
|
||||||
public Object getTypeDescription() {
|
public ITypeDescription getTypeDescription() {
|
||||||
return _typeDescription;
|
return _iTypeDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the IDL <code>TypeClass</code> of the type.
|
* Sets the type description for this type.
|
||||||
* <p>
|
* <p>
|
||||||
* @deprecated as of UDK 2.0
|
* @since UDK3.0
|
||||||
* <p>
|
* @return the type description
|
||||||
* @return the <code>TypeClass</code>.
|
|
||||||
*/
|
*/
|
||||||
public TypeClass getTypeClass() {
|
public void setTypeDescription(ITypeDescription iTypeDescription) {
|
||||||
TypeClass typeClass = null;
|
_iTypeDescription = iTypeDescription;
|
||||||
|
|
||||||
try {
|
|
||||||
typeClass = (TypeClass)__getTypeClass.invoke(_typeDescription, null);
|
|
||||||
}
|
|
||||||
catch(IllegalAccessException illegalAccessException) {
|
|
||||||
}
|
|
||||||
catch(InvocationTargetException invocationTargetException) {
|
|
||||||
}
|
|
||||||
|
|
||||||
return typeClass;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the type name.
|
* Gets the type name.
|
||||||
|
* Returns <code>null</code> if this
|
||||||
|
* type has not been constructed by name.
|
||||||
* <p>
|
* <p>
|
||||||
* @deprecated as of UDK 2.0
|
* @since UDK1.0
|
||||||
* <p>
|
|
||||||
* @return the type name.
|
* @return the type name.
|
||||||
*/
|
*/
|
||||||
public String getTypeName() {
|
public String getTypeName() {
|
||||||
String typeName = null;
|
return _typeName;
|
||||||
|
|
||||||
try {
|
|
||||||
typeName = (String)__getTypeName.invoke(_typeDescription, null);
|
|
||||||
}
|
|
||||||
catch(IllegalAccessException illegalAccessException) {
|
|
||||||
}
|
|
||||||
catch(InvocationTargetException invocationTargetException) {
|
|
||||||
}
|
|
||||||
|
|
||||||
return typeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the array type name.
|
|
||||||
* <p>
|
|
||||||
* @deprecated as of UDK 2.0
|
|
||||||
* <p>
|
|
||||||
* @return the array type name.
|
|
||||||
*/
|
|
||||||
public String getArrayTypeName() {
|
|
||||||
String arrayTypeName = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
arrayTypeName = (String)__getArrayTypeName.invoke(_typeDescription, null);
|
|
||||||
}
|
|
||||||
catch(IllegalAccessException illegalAccessException) {
|
|
||||||
}
|
|
||||||
catch(InvocationTargetException invocationTargetException) {
|
|
||||||
}
|
|
||||||
|
|
||||||
return arrayTypeName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the corresponding java class for the type.
|
* Gets the class.
|
||||||
|
* Returns <code>null</code> if this
|
||||||
|
* type has not been constructed by <code>Class</code>.
|
||||||
* <p>
|
* <p>
|
||||||
* @deprecated as of UDK 2.0
|
* @since UDK1.0
|
||||||
* <p>
|
* @return the type name.
|
||||||
* @return the corresponding java class.
|
|
||||||
*/
|
*/
|
||||||
public Class getDescription() throws ClassNotFoundException {
|
public Class getZClass() {
|
||||||
Class zClass = null;
|
return _class;
|
||||||
|
|
||||||
try {
|
|
||||||
zClass = (Class)__getZClass.invoke(_typeDescription, null);
|
|
||||||
}
|
|
||||||
catch(IllegalAccessException illegalAccessException) {
|
|
||||||
}
|
|
||||||
catch(InvocationTargetException invocationTargetException) {
|
|
||||||
}
|
|
||||||
|
|
||||||
return zClass;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the typeClass.
|
||||||
|
* Returns <code>null</code> if this
|
||||||
|
* type has not been constructed by <code>TypeClass</code>.
|
||||||
|
* <p>
|
||||||
|
* @since UDK1.0
|
||||||
|
* @return the type name.
|
||||||
|
*/
|
||||||
|
public TypeClass getTypeClass() {
|
||||||
|
return _typeClass;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compares two types.
|
* Compares two types.
|
||||||
* <p>
|
* <p>
|
||||||
* @return true, if the given type and this type are equal
|
* @return true, if the given type and this type are equal
|
||||||
*/
|
*/
|
||||||
public boolean equals(Object type) {
|
public boolean equals(Object object) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
|
|
||||||
if(type != null) {
|
Type type = (Type)object;
|
||||||
result = _typeDescription == ((Type)type)._typeDescription;
|
|
||||||
|
|
||||||
if(!result && _typeDescription != null)
|
if(type != null)
|
||||||
result = _typeDescription.equals(((Type)type)._typeDescription);
|
result = _typeName.equals(type._typeName);
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -417,7 +323,7 @@ public class Type {
|
|||||||
* @return the hash code
|
* @return the hash code
|
||||||
*/
|
*/
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return _typeDescription.hashCode();
|
return _typeName.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -426,7 +332,7 @@ public class Type {
|
|||||||
* @return a descriptive <code>String</code>
|
* @return a descriptive <code>String</code>
|
||||||
*/
|
*/
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Type<" + _typeDescription + ">";
|
return "Type<" + _typeName + ">";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user