1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 package com.sun.star.uno; 29 30 import com.sun.star.lang.XTypeProvider; 31 import complexlib.ComplexTestCase; 32 33 public final class AnyConverter_Test extends ComplexTestCase { 34 public String getTestObjectName() { 35 return getClass().getName(); 36 } 37 38 public String[] getTestMethodNames() { 39 return new String[] { 40 "test_toBoolean", "test_toChar", "test_toByte", "test_toShort", 41 "test_toInt", "test_toLong", "test_toFloat", "test_toDouble", 42 "test_toObject", "test_toString", "test_toType", "test_toArray", 43 "test_isBoolean", "test_isChar", "test_isByte", "test_isShort", 44 "test_isInt", "test_isLong", "test_isFloat", "test_isDouble", 45 "test_isObject", "test_isString", "test_isType", "test_isArray", 46 "test_isVoid" }; 47 } 48 49 Any anyBool; // 50 Any anyChar; // 51 Any anyByte; // 52 Any anyShort; // 53 Any anyInt; // 54 Any anyLong; // 55 Any anyFloat; // 56 Any anyDouble; // 57 Any anyStr; // 58 Any anyType; // 59 Any anyArByte; // 60 Any anyVoid; // 61 Any anyXTypeProvider; 62 63 Boolean aBool= new Boolean(true); 64 Character aChar= new Character('A'); 65 Byte aByte= new Byte((byte) 111); 66 Short aShort= new Short((short) 11111); 67 Integer aInt= new Integer( 1111111); 68 Long aLong= new Long( 0xffffffff); 69 Float aFloat= new Float( 3.14); 70 Double aDouble= new Double( 3.145); 71 Object aObj= new ATypeProvider(); 72 String aStr= new String("I am a string"); 73 Type aType= new Type(String.class); 74 byte[] arByte= new byte[] {1,2,3}; 75 76 public AnyConverter_Test() { 77 anyVoid= new Any(new Type(void.class), null); 78 anyBool= new Any(new Type(Boolean.TYPE), aBool); 79 anyChar= new Any(new Type(Character.TYPE), aChar); 80 anyByte= new Any(new Type(Byte.TYPE), aByte); 81 anyShort= new Any(new Type(Short.TYPE), aShort); 82 anyInt= new Any(new Type(Integer.TYPE), aInt); 83 anyLong= new Any(new Type(Long.TYPE), aLong); 84 anyFloat= new Any(new Type(Float.TYPE), aFloat); 85 anyDouble= new Any(new Type(Double.TYPE), aDouble); 86 anyStr= new Any(new Type(String.class), aStr); 87 anyType= new Any(new Type(Type.class), aType); 88 anyArByte= new Any(new Type(byte[].class), arByte); 89 anyXTypeProvider= new Any(new Type(XTypeProvider.class), aObj); 90 } 91 92 public void test_toBoolean() 93 throws com.sun.star.lang.IllegalArgumentException 94 { 95 // must work 96 boolean b= AnyConverter.toBoolean(aBool); 97 assure("", b == aBool.booleanValue()); 98 b= AnyConverter.toBoolean(anyBool); 99 assure("", b == ((Boolean)anyBool.getObject()).booleanValue()); 100 101 // must fail 102 try { AnyConverter.toBoolean(aChar); failed(""); 103 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 104 try { AnyConverter.toBoolean(anyChar); failed(""); 105 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 106 try { AnyConverter.toBoolean(aByte); failed(""); 107 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 108 try { AnyConverter.toBoolean(anyByte); failed(""); 109 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 110 try { AnyConverter.toBoolean(aShort); failed(""); 111 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 112 try { AnyConverter.toBoolean(anyShort); failed(""); 113 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 114 try { AnyConverter.toBoolean(aInt); failed(""); 115 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 116 try { AnyConverter.toBoolean(anyInt); failed(""); 117 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 118 try { AnyConverter.toBoolean(aLong); failed(""); 119 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 120 try { AnyConverter.toBoolean(anyLong); failed(""); 121 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 122 try { AnyConverter.toBoolean(aFloat); failed(""); 123 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 124 try { AnyConverter.toBoolean(anyFloat); failed(""); 125 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 126 try { AnyConverter.toBoolean(aDouble); failed(""); 127 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 128 try { AnyConverter.toBoolean(anyDouble); failed(""); 129 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 130 try { AnyConverter.toBoolean(aObj); failed(""); 131 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 132 try { AnyConverter.toBoolean(aStr); failed(""); 133 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 134 try { AnyConverter.toBoolean(anyStr); failed(""); 135 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 136 try { AnyConverter.toBoolean(aType); failed(""); 137 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 138 try { AnyConverter.toBoolean(anyType); failed(""); 139 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 140 try { AnyConverter.toBoolean(anyVoid); failed(""); 141 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 142 try { AnyConverter.toBoolean(arByte); failed(""); 143 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 144 try { AnyConverter.toBoolean(anyArByte); failed(""); 145 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 146 } 147 148 public void test_toChar() 149 throws com.sun.star.lang.IllegalArgumentException 150 { 151 // must work 152 char b= AnyConverter.toChar(aChar); 153 assure("", b == aChar.charValue()); 154 b= AnyConverter.toChar(anyChar); 155 assure("", b == ((Character)anyChar.getObject()).charValue()); 156 157 // must fail 158 try { AnyConverter.toChar(aBool); failed(""); 159 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 160 try { AnyConverter.toChar(anyBool); failed(""); 161 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 162 try { AnyConverter.toChar(aByte); failed(""); 163 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 164 try { AnyConverter.toChar(anyByte); failed(""); 165 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 166 try { AnyConverter.toChar(aShort); failed(""); 167 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 168 try { AnyConverter.toChar(anyShort); failed(""); 169 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 170 try { AnyConverter.toChar(aInt); failed(""); 171 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 172 try { AnyConverter.toChar(anyInt); failed(""); 173 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 174 try { AnyConverter.toChar(aLong); failed(""); 175 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 176 try { AnyConverter.toChar(anyLong); failed(""); 177 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 178 try { AnyConverter.toChar(aFloat); failed(""); 179 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 180 try { AnyConverter.toChar(anyFloat); failed(""); 181 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 182 try { AnyConverter.toChar(aDouble); failed(""); 183 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 184 try { AnyConverter.toChar(anyDouble); failed(""); 185 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 186 try { AnyConverter.toChar(aObj); failed(""); 187 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 188 try { AnyConverter.toChar(aStr); failed(""); 189 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 190 try { AnyConverter.toChar(anyStr); failed(""); 191 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 192 try { AnyConverter.toChar(aType); failed(""); 193 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 194 try { AnyConverter.toChar(anyType); failed(""); 195 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 196 try { AnyConverter.toChar(anyVoid); failed(""); 197 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 198 try { AnyConverter.toChar(arByte); failed(""); 199 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 200 try { AnyConverter.toChar(anyArByte); failed(""); 201 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 202 } 203 204 public void test_toByte() 205 throws com.sun.star.lang.IllegalArgumentException 206 { 207 // must work 208 byte val= AnyConverter.toByte(aByte); 209 assure("", val == aByte.byteValue()); 210 val= AnyConverter.toByte(anyByte); 211 assure("", val == ((Byte)anyByte.getObject()).byteValue()); 212 213 // must fail 214 try { AnyConverter.toByte(aChar); failed(""); 215 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 216 try { AnyConverter.toByte(anyChar); failed(""); 217 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 218 try { AnyConverter.toByte(aShort); failed(""); 219 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 220 try { AnyConverter.toByte(anyShort); failed(""); 221 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 222 try { AnyConverter.toByte(aInt); failed(""); 223 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 224 try { AnyConverter.toByte(anyInt); failed(""); 225 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 226 try { AnyConverter.toByte(aLong); failed(""); 227 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 228 try { AnyConverter.toByte(anyLong); failed(""); 229 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 230 try { AnyConverter.toByte(aFloat); failed(""); 231 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 232 try { AnyConverter.toByte(anyFloat); failed(""); 233 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 234 try { AnyConverter.toByte(aDouble); failed(""); 235 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 236 try { AnyConverter.toByte(anyDouble); failed(""); 237 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 238 try { AnyConverter.toByte(aObj); failed(""); 239 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 240 try { AnyConverter.toByte(aStr); failed(""); 241 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 242 try { AnyConverter.toByte(anyStr); failed(""); 243 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 244 try { AnyConverter.toByte(aType); failed(""); 245 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 246 try { AnyConverter.toByte(anyType); failed(""); 247 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 248 try { AnyConverter.toByte(anyVoid); failed(""); 249 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 250 try { AnyConverter.toByte(arByte); failed(""); 251 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 252 try { AnyConverter.toByte(anyArByte); failed(""); 253 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 254 } 255 256 public void test_toShort() 257 throws com.sun.star.lang.IllegalArgumentException 258 { 259 // must work 260 short sh= AnyConverter.toShort(aByte); 261 assure("", sh == aByte.byteValue()); 262 sh= AnyConverter.toShort(aShort); 263 assure("", sh == aShort.shortValue()); 264 sh= AnyConverter.toShort(anyByte); 265 assure("", sh == ((Byte)anyByte.getObject()).byteValue()); 266 sh= AnyConverter.toShort(anyShort); 267 assure("", sh == ((Short) anyShort.getObject()).shortValue()); 268 Any a = new Any( Type.UNSIGNED_SHORT, new Short((short)5) ); 269 assure("", 5 == AnyConverter.toUnsignedShort( a )); 270 271 // must fail 272 try { AnyConverter.toShort(a); failed(""); 273 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 274 try { AnyConverter.toUnsignedShort(anyShort); failed(""); 275 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 276 try { AnyConverter.toChar(aBool); failed(""); 277 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 278 try { AnyConverter.toChar(anyBool); failed(""); 279 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 280 try { AnyConverter.toShort(aChar); failed(""); 281 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 282 try { AnyConverter.toShort(anyChar); failed(""); 283 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 284 try { AnyConverter.toShort(aBool); failed(""); 285 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 286 try { AnyConverter.toShort(anyBool); failed(""); 287 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 288 try { AnyConverter.toShort(aInt); failed(""); 289 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 290 try { AnyConverter.toShort(anyInt); failed(""); 291 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 292 try { AnyConverter.toShort(aLong); failed(""); 293 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 294 try { AnyConverter.toShort(anyLong); failed(""); 295 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 296 try { AnyConverter.toShort(aFloat); failed(""); 297 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 298 try { AnyConverter.toShort(anyFloat); failed(""); 299 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 300 try { AnyConverter.toShort(aDouble); failed(""); 301 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 302 try { AnyConverter.toShort(anyDouble); failed(""); 303 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 304 try { AnyConverter.toShort(aObj); failed(""); 305 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 306 try { AnyConverter.toShort(aStr); failed(""); 307 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 308 try { AnyConverter.toShort(anyStr); failed(""); 309 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 310 try { AnyConverter.toShort(aType); failed(""); 311 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 312 try { AnyConverter.toShort(anyType); failed(""); 313 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 314 try { AnyConverter.toShort(anyVoid); failed(""); 315 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 316 try { AnyConverter.toShort(arByte); failed(""); 317 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 318 try { AnyConverter.toShort(anyArByte); failed(""); 319 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 320 } 321 322 public void test_toInt() 323 throws com.sun.star.lang.IllegalArgumentException 324 { 325 // must work 326 int val= AnyConverter.toInt(aByte); 327 assure("", val == aByte.byteValue()); 328 val= AnyConverter.toInt(aShort); 329 assure("", val == aShort.shortValue()); 330 val= AnyConverter.toInt(aInt); 331 assure("", val == aInt.intValue()); 332 val= AnyConverter.toInt(anyByte); 333 assure("", val == ((Byte)anyByte.getObject()).byteValue()); 334 val= AnyConverter.toInt(anyShort); 335 assure("", val == ((Short) anyShort.getObject()).shortValue()); 336 val= AnyConverter.toInt(anyInt); 337 assure("", val == ((Integer) anyInt.getObject()).intValue()); 338 Any a = new Any( Type.UNSIGNED_SHORT, new Short((short)5) ); 339 assure("", 5 == AnyConverter.toInt(a)); 340 assure("", 5 == AnyConverter.toUnsignedInt(a)); 341 a = new Any( Type.UNSIGNED_LONG, new Integer(5) ); 342 assure("", 5 == AnyConverter.toUnsignedInt(a)); 343 344 // must fail 345 try { AnyConverter.toUnsignedInt(anyInt); failed(""); 346 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 347 try { AnyConverter.toInt(a); failed(""); 348 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 349 try { AnyConverter.toUnsignedInt(anyShort); failed(""); 350 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 351 try { AnyConverter.toInt(aChar); failed(""); 352 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 353 try { AnyConverter.toInt(anyChar); failed(""); 354 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 355 try { AnyConverter.toInt(aBool); failed(""); 356 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 357 try { AnyConverter.toInt(anyBool); failed(""); 358 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 359 try { AnyConverter.toInt(aLong); failed(""); 360 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 361 try { AnyConverter.toInt(anyLong); failed(""); 362 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 363 try { AnyConverter.toInt(aFloat); failed(""); 364 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 365 try { AnyConverter.toInt(anyFloat); failed(""); 366 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 367 try { AnyConverter.toInt(aDouble); failed(""); 368 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 369 try { AnyConverter.toInt(anyDouble); failed(""); 370 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 371 try { AnyConverter.toInt(aObj); failed(""); 372 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 373 try { AnyConverter.toInt(aStr); failed(""); 374 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 375 try { AnyConverter.toInt(anyStr); failed(""); 376 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 377 try { AnyConverter.toInt(aType); failed(""); 378 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 379 try { AnyConverter.toInt(anyType); failed(""); 380 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 381 try { AnyConverter.toInt(anyVoid); failed(""); 382 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 383 try { AnyConverter.toInt(arByte); failed(""); 384 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 385 try { AnyConverter.toInt(anyArByte); failed(""); 386 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 387 } 388 389 public void test_toLong() 390 throws com.sun.star.lang.IllegalArgumentException 391 { 392 // must work 393 long val= AnyConverter.toLong(aByte); 394 assure("", val == aByte.byteValue()); 395 val= AnyConverter.toLong(aShort); 396 assure("", val == aShort.shortValue()); 397 val= AnyConverter.toLong(aInt); 398 assure("", val == aInt.intValue()); 399 val= AnyConverter.toLong(aLong); 400 assure("", val == aLong.longValue()); 401 val= AnyConverter.toLong(anyByte); 402 assure("", val == ((Byte)anyByte.getObject()).byteValue()); 403 val= AnyConverter.toLong(anyShort); 404 assure("", val == ((Short) anyShort.getObject()).shortValue()); 405 val= AnyConverter.toLong(anyInt); 406 assure("", val == ((Integer) anyInt.getObject()).intValue()); 407 val= AnyConverter.toLong(anyLong); 408 assure("", val == ((Long) anyLong.getObject()).longValue()); 409 Any a = new Any( Type.UNSIGNED_SHORT, new Short((short)5) ); 410 assure("", 5 == AnyConverter.toLong(a)); 411 assure("", 5 == AnyConverter.toUnsignedLong(a)); 412 a = new Any( Type.UNSIGNED_LONG, new Integer(5) ); 413 assure("", 5 == AnyConverter.toUnsignedLong(a)); 414 assure("", 5 == AnyConverter.toLong(a)); 415 a = new Any( Type.UNSIGNED_HYPER, new Long(5) ); 416 assure("", 5 == AnyConverter.toUnsignedLong(a)); 417 418 // must fail 419 try { AnyConverter.toUnsignedLong(anyShort); failed(""); 420 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 421 try { AnyConverter.toUnsignedLong(anyInt); failed(""); 422 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 423 try { AnyConverter.toLong(a); failed(""); 424 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 425 try { AnyConverter.toUnsignedLong(anyLong); failed(""); 426 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 427 try { AnyConverter.toLong(aChar); failed(""); 428 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 429 try { AnyConverter.toLong(anyChar); failed(""); 430 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 431 try { AnyConverter.toLong(aBool); failed(""); 432 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 433 try { AnyConverter.toLong(anyBool); failed(""); 434 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 435 try { AnyConverter.toLong(aFloat); failed(""); 436 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 437 try { AnyConverter.toLong(anyFloat); failed(""); 438 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 439 try { AnyConverter.toLong(aDouble); failed(""); 440 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 441 try { AnyConverter.toLong(anyDouble); failed(""); 442 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 443 try { AnyConverter.toLong(aObj); failed(""); 444 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 445 try { AnyConverter.toLong(aStr); failed(""); 446 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 447 try { AnyConverter.toLong(anyStr); failed(""); 448 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 449 try { AnyConverter.toLong(aType); failed(""); 450 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 451 try { AnyConverter.toLong(anyType); failed(""); 452 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 453 try { AnyConverter.toLong(anyVoid); failed(""); 454 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 455 try { AnyConverter.toLong(arByte); failed(""); 456 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 457 try { AnyConverter.toLong(anyArByte); failed(""); 458 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 459 } 460 461 public void test_toFloat() 462 throws com.sun.star.lang.IllegalArgumentException 463 { 464 // must work 465 float val= AnyConverter.toFloat(aByte); 466 assure("", val == aByte.byteValue()); // 111 = 111.0 467 val= AnyConverter.toFloat(anyByte); 468 assure("", val == ((Byte)anyByte.getObject()).byteValue()); 469 val= AnyConverter.toFloat(aShort); 470 assure("", val == aShort.shortValue()); //11111 = 11111.0 471 val= AnyConverter.toFloat(anyShort); 472 assure("", val == ((Short) anyShort.getObject()).shortValue()); 473 val= AnyConverter.toFloat(aFloat); 474 assure("", val == aFloat.floatValue()); 475 val= AnyConverter.toFloat(anyFloat); 476 assure("", val == ((Float) anyFloat.getObject()).floatValue()); 477 478 // must fail 479 try { AnyConverter.toFloat(aChar); failed(""); 480 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 481 try { AnyConverter.toFloat(anyChar); failed(""); 482 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 483 try { AnyConverter.toFloat(aBool); failed(""); 484 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 485 try { AnyConverter.toFloat(anyBool); failed(""); 486 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 487 try { AnyConverter.toFloat(aInt); failed(""); 488 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 489 try { AnyConverter.toFloat(anyInt); failed(""); 490 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 491 try { AnyConverter.toFloat(aLong); failed(""); 492 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 493 try { AnyConverter.toFloat(anyLong); failed(""); 494 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 495 try { AnyConverter.toFloat(aDouble); failed(""); 496 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 497 try { AnyConverter.toFloat(anyDouble); failed(""); 498 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 499 try { AnyConverter.toFloat(aObj); failed(""); 500 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 501 try { AnyConverter.toFloat(aStr); failed(""); 502 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 503 try { AnyConverter.toFloat(anyStr); failed(""); 504 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 505 try { AnyConverter.toFloat(aType); failed(""); 506 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 507 try { AnyConverter.toFloat(anyType); failed(""); 508 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 509 try { AnyConverter.toFloat(anyVoid); failed(""); 510 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 511 try { AnyConverter.toFloat(arByte); failed(""); 512 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 513 try { AnyConverter.toFloat(anyArByte); failed(""); 514 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 515 } 516 517 public void test_toDouble() 518 throws com.sun.star.lang.IllegalArgumentException 519 { 520 // must work 521 double val= AnyConverter.toDouble(aByte); 522 assure("", val == aByte.byteValue()); // 111 = 111.0 523 val= AnyConverter.toDouble(anyByte); 524 assure("", val == ((Byte)anyByte.getObject()).byteValue()); 525 val= AnyConverter.toDouble(aShort); 526 assure("", val == aShort.shortValue()); //11111 = 11111.0 527 val= AnyConverter.toDouble(anyShort); 528 assure("", val == ((Short) anyShort.getObject()).shortValue()); 529 val= AnyConverter.toDouble(aInt); 530 assure("", val == aInt.intValue()); 531 val= AnyConverter.toDouble(anyInt); 532 assure("", val == ((Integer) anyInt.getObject()).intValue()); 533 val= AnyConverter.toDouble(aFloat); 534 assure("", val == aFloat.floatValue()); 535 val= AnyConverter.toDouble(anyFloat); 536 float float1= ((Float) anyFloat.getObject()).floatValue(); 537 assure("", val <= (float1 + 0.1) || val >= (float1 - 0.1)); 538 val= AnyConverter.toDouble(aDouble); 539 assure("", val == aDouble.doubleValue()); 540 val= AnyConverter.toDouble(anyDouble); 541 assure("", val == ((Double) anyDouble.getObject()).doubleValue()); 542 543 // must fail 544 try { AnyConverter.toDouble(aChar); failed(""); 545 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 546 try { AnyConverter.toDouble(anyChar); failed(""); 547 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 548 try { AnyConverter.toDouble(aBool); failed(""); 549 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 550 try { AnyConverter.toDouble(anyBool); failed(""); 551 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 552 try { AnyConverter.toDouble(aLong); failed(""); 553 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 554 try { AnyConverter.toDouble(anyLong); failed(""); 555 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 556 try { AnyConverter.toDouble(aObj); failed(""); 557 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 558 try { AnyConverter.toDouble(aStr); failed(""); 559 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 560 try { AnyConverter.toDouble(anyStr); failed(""); 561 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 562 try { AnyConverter.toDouble(aType); failed(""); 563 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 564 try { AnyConverter.toDouble(anyType); failed(""); 565 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 566 try { AnyConverter.toDouble(anyVoid); failed(""); 567 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 568 try { AnyConverter.toDouble(arByte); failed(""); 569 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 570 try { AnyConverter.toDouble(anyArByte); failed(""); 571 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 572 } 573 574 public void test_toObject() 575 throws com.sun.star.lang.IllegalArgumentException 576 { 577 // must work 578 Type _type= new Type(XTypeProvider.class); 579 Object val= AnyConverter.toObject(_type, aObj); 580 assure("", UnoRuntime.areSame(val, aObj)); 581 val= AnyConverter.toObject( 582 _type, new Any( new Type(XTypeProvider.class), null)); 583 assure("", val == null); 584 585 // structs, exceptions 586 com.sun.star.lang.IllegalArgumentException exc = 587 new com.sun.star.lang.IllegalArgumentException(); 588 Any any_exc = new Any( 589 new Type("com.sun.star.lang.IllegalArgumentException", 590 TypeClass.EXCEPTION), exc); 591 assure("", 592 AnyConverter.toObject( 593 new Type(com.sun.star.lang.IllegalArgumentException.class), 594 any_exc).equals(exc)); 595 assure("", 596 AnyConverter.toObject( 597 new Type(com.sun.star.uno.Exception.class), any_exc).equals( 598 exc)); 599 try { 600 AnyConverter.toObject( 601 new Type(com.sun.star.uno.RuntimeException.class), any_exc); 602 failed(""); 603 } catch (com.sun.star.lang.IllegalArgumentException ie) {}; 604 any_exc = new Any(com.sun.star.lang.IllegalArgumentException.class, 605 exc); 606 assure("", 607 AnyConverter.toObject( 608 new Type(com.sun.star.lang.IllegalArgumentException.class), 609 any_exc).equals(exc)); 610 assure("", 611 AnyConverter.toObject(new Type(com.sun.star.uno.Exception.class), 612 any_exc).equals(exc)); 613 try { 614 AnyConverter.toObject( 615 new Type(com.sun.star.uno.RuntimeException.class), any_exc); 616 failed(""); 617 } catch (com.sun.star.lang.IllegalArgumentException ie) {}; 618 619 // must fail 620 try { AnyConverter.toObject(_type, aType); failed(""); 621 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 622 try { AnyConverter.toObject(_type, anyType); failed(""); 623 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 624 try { AnyConverter.toObject(_type, anyVoid); failed(""); 625 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 626 try { AnyConverter.toObject(_type, new Object()); failed(""); 627 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 628 } 629 630 public void test_toString() 631 throws com.sun.star.lang.IllegalArgumentException 632 { 633 // must work 634 String val= AnyConverter.toString(aStr); 635 assure("", aStr.equals(val)); 636 val= AnyConverter.toString(anyStr); 637 assure("", ((String)anyStr.getObject()).equals(val)); 638 639 // must fail 640 try { AnyConverter.toString(aBool); failed(""); 641 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 642 try { AnyConverter.toString(anyBool); failed(""); 643 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 644 try { AnyConverter.toString(aChar); failed(""); 645 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 646 try { AnyConverter.toString(anyChar); failed(""); 647 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 648 try { AnyConverter.toString(aByte); failed(""); 649 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 650 try { AnyConverter.toString(anyByte); failed(""); 651 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 652 try { AnyConverter.toString(aShort); failed(""); 653 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 654 try { AnyConverter.toString(anyShort); failed(""); 655 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 656 try { AnyConverter.toString(aInt); failed(""); 657 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 658 try { AnyConverter.toString(anyInt); failed(""); 659 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 660 try { AnyConverter.toString(aLong); failed(""); 661 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 662 try { AnyConverter.toString(anyLong); failed(""); 663 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 664 try { AnyConverter.toString(aFloat); failed(""); 665 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 666 try { AnyConverter.toString(anyFloat); failed(""); 667 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 668 try { AnyConverter.toString(aDouble); failed(""); 669 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 670 try { AnyConverter.toString(anyDouble); failed(""); 671 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 672 try { AnyConverter.toString(aObj); failed(""); 673 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 674 try { AnyConverter.toString(aType); failed(""); 675 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 676 try { AnyConverter.toString(anyType); failed(""); 677 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 678 try { AnyConverter.toString(anyVoid); failed(""); 679 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 680 try { AnyConverter.toString(arByte); failed(""); 681 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 682 try { AnyConverter.toString(anyArByte); failed(""); 683 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 684 } 685 686 public void test_toType() 687 throws com.sun.star.lang.IllegalArgumentException 688 { 689 // must work 690 Type val= AnyConverter.toType(aType); 691 assure("", val == aType); 692 val= AnyConverter.toType(anyType); 693 assure("", val == anyType.getObject()); 694 695 // must fail 696 try { AnyConverter.toType(aBool); failed(""); 697 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 698 try { AnyConverter.toType(anyBool); failed(""); 699 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 700 try { AnyConverter.toType(aChar); failed(""); 701 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 702 try { AnyConverter.toType(anyChar); failed(""); 703 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 704 try { AnyConverter.toType(aByte); failed(""); 705 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 706 try { AnyConverter.toType(anyByte); failed(""); 707 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 708 try { AnyConverter.toType(aShort); failed(""); 709 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 710 try { AnyConverter.toType(anyShort); failed(""); 711 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 712 try { AnyConverter.toType(aInt); failed(""); 713 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 714 try { AnyConverter.toType(anyInt); failed(""); 715 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 716 try { AnyConverter.toType(aLong); failed(""); 717 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 718 try { AnyConverter.toType(anyLong); failed(""); 719 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 720 try { AnyConverter.toType(aFloat); failed(""); 721 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 722 try { AnyConverter.toType(anyFloat); failed(""); 723 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 724 try { AnyConverter.toType(aDouble); failed(""); 725 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 726 try { AnyConverter.toType(anyDouble); failed(""); 727 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 728 try { AnyConverter.toType(aObj); failed(""); 729 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 730 try { AnyConverter.toType(aStr); failed(""); 731 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 732 try { AnyConverter.toType(anyStr); failed(""); 733 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 734 try { AnyConverter.toType(anyVoid); failed(""); 735 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 736 try { AnyConverter.toType(arByte); failed(""); 737 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 738 try { AnyConverter.toType(anyArByte); failed(""); 739 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 740 } 741 742 public void test_toArray() 743 throws com.sun.star.lang.IllegalArgumentException 744 { 745 // must work 746 Object val= AnyConverter.toArray(arByte); 747 assure("", val == arByte); 748 val= AnyConverter.toArray(anyArByte); 749 assure("", val == anyArByte.getObject()); 750 751 // must fail 752 try { AnyConverter.toType(aBool); failed(""); 753 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 754 try { AnyConverter.toType(anyBool); failed(""); 755 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 756 try { AnyConverter.toType(aChar); failed(""); 757 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 758 try { AnyConverter.toType(anyChar); failed(""); 759 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 760 try { AnyConverter.toType(aByte); failed(""); 761 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 762 try { AnyConverter.toType(anyByte); failed(""); 763 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 764 try { AnyConverter.toType(aShort); failed(""); 765 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 766 try { AnyConverter.toType(anyShort); failed(""); 767 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 768 try { AnyConverter.toType(aInt); failed(""); 769 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 770 try { AnyConverter.toType(anyInt); failed(""); 771 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 772 try { AnyConverter.toType(aLong); failed(""); 773 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 774 try { AnyConverter.toType(anyLong); failed(""); 775 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 776 try { AnyConverter.toType(aFloat); failed(""); 777 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 778 try { AnyConverter.toType(anyFloat); failed(""); 779 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 780 try { AnyConverter.toType(aDouble); failed(""); 781 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 782 try { AnyConverter.toType(anyDouble); failed(""); 783 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 784 try { AnyConverter.toType(aObj); failed(""); 785 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 786 try { AnyConverter.toType(aStr); failed(""); 787 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 788 try { AnyConverter.toType(anyStr); failed(""); 789 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 790 try { AnyConverter.toType(anyVoid); failed(""); 791 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 792 try { AnyConverter.toType(arByte); failed(""); 793 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 794 try { AnyConverter.toType(anyArByte); failed(""); 795 } catch (com.sun.star.lang.IllegalArgumentException ie) {} 796 } 797 798 public void test_isBoolean() { 799 assure("", AnyConverter.isBoolean(aBool)); 800 assure("", AnyConverter.isBoolean(anyBool)); 801 assure("", !AnyConverter.isBoolean(aChar)); 802 } 803 804 public void test_isChar() { 805 assure("", AnyConverter.isChar(aChar)); 806 assure("", AnyConverter.isChar(anyChar)); 807 assure("", !AnyConverter.isChar(aBool)); 808 } 809 810 public void test_isByte() { 811 assure("", AnyConverter.isByte(aByte)); 812 assure("", AnyConverter.isByte(anyByte)); 813 assure("", !AnyConverter.isByte(aBool)); 814 } 815 816 public void test_isShort() { 817 assure("", AnyConverter.isShort(aShort)); 818 assure("", AnyConverter.isShort(anyShort)); 819 assure("", Type.SHORT.equals(AnyConverter.getType(anyShort))); 820 Any a = new Any( Type.UNSIGNED_SHORT, new Short((short)5) ); 821 assure("", Type.UNSIGNED_SHORT.equals(AnyConverter.getType(a))); 822 assure("", !AnyConverter.isShort(a)); 823 assure("", !Type.SHORT.equals(AnyConverter.getType(a))); 824 assure("", !AnyConverter.isShort(aBool)); 825 } 826 827 public void test_isInt() { 828 assure("", AnyConverter.isInt(aInt)); 829 assure("", AnyConverter.isInt(anyInt)); 830 assure("", Type.LONG.equals(AnyConverter.getType(anyInt))); 831 Any a = new Any(Type.UNSIGNED_LONG, new Integer(5)); 832 assure("", Type.UNSIGNED_LONG.equals(AnyConverter.getType(a))); 833 assure("", !AnyConverter.isInt(a)); 834 assure("", !Type.LONG.equals(AnyConverter.getType(a))); 835 assure("", !AnyConverter.isInt(aBool)); 836 } 837 838 public void test_isLong() { 839 assure("", AnyConverter.isLong(aLong)); 840 assure("", AnyConverter.isLong(anyLong)); 841 assure("", Type.HYPER.equals(AnyConverter.getType(anyLong))); 842 Any a = new Any( Type.UNSIGNED_HYPER, new Long(5) ); 843 assure("", Type.UNSIGNED_HYPER.equals( AnyConverter.getType(a) )); 844 assure("", !AnyConverter.isLong(a)); 845 assure("", !Type.HYPER.equals( AnyConverter.getType(a) )); 846 assure("", !AnyConverter.isLong(aBool)); 847 } 848 849 public void test_isFloat() { 850 assure("", AnyConverter.isFloat(aFloat)); 851 assure("", AnyConverter.isFloat(anyFloat)); 852 assure("", !AnyConverter.isFloat(aDouble)); 853 } 854 855 public void test_isDouble() { 856 assure("", AnyConverter.isDouble(aDouble)); 857 assure("", AnyConverter.isDouble(anyDouble)); 858 assure("", !AnyConverter.isDouble(aFloat)); 859 } 860 861 public void test_isObject() { 862 assure("", AnyConverter.isObject(aObj)); 863 assure("", AnyConverter.isObject( new Any( XInterface.class, null))); 864 assure("", !AnyConverter.isObject(new Object())); 865 } 866 867 public void test_isString() { 868 assure("", AnyConverter.isString(aStr)); 869 assure("", AnyConverter.isString(anyStr)); 870 assure("", !AnyConverter.isString(new Object())); 871 } 872 873 public void test_isType() { 874 assure("", AnyConverter.isType(aType)); 875 assure("", AnyConverter.isType(anyType)); 876 assure("", !AnyConverter.isType(new Object())); 877 } 878 879 public void test_isArray() { 880 assure("", AnyConverter.isArray(arByte)); 881 assure("", AnyConverter.isArray(anyArByte)); 882 assure("", !AnyConverter.isArray(new Object())); 883 } 884 885 public void test_isVoid() { 886 assure("", AnyConverter.isVoid(anyVoid)); 887 assure("", !AnyConverter.isVoid(new Object())); 888 } 889 } 890 891 892 class ATypeProvider implements com.sun.star.lang.XTypeProvider 893 { 894 895 public byte[] getImplementationId() 896 { 897 return new byte[]{1,2,3}; 898 } 899 900 public com.sun.star.uno.Type[] getTypes() 901 { 902 return new Type[]{new Type(XTypeProvider.class)}; 903 } 904 905 } 906