639 for (int i = fields.length -1; i >= 0; i--){ 640 arg[0] = fields[i].getName(); 641 arg[1] = fields[i].getType(); 642 643 translation[i] = constructor.newInstance(arg); 644 } 645 translatedFields.put(fields, translation); 646 647 } 648 649 return (Object[])translation; 650 } 651 catch(Throwable t){ 652 throw new NoSuchFieldException(); 653 } 654 } 655 656 /* Compare the base class names of streamName and localName. 657 * 658 * @return Return true iff the base class name compare. 659 * @parameter streamName Fully qualified class name. 660 * @parameter localName Fully qualified class name. 661 * @parameter pkgSeparator class names use either '.' or '/'. 662 * 663 * Only compare base class name to allow package renaming. 664 */ 665 static boolean compareClassNames(String streamName, 666 String localName, 667 char pkgSeparator) { 668 /* compare the class names, stripping off package names. */ 669 int streamNameIndex = streamName.lastIndexOf(pkgSeparator); 670 if (streamNameIndex < 0) 671 streamNameIndex = 0; 672 673 int localNameIndex = localName.lastIndexOf(pkgSeparator); 674 if (localNameIndex < 0) 675 localNameIndex = 0; 676 677 return streamName.regionMatches(false, streamNameIndex, 678 localName, localNameIndex, 679 streamName.length() - streamNameIndex); 680 } 681 | 639 for (int i = fields.length -1; i >= 0; i--){ 640 arg[0] = fields[i].getName(); 641 arg[1] = fields[i].getType(); 642 643 translation[i] = constructor.newInstance(arg); 644 } 645 translatedFields.put(fields, translation); 646 647 } 648 649 return (Object[])translation; 650 } 651 catch(Throwable t){ 652 throw new NoSuchFieldException(); 653 } 654 } 655 656 /* Compare the base class names of streamName and localName. 657 * 658 * @return Return true iff the base class name compare. 659 * @param streamName Fully qualified class name. 660 * @param localName Fully qualified class name. 661 * @param pkgSeparator class names use either '.' or '/'. 662 * 663 * Only compare base class name to allow package renaming. 664 */ 665 static boolean compareClassNames(String streamName, 666 String localName, 667 char pkgSeparator) { 668 /* compare the class names, stripping off package names. */ 669 int streamNameIndex = streamName.lastIndexOf(pkgSeparator); 670 if (streamNameIndex < 0) 671 streamNameIndex = 0; 672 673 int localNameIndex = localName.lastIndexOf(pkgSeparator); 674 if (localNameIndex < 0) 675 localNameIndex = 0; 676 677 return streamName.regionMatches(false, streamNameIndex, 678 localName, localNameIndex, 679 streamName.length() - streamNameIndex); 680 } 681 |