001 package railo.runtime.util; 002 003 import java.awt.Color; 004 import java.io.File; 005 import java.io.Serializable; 006 import java.util.Iterator; 007 import java.util.List; 008 import java.util.Locale; 009 import java.util.Map; 010 import java.util.TimeZone; 011 012 import org.w3c.dom.Node; 013 import org.w3c.dom.NodeList; 014 015 import railo.commons.io.res.Resource; 016 import railo.runtime.PageContext; 017 import railo.runtime.exp.PageException; 018 import railo.runtime.type.Array; 019 import railo.runtime.type.Collection; 020 import railo.runtime.type.Query; 021 import railo.runtime.type.Struct; 022 import railo.runtime.type.dt.DateTime; 023 import railo.runtime.type.dt.TimeSpan; 024 025 026 027 028 /** 029 * This class can cast object of one type to a other by cold fusion rules 030 */ 031 public interface Cast { 032 033 /** 034 * cast a boolean value to a boolean value (do nothing) 035 * @param b boolean value to cast 036 * @return casted boolean value 037 */ 038 public boolean toBooleanValue(boolean b); 039 040 /** 041 * cast a double value to a boolean value (primitive value type) 042 * @param d double value to cast 043 * @return casted boolean value 044 */ 045 public boolean toBooleanValue(double d); 046 047 /** 048 * cast a double value to a boolean value (primitive value type) 049 * @param c char value to cast 050 * @return casted boolean value 051 */ 052 public boolean toBooleanValue(char c); 053 054 /** 055 * cast a Object to a boolean value (primitive value type) 056 * @param o Object to cast 057 * @return casted boolean value 058 * @throws PageException 059 */ 060 public boolean toBooleanValue(Object o) throws PageException; 061 062 /** 063 * cast a Object to a Double Object (reference Type) 064 * @param o Object to cast 065 * @return casted Double Object 066 * @throws PageException 067 */ 068 public Double toDouble(Object o) throws PageException; 069 070 /** 071 * cast a Object to a Double Object (reference Type) 072 * @param o Object to cast 073 * @param defaultValue 074 * @return casted Double Object 075 */ 076 public Double toDouble(Object o, Double defaultValue); 077 078 /** 079 * cast a String to a Double Object (reference Type) 080 * @param str String to cast 081 * @return casted Double Object 082 * @throws PageException 083 */ 084 public Double toDouble(String str) throws PageException; 085 086 /** 087 * cast a String to a Double Object (reference Type) 088 * @param str String to cast 089 * @param defaultValue 090 * @return casted Double Object 091 */ 092 public Double toDouble(String str, Double defaultValue); 093 094 /** 095 * cast a double value to a Double Object (reference Type) 096 * @param d double value to cast 097 * @return casted Double Object 098 */ 099 public Double toDouble(double d); 100 101 /** 102 * cast a boolean value to a Double Object (reference Type) 103 * @param b boolean value to cast 104 * @return casted Double Object 105 */ 106 public Double toDouble(boolean b); 107 108 /** 109 * cast a char value to a Double Object (reference Type) 110 * @param c char value to cast 111 * @return casted Double Object 112 */ 113 public Double toDouble(char c); 114 115 /** 116 * cast a Object to a double value (primitive value Type) 117 * @param o Object to cast 118 * @return casted double value 119 * @throws PageException 120 */ 121 public double toDoubleValue(Object o) throws PageException; 122 123 /** 124 * cast a Object to a double value (primitive value Type) 125 * @param str String to cast 126 * @return casted double value 127 * @throws PageException 128 */ 129 public double toDoubleValue(String str) throws PageException; 130 131 /** 132 * cast a Object to a double value (primitive value Type) 133 * @param o Object to cast 134 * @param defaultValue if can't cast return this value 135 * @return casted double value 136 */ 137 public double toDoubleValue(Object o,double defaultValue); 138 139 /** 140 * cast a Object to a double value (primitive value Type), if can't return Double.NaN 141 * @param str String to cast 142 * @param defaultValue if can't cast return this value 143 * @return casted double value 144 */ 145 public double toDoubleValue(String str,double defaultValue); 146 147 /** 148 * cast a double value to a double value (do nothing) 149 * @param d double value to cast 150 * @return casted double value 151 */ 152 public double toDoubleValue(double d); 153 154 /** 155 * cast a boolean value to a double value (primitive value type) 156 * @param b boolean value to cast 157 * @return casted double value 158 */ 159 public double toDoubleValue(boolean b); 160 161 /** 162 * cast a char value to a double value (primitive value type) 163 * @param c char value to cast 164 * @return casted double value 165 */ 166 public double toDoubleValue(char c); 167 168 /** 169 * cast a Object to a int value (primitive value type) 170 * @param o Object to cast 171 * @return casted int value 172 * @throws PageException 173 */ 174 public int toIntValue(Object o) throws PageException; 175 176 /** 177 * cast a Object to a int value (primitive value type) 178 * @param o Object to cast 179 * @param defaultValue 180 * @return casted int value 181 */ 182 public int toIntValue(Object o, int defaultValue); 183 184 /** 185 * cast a String to a int value (primitive value type) 186 * @param str String to cast 187 * @return casted int value 188 * @throws PageException 189 */ 190 public int toIntValue(String str) throws PageException; 191 192 /** 193 * cast a Object to a double value (primitive value Type), if can't return Integer.MIN_VALUE 194 * @param str String to cast 195 * @param defaultValue 196 * @return casted double value 197 */ 198 public int toIntValue(String str, int defaultValue); 199 200 /** 201 * cast a double value to a int value (primitive value type) 202 * @param d double value to cast 203 * @return casted int value 204 */ 205 public int toIntValue(double d); 206 207 /** 208 * cast a boolean value to a int value (primitive value type) 209 * @param b boolean value to cast 210 * @return casted int value 211 */ 212 public int toIntValue(boolean b); 213 214 /** 215 * cast a char value to a int value (primitive value type) 216 * @param c char value to cast 217 * @return casted int value 218 */ 219 public int toIntValue(char c); 220 221 /** 222 * cast a double to a decimal value (String:xx.xx) 223 * @param value Object to cast 224 * @return casted decimal value 225 * @throws PageException 226 */ 227 public String toDecimal(Object value) throws PageException; 228 229 /** 230 * cast a double to a decimal value (String:xx.xx) 231 * @param value Object to cast 232 * @param defaultValue 233 * @return casted decimal value 234 */ 235 public String toDecimal(Object value, String defaultValue); 236 237 /** 238 * cast a char to a decimal value (String:xx.xx) 239 * @param c char to cast 240 * @return casted decimal value 241 */ 242 public String toDecimal(char c); 243 244 /** 245 * cast a boolean to a decimal value (String:xx.xx) 246 * @param b boolean to cast 247 * @return casted decimal value 248 */ 249 public String toDecimal(boolean b); 250 251 /** 252 * cast a double to a decimal value (String:xx.xx) 253 * @param d double to cast 254 * @return casted decimal value 255 */ 256 public String toDecimal(double d); 257 258 /** 259 * cast a boolean value to a Boolean Object(reference type) 260 * @param b boolean value to cast 261 * @return casted Boolean Object 262 */ 263 public Boolean toBoolean(boolean b); 264 265 /** 266 * cast a char value to a Boolean Object(reference type) 267 * @param c char value to cast 268 * @return casted Boolean Object 269 */ 270 public Boolean toBoolean(char c); 271 272 /** 273 * cast a double value to a Boolean Object(reference type) 274 * @param d double value to cast 275 * @return casted Boolean Object 276 */ 277 public Boolean toBoolean(double d); 278 279 /** 280 * cast a Object to a Boolean Object(reference type) 281 * @param o Object to cast 282 * @return casted Boolean Object 283 * @throws PageException 284 */ 285 public Boolean toBoolean(Object o) throws PageException; 286 287 /** 288 * cast a Object to a Boolean Object(reference type) 289 * @param str String to cast 290 * @return casted Boolean Object 291 * @throws PageException 292 */ 293 public Boolean toBoolean(String str) throws PageException; 294 295 /** 296 * cast a Object to a boolean value (primitive value type), Exception Less 297 * @param o Object to cast 298 * @param defaultValue 299 * @return casted boolean value 300 */ 301 public boolean toBooleanValue(Object o, boolean defaultValue); 302 303 /** 304 * cast a Object to a boolean value (refrence type), Exception Less 305 * @param o Object to cast 306 * @param defaultValue default value 307 * @return casted boolean reference 308 */ 309 public Boolean toBoolean(Object o,Boolean defaultValue); 310 311 /** 312 * cast a Object to a boolean value (refrence type), Exception Less 313 * @param str String to cast 314 * @param defaultValue default value 315 * @return casted boolean reference 316 */ 317 public Boolean toBoolean(String str, Boolean defaultValue); 318 319 /** 320 * cast a boolean value to a char value 321 * @param b boolean value to cast 322 * @return casted char value 323 */ 324 public char toCharValue(boolean b); 325 326 /** 327 * cast a double value to a char value (primitive value type) 328 * @param d double value to cast 329 * @return casted char value 330 */ 331 public char toCharValue(double d); 332 333 /** 334 * cast a char value to a char value (do nothing) 335 * @param c char value to cast 336 * @return casted char value 337 */ 338 public char toCharValue(char c); 339 340 /** 341 * cast a Object to a char value (primitive value type) 342 * @param o Object to cast 343 * @return casted char value 344 * @throws PageException 345 */ 346 public char toCharValue(Object o) throws PageException; 347 348 /** 349 * cast a Object to a char value (primitive value type) 350 * @param o Object to cast 351 * @param defaultValue 352 * @return casted char value 353 */ 354 public char toCharValue(Object o, char defaultValue); 355 356 /** 357 * cast a boolean value to a Character Object(reference type) 358 * @param b boolean value to cast 359 * @return casted Character Object 360 */ 361 public Character toCharacter(boolean b); 362 363 /** 364 * cast a char value to a Character Object(reference type) 365 * @param c char value to cast 366 * @return casted Character Object 367 */ 368 public Character toCharacter(char c); 369 370 /** 371 * cast a double value to a Character Object(reference type) 372 * @param d double value to cast 373 * @return casted Character Object 374 */ 375 public Character toCharacter(double d); 376 377 /** 378 * cast a Object to a Character Object(reference type) 379 * @param o Object to cast 380 * @param defaultValue 381 * @return casted Character Object 382 */ 383 public Character toCharacter(Object o, Character defaultValue); 384 385 /** 386 * cast a Object to a Character Object(reference type) 387 * @param o Object to cast 388 * @return casted Character Object 389 * @throws PageException 390 */ 391 public Character toCharacter(Object o) throws PageException; 392 393 /** 394 * cast a boolean value to a byte value 395 * @param b boolean value to cast 396 * @return casted byte value 397 */ 398 public byte toByteValue(boolean b); 399 400 /** 401 * cast a double value to a byte value (primitive value type) 402 * @param d double value to cast 403 * @return casted byte value 404 */ 405 public byte toByteValue(double d); 406 407 /** 408 * cast a char value to a byte value (do nothing) 409 * @param c char value to cast 410 * @return casted byte value 411 */ 412 public byte toByteValue(char c); 413 414 /** 415 * cast a Object to a byte value (primitive value type) 416 * @param o Object to cast 417 * @return casted byte value 418 * @throws PageException 419 */ 420 public byte toByteValue(Object o) throws PageException; 421 422 /** 423 * cast a Object to a byte value (primitive value type) 424 * @param o Object to cast 425 * @param defaultValue 426 * @return casted byte value 427 */ 428 public byte toByteValue(Object o, byte defaultValue); 429 430 /** 431 * cast a boolean value to a Byte Object(reference type) 432 * @param b boolean value to cast 433 * @return casted Byte Object 434 */ 435 public Byte toByte(boolean b); 436 437 /** 438 * cast a char value to a Byte Object(reference type) 439 * @param c char value to cast 440 * @return casted Byte Object 441 */ 442 public Byte toByte(char c); 443 444 /** 445 * cast a double value to a Byte Object(reference type) 446 * @param d double value to cast 447 * @return casted Byte Object 448 */ 449 public Byte toByte(double d); 450 451 /** 452 * cast a Object to a Byte Object(reference type) 453 * @param o Object to cast 454 * @return casted Byte Object 455 * @throws PageException 456 */ 457 public Byte toByte(Object o) throws PageException; 458 459 /** 460 * cast a Object to a Byte Object(reference type) 461 * @param o Object to cast 462 * @param defaultValue 463 * @return casted Byte Object 464 */ 465 public Byte toByte(Object o, Byte defaultValue); 466 467 /** 468 * cast a boolean value to a long value 469 * @param b boolean value to cast 470 * @return casted long value 471 */ 472 public long toLongValue(boolean b); 473 474 /** 475 * cast a double value to a long value (primitive value type) 476 * @param d double value to cast 477 * @return casted long value 478 */ 479 public long toLongValue(double d); 480 481 /** 482 * cast a char value to a long value (do nothing) 483 * @param c char value to cast 484 * @return casted long value 485 */ 486 public long toLongValue(char c); 487 488 /** 489 * cast a Object to a long value (primitive value type) 490 * @param o Object to cast 491 * @return casted long value 492 * @throws PageException 493 */ 494 public long toLongValue(Object o) throws PageException; 495 496 /** 497 * cast a Object to a long value (primitive value type) 498 * @param o Object to cast 499 * @param defaultValue 500 * @return casted long value 501 */ 502 public long toLongValue(Object o, long defaultValue); 503 504 /** 505 * cast a boolean value to a Long Object(reference type) 506 * @param b boolean value to cast 507 * @return casted Long Object 508 */ 509 public Long toLong(boolean b); 510 511 /** 512 * cast a char value to a Long Object(reference type) 513 * @param c char value to cast 514 * @return casted Long Object 515 */ 516 public Long toLong(char c); 517 518 /** 519 * cast a double value to a Long Object(reference type) 520 * @param d double value to cast 521 * @return casted Long Object 522 */ 523 public Long toLong(double d); 524 525 /** 526 * cast a Object to a Long Object(reference type) 527 * @param o Object to cast 528 * @return casted Long Object 529 * @throws PageException 530 */ 531 public Long toLong(Object o) throws PageException; 532 533 /** 534 * cast a Object to a Long Object(reference type) 535 * @param o Object to cast 536 * @param defaultValue 537 * @return casted Long Object 538 */ 539 public Long toLong(Object o, Long defaultValue); 540 541 /** 542 * cast a boolean value to a short value 543 * @param b boolean value to cast 544 * @return casted short value 545 */ 546 public short toShortValue(boolean b); 547 548 /** 549 * cast a double value to a short value (primitive value type) 550 * @param d double value to cast 551 * @return casted short value 552 */ 553 public short toShortValue(double d); 554 555 /** 556 * cast a char value to a short value (do nothing) 557 * @param c char value to cast 558 * @return casted short value 559 */ 560 public short toShortValue(char c); 561 562 /** 563 * cast a Object to a short value (primitive value type) 564 * @param o Object to cast 565 * @return casted short value 566 * @throws PageException 567 */ 568 public short toShortValue(Object o) throws PageException; 569 570 /** 571 * cast a Object to a short value (primitive value type) 572 * @param o Object to cast 573 * @param defaultValue 574 * @return casted short value 575 */ 576 public short toShortValue(Object o, short defaultValue); 577 578 /** 579 * cast a boolean value to a Short Object(reference type) 580 * @param b boolean value to cast 581 * @return casted Short Object 582 */ 583 public Short toShort(boolean b); 584 585 /** 586 * cast a char value to a Short Object(reference type) 587 * @param c char value to cast 588 * @return casted Short Object 589 */ 590 public Short toShort(char c); 591 592 /** 593 * cast a double value to a Byte Object(reference type) 594 * @param d double value to cast 595 * @return casted Byte Object 596 */ 597 public Short toShort(double d); 598 599 /** 600 * cast a Object to a Short Object(reference type) 601 * @param o Object to cast 602 * @return casted Short Object 603 * @throws PageException 604 */ 605 public Short toShort(Object o) throws PageException; 606 607 /** 608 * cast a Object to a Short Object(reference type) 609 * @param o Object to cast 610 * @param defaultValue 611 * @return casted Short Object 612 */ 613 public Short toShort(Object o, Short defaultValue); 614 615 /** 616 * cast a String to a boolean value (primitive value type) 617 * @param str String to cast 618 * @return casted boolean value 619 * @throws PageException 620 */ 621 public boolean toBooleanValue(String str) throws PageException; 622 623 /** 624 * cast a String to a boolean value (primitive value type), return 1 for true, 0 for false and -1 if can't cast to a boolean type 625 * @param str String to cast 626 * @param defaultValue 627 * @return casted boolean value 628 */ 629 public boolean toBooleanValue(String str, boolean defaultValue); 630 631 /** 632 * cast a Object to a String 633 * @param o Object to cast 634 * @return casted String 635 * @throws PageException 636 */ 637 public String toString(Object o) throws PageException; 638 639 /** 640 * cast a Object to a String dont throw a exception, if can't cast to a string return a empty string 641 * @param o Object to cast 642 * @param defaultValue 643 * @return casted String 644 */ 645 public String toString(Object o,String defaultValue); 646 647 /** 648 * cast a double value to a String 649 * @param d double value to cast 650 * @return casted String 651 */ 652 public String toString(double d); 653 654 /** 655 * cast a long value to a String 656 * @param l long value to cast 657 * @return casted String 658 */ 659 public String toString(long l); 660 661 /** 662 * cast a int value to a String 663 * @param i int value to cast 664 * @return casted String 665 */ 666 public String toString(int i); 667 668 /** 669 * cast a boolean value to a String 670 * @param b boolean value to cast 671 * @return casted String 672 */ 673 public String toString(boolean b); 674 675 /** 676 * cast a Object to a Array Object 677 * @param o Object to cast 678 * @return casted Array 679 * @throws PageException 680 */ 681 public List toList(Object o) throws PageException; 682 683 /** 684 * cast a Object to a Array Object 685 * @param o Object to cast 686 * @param defaultValue 687 * @return casted Array 688 */ 689 public List toList(Object o, List defaultValue); 690 691 /** 692 * cast a Object to a Array Object 693 * @param o Object to cast 694 * @param duplicate 695 * @return casted Array 696 * @throws PageException 697 */ 698 public List toList(Object o, boolean duplicate) throws PageException; 699 700 /** 701 * cast a Object to a Array Object 702 * @param o Object to cast 703 * @param duplicate 704 * @param defaultValue 705 * @return casted Array 706 */ 707 public List toList(Object o, boolean duplicate, List defaultValue); 708 709 /** 710 * cast a Object to a Array Object 711 * @param obj Object to cast 712 * @return casted Array 713 * @throws PageException 714 */ 715 public Array toArray(Object obj) throws PageException; 716 717 /** 718 * cast a Object to a Array Object 719 * @param obj Object to cast 720 * @param defaultValue 721 * @return casted Array 722 */ 723 public Array toArray(Object obj, Array defaultValue); 724 725 /** 726 * cast a Object to a Map Object 727 * @param o Object to cast 728 * @return casted Struct 729 * @throws PageException 730 */ 731 public Map toMap(Object o) throws PageException; 732 733 /** 734 * cast a Object to a Map Object 735 * @param o Object to cast 736 * @param defaultValue 737 * @return casted Struct 738 */ 739 public Map toMap(Object o, Map defaultValue); 740 741 /** 742 * cast a Object to a Map Object 743 * @param o Object to cast 744 * @param duplicate 745 * @return casted Struct 746 * @throws PageException 747 */ 748 public Map toMap(Object o, boolean duplicate) throws PageException; 749 750 /** 751 * cast a Object to a Map Object 752 * @param o Object to cast 753 * @param duplicate 754 * @param defaultValue 755 * @return casted Struct 756 */ 757 public Map toMap(Object o, boolean duplicate, Map defaultValue); 758 759 /** 760 * cast a Object to a Struct Object 761 * @param o Object to cast 762 * @return casted Struct 763 * @throws PageException 764 */ 765 public Struct toStruct(Object o) throws PageException; 766 767 /** 768 * cast a Object to a Struct Object 769 * @param o Object to cast 770 * @param defaultValue 771 * @return casted Struct 772 */ 773 public Struct toStruct(Object o, Struct defaultValue); 774 775 public Struct toStruct(Object o, Struct defaultValue, boolean caseSensitive); 776 777 /** 778 * cast a Object to a Binary 779 * @param obj Object to cast 780 * @return casted Binary 781 * @throws PageException 782 */ 783 public byte[] toBinary(Object obj) throws PageException; 784 785 /** 786 * cast a Object to a Binary 787 * @param obj Object to cast 788 * @param defaultValue 789 * @return casted Binary 790 */ 791 public byte[] toBinary(Object obj, byte[] defaultValue); 792 793 /** 794 * cast a Object to a Base64 value 795 * @param o Object to cast 796 * @return to Base64 String 797 * @throws PageException 798 */ 799 public String toBase64(Object o) throws PageException; 800 801 /** 802 * cast a Object to a Base64 value 803 * @param o Object to cast 804 * @param defaultValue 805 * @return to Base64 String 806 */ 807 public String toBase64(Object o, String defaultValue); 808 809 /** 810 * cast a boolean to a DateTime Object 811 * @param b boolean to cast 812 * @param tz 813 * @return casted DateTime Object 814 */ 815 public DateTime toDate(boolean b, TimeZone tz); 816 817 /** 818 * cast a char to a DateTime Object 819 * @param c char to cast 820 * @param tz 821 * @return casted DateTime Object 822 */ 823 public DateTime toDate(char c, TimeZone tz); 824 825 /** 826 * cast a double to a DateTime Object 827 * @param d double to cast 828 * @param tz 829 * @return casted DateTime Object 830 */ 831 public DateTime toDate(double d, TimeZone tz); 832 833 /** 834 * cast a Object to a DateTime Object 835 * @param o Object to cast 836 * @param tz 837 * @return casted DateTime Object 838 * @throws PageException 839 */ 840 public DateTime toDate(Object o, TimeZone tz) throws PageException; 841 842 /** 843 * cast a Object to a DateTime Object 844 * @param str String to cast 845 * @param tz 846 * @return casted DateTime Object 847 * @throws PageException 848 */ 849 public DateTime toDate(String str, TimeZone tz) throws PageException; 850 851 /** 852 * cast a Object to a DateTime Object 853 * @param o Object to cast 854 * @param alsoNumbers define if also numbers will casted to a datetime value 855 * @param tz 856 * @param defaultValue 857 * @return casted DateTime Object 858 */ 859 public DateTime toDate(Object o,boolean alsoNumbers, TimeZone tz, DateTime defaultValue); 860 861 /** 862 * cast a Object to a DateTime Object 863 * @param str String to cast 864 * @param alsoNumbers define if also numbers will casted to a datetime value 865 * @param tz 866 * @param defaultValue 867 * @return casted DateTime Object 868 */ 869 public DateTime toDate(String str,boolean alsoNumbers, TimeZone tz, DateTime defaultValue); 870 871 /** 872 * cast a Object to a DateTime Object 873 * @param o Object to cast 874 * @param tz 875 * @return casted DateTime Object 876 * @throws PageException 877 */ 878 public DateTime toDateTime(Object o, TimeZone tz) throws PageException; 879 880 /** 881 * cast a Object to a DateTime Object (alias for toDateTime) 882 * @param o Object to cast 883 * @param tz 884 * @return casted DateTime Object 885 * @throws PageException 886 */ 887 public DateTime toDatetime(Object o, TimeZone tz) throws PageException; 888 889 /** 890 * parse a string to a Datetime Object 891 * @param locale 892 * @param str String representation of a locale Date 893 * @param tz 894 * @return DateTime Object 895 * @throws PageException 896 */ 897 public DateTime toDate(Locale locale,String str, TimeZone tz) throws PageException; 898 899 /** 900 * parse a string to a Datetime Object, returns null if can't convert 901 * @param locale 902 * @param str String representation of a locale Date 903 * @param tz 904 * @param defaultValue 905 * @return datetime object 906 */ 907 public DateTime toDate(Locale locale,String str, TimeZone tz, DateTime defaultValue); 908 909 /** 910 * cast a Object to a Query Object 911 * @param o Object to cast 912 * @return casted Query Object 913 * @throws PageException 914 */ 915 public Query toQuery(Object o) throws PageException; 916 /** 917 * cast a Object to a Query Object 918 * @param o Object to cast 919 * @param defaultValue 920 * @return casted Query Object 921 */ 922 public Query toQuery(Object o, Query defaultValue); 923 924 /** 925 * cast a Object to a Query Object 926 * @param o Object to cast 927 * @param duplicate duplicate the object or not 928 * @return casted Query Object 929 * @throws PageException 930 */ 931 public Query toQuery(Object o, boolean duplicate) throws PageException; 932 933 /** 934 * cast a Object to a Query Object 935 * @param o Object to cast 936 * @param duplicate duplicate the object or not 937 * @param defaultValue 938 * @return casted Query Object 939 */ 940 public Query toQuery(Object o, boolean duplicate, Query defaultValue); 941 942 /** 943 * cast a Object to a UUID 944 * @param o Object to cast 945 * @return casted Query Object 946 * @throws PageException 947 */ 948 public Object toUUId(Object o) throws PageException; 949 950 /** 951 * cast a Object to a UUID 952 * @param o Object to cast 953 * @param defaultValue 954 * @return casted Query Object 955 */ 956 public Object toUUId(Object o, Object defaultValue); 957 958 /** 959 * cast a Object to a Variable Name 960 * @param o Object to cast 961 * @return casted Variable Name 962 * @throws PageException 963 */ 964 public Object toVariableName(Object o) throws PageException; 965 966 /** 967 * cast a Object to a Variable Name 968 * @param obj Object to cast 969 * @param defaultValue 970 * @return casted Variable Name 971 */ 972 public Object toVariableName(Object obj, Object defaultValue); 973 974 /** 975 * cast a Object to a TimeSpan Object (alias for toTimeSpan) 976 * @param o Object to cast 977 * @return casted TimeSpan Object 978 * @throws PageException 979 */ 980 public TimeSpan toTimespan(Object o) throws PageException; 981 982 /** 983 * cast a Object to a TimeSpan Object (alias for toTimeSpan) 984 * @param o Object to cast 985 * @param defaultValue 986 * @return casted TimeSpan Object 987 */ 988 public TimeSpan toTimespan(Object o, TimeSpan defaultValue); 989 990 /** 991 * cast a Throwable Object to a PageException Object 992 * @param t Throwable to cast 993 * @return casted PageException Object 994 */ 995 public PageException toPageException(Throwable t); 996 997 /** 998 * return the type name of a object (string, boolean, int aso.), type is not same like class name 999 * @param o Object to get type from 1000 * @return type of the object 1001 */ 1002 public String toTypeName(Object o); 1003 1004 /** 1005 * cast a value to a value defined by type argument 1006 * @param pc 1007 * @param type type of the returning Value 1008 * @param o Object to cast 1009 * @return casted Value 1010 * @throws PageException 1011 */ 1012 public Object castTo(PageContext pc,String type, Object o) throws PageException; 1013 1014 /** 1015 * cast a value to a value defined by type argument 1016 * @param pc 1017 * @param type type of the returning Value 1018 * @param o Object to cast 1019 * @param alsoPattern mean supporting also none real types like email or creditcard ... 1020 * @return casted Value 1021 * @throws PageException 1022 */ 1023 public Object castTo(PageContext pc,String type, Object o,boolean alsoPattern) throws PageException; 1024 1025 /** 1026 * cast a value to a value defined by type argument 1027 * @param pc 1028 * @param type type of the returning Value (Example: Cast.TYPE_QUERY) 1029 * @param strType type as String 1030 * @param o Object to cast 1031 * @return casted Value 1032 * @throws PageException 1033 */ 1034 public Object castTo(PageContext pc, short type, String strType, Object o) throws PageException; 1035 1036 /** 1037 * cast a value to a value defined by type argument 1038 * @param pc 1039 * @param type type of the returning Value (Example: Cast.TYPE_QUERY) 1040 * @param o Object to cast 1041 * @return casted Value 1042 * @throws PageException 1043 */ 1044 public Object castTo(PageContext pc, short type, Object o) throws PageException; 1045 1046 /** 1047 * cast a value to void (Empty String) 1048 * @param o 1049 * @return void value 1050 * @throws PageException 1051 */ 1052 public Object toVoid(Object o) throws PageException; 1053 1054 /** 1055 * cast a value to void (Empty String) 1056 * @param o 1057 * @param defaultValue 1058 * @return void value 1059 */ 1060 public Object toVoid(Object o, Object defaultValue); 1061 1062 /** 1063 * cast a Object to a reference type (Object), in that case this method to nothing, because a Object is already a reference type 1064 * @param o Object to cast 1065 * @return casted Object 1066 */ 1067 public Object toRef(Object o); 1068 1069 /** 1070 * cast a String to a reference type (Object), in that case this method to nothing, because a String is already a reference type 1071 * @param o Object to cast 1072 * @return casted Object 1073 */ 1074 public String toRef(String o); 1075 1076 /** 1077 * cast a Collection to a reference type (Object), in that case this method to nothing, because a Collection is already a reference type 1078 * @param o Collection to cast 1079 * @return casted Object 1080 */ 1081 public Collection toRef(Collection o); 1082 1083 /** 1084 * cast a char value to his (CFML) reference type String 1085 * @param c char to cast 1086 * @return casted String 1087 */ 1088 public String toRef(char c); 1089 1090 /** 1091 * cast a boolean value to his (CFML) reference type Boolean 1092 * @param b boolean to cast 1093 * @return casted Boolean 1094 */ 1095 public Boolean toRef(boolean b); 1096 1097 /** 1098 * cast a byte value to his (CFML) reference type Boolean 1099 * @param b byte to cast 1100 * @return casted Boolean 1101 */ 1102 public Byte toRef(byte b); 1103 1104 /** 1105 * cast a short value to his (CFML) reference type Integer 1106 * @param s short to cast 1107 * @return casted Integer 1108 */ 1109 public Short toRef(short s); 1110 1111 /** 1112 * cast a int value to his (CFML) reference type Integer 1113 * @param i int to cast 1114 * @return casted Integer 1115 */ 1116 public Integer toRef(int i); 1117 1118 /** 1119 * cast a float value to his (CFML) reference type Float 1120 * @param f float to cast 1121 * @return casted Float 1122 */ 1123 public Float toRef(float f); 1124 1125 /** 1126 * cast a long value to his (CFML) reference type Long 1127 * @param l long to cast 1128 * @return casted Long 1129 */ 1130 public Long toRef(long l); 1131 1132 /** 1133 * cast a double value to his (CFML) reference type Double 1134 * @param d doble to cast 1135 * @return casted Double 1136 */ 1137 public Double toRef(double d); 1138 1139 /** 1140 * cast a Object to a Iterator or get Iterator from Object 1141 * @param o Object to cast 1142 * @return casted Collection 1143 * @throws PageException 1144 */ 1145 public Iterator toIterator(Object o) throws PageException; 1146 1147 /** 1148 * cast a Object to a Collection 1149 * @param o Object to cast 1150 * @return casted Collection 1151 * @throws PageException 1152 */ 1153 public Collection toCollection(Object o) throws PageException; 1154 1155 /** 1156 * cast to a color object 1157 * @param o Object to cast 1158 * @throws PageException 1159 */ 1160 public Color toColor(Object o) throws PageException; 1161 1162 1163 1164 /** 1165 * cast a Object to a Collection, if not returns null 1166 * @param o Object to cast 1167 * @param defaultValue 1168 * @return casted Collection 1169 */ 1170 public Collection toCollection(Object o, Collection defaultValue); 1171 /** 1172 * convert a object to a Resource 1173 * @param obj 1174 * @return File 1175 * @throws PageException 1176 */ 1177 public Resource toResource(Object obj) throws PageException; 1178 1179 /** 1180 * convert a object to a Resource 1181 * @param obj 1182 * @param defaultValue 1183 * @return Resource 1184 */ 1185 public Resource toResource(Object obj, Resource defaultValue); 1186 1187 /** 1188 * convert a object to a File 1189 * @param obj 1190 * @return File 1191 * @throws PageException 1192 */ 1193 public File toFile(Object obj) throws PageException; 1194 1195 1196 /** 1197 * convert a object to a File 1198 * @param obj 1199 * @param defaultValue 1200 * @return File 1201 */ 1202 public File toFile(Object obj, File defaultValue); 1203 1204 /** 1205 * casts a string to a Locale 1206 * @param strLocale 1207 * @return Locale ferom String 1208 * @throws PageException 1209 */ 1210 public Locale toLocale(String strLocale) throws PageException; 1211 1212 /** 1213 * casts a string to a Locale 1214 * @param strLocale 1215 * @param defaultValue 1216 * @return Locale from String 1217 */ 1218 public Locale toLocale(String strLocale, Locale defaultValue); 1219 1220 /** 1221 * casts a Object to a Node List 1222 * @param o Object to Cast 1223 * @return NodeList from Object 1224 * @throws PageException 1225 */ 1226 public NodeList toNodeList(Object o) throws PageException; 1227 1228 /** 1229 * casts a Object to a Node List 1230 * @param o Object to Cast 1231 * @param defaultValue 1232 * @return NodeList from Object 1233 */ 1234 public NodeList toNodeList(Object o, NodeList defaultValue); 1235 1236 /** 1237 * casts a Object to a XML Node 1238 * @param o Object to Cast 1239 * @return Node from Object 1240 * @throws PageException 1241 */ 1242 public Node toNode(Object o) throws PageException; 1243 1244 /** 1245 * casts a Object to a XML Node 1246 * @param o Object to Cast 1247 * @param defaultValue 1248 * @return Node from Object 1249 */ 1250 public Node toNode(Object o, Node defaultValue); 1251 1252 /** 1253 * casts a boolean to a Integer 1254 * @param b 1255 * @return Integer from boolean 1256 */ 1257 public Integer toInteger(boolean b); 1258 1259 /** 1260 * casts a char to a Integer 1261 * @param c 1262 * @return Integer from char 1263 */ 1264 public Integer toInteger(char c); 1265 1266 /** 1267 * casts a double to a Integer 1268 * @param d 1269 * @return Integer from double 1270 */ 1271 public Integer toInteger(double d); 1272 1273 /** 1274 * casts a Object to a Integer 1275 * @param o Object to cast to Integer 1276 * @return Integer from Object 1277 * @throws PageException 1278 */ 1279 public Integer toInteger(Object o) throws PageException; 1280 1281 /** 1282 * casts a Object to a Integer 1283 * @param o Object to cast to Integer 1284 * @param defaultValue 1285 * @return Integer from Object 1286 */ 1287 public Integer toInteger(Object o, Integer defaultValue); 1288 1289 /** 1290 * casts a Object to null 1291 * @param value 1292 * @return to null from Object 1293 * @throws PageException 1294 */ 1295 public Object toNull(Object value) throws PageException; 1296 1297 /** 1298 * casts a Object to null 1299 * @param value 1300 * @param defaultValue 1301 * @return to null from Object 1302 */ 1303 public Object toNull(Object value, Object defaultValue); 1304 1305 /** 1306 * cast Object to a XML Node 1307 * @param value 1308 * @return XML Node 1309 * @throws PageException 1310 */ 1311 public Node toXML(Object value) throws PageException; 1312 1313 /** 1314 * cast Object to a XML Node 1315 * @param value 1316 * @param defaultValue 1317 * @return XML Node 1318 */ 1319 public Node toXML(Object value, Node defaultValue); 1320 1321 1322 /** 1323 * cast to given type 1324 * @param type 1325 * @param o 1326 * @param alsoPattern 1327 * @throws PageException 1328 */ 1329 public Object to(String type,Object o,boolean alsoPattern) throws PageException; 1330 1331 /** 1332 * cast Object to a Serializable Object 1333 * @param obj 1334 * @throws PageException 1335 */ 1336 public Serializable toSerializable(Object obj) throws PageException; 1337 1338 1339 /** 1340 * cast Object to a Serializable Object 1341 * @param object 1342 * @param defaultValue 1343 * @return 1344 */ 1345 public Serializable toSerializable(Object object, Serializable defaultValue); 1346 }