All reflection and no type safety makes Jack a dull boy...

There has got to be a way of refactoring which takes reflection into account, right? As my project grows larger it's getting crazy trying to remember what needs to be changed when I modify a method name, etc. What are people doing about this? I have code that looks like this:
UpdaterProcessor canUP = new UpdaterProcessor("setCancelSentTime", new Date().getTime() ) ;
Filter f1 = new EqualsFilter("getStatus", OrderStatus.NEW); // only req cxl on NEWs
ConditionalProcessor cp1 = new ConditionalProcessor(f1, canUP);
Order.cache.invoke(o.getID(), cp1);Are people just coding stuff like this by extending abstract classes to avoid reflection or something?
Thanks,
Andrew

There is no type-safe way around this, if you don't want to register every one of the type-safe processor or filter or whatever classes you have to send through the network in the POF configuration (which IS the future).
The safest way to use these processors is to create constants for every method you want to access and use only those constants as extractor names. Alternatively you can create enums instead of constants, and create your extractors instances with the enums passed instead of the method names, and put in a checkstyle or pmd rule which ensures that you don't directly instantiate filters or extractors or etc. with the method names.
Best regards,
Robert

Similar Messages

  • ST03 Export: How to export all instances and task types?

    I am exporting ST03 data using SAP GUI
    I can export data for a single task type and a single instance.Is there a way I can export the Time Profile data for all instances and all task types in a single export? Can I do a single export rather than NxM exports?
    Also, when I export to a text file, there is a header that reports the instance, data, and task type. When I export to excel file I only get the table, not the header info. Is there a way to to get the header info into the excel export?
    Is this the appropriate forum for these questions?
    Any help is appreciated.
    Thanks.
    Tim

    I moved this question to an ABAP forum. Here's the [thread|ST03 Export: How to export all instances and task types?;.
    Tim

  • Reflection and enum types: help needed

    Hello, I just released a new version of my OpenSource project (http://sourceforge.net/projects/jdbcmanager).
    The application needs JRE 1.5 just only for printing tables (JTable.getPrintable(...) method).
    I have had a lot of complains from users due to requiring 1.5
    So I'm trying to make it compatible with 1.4.2 and also provide JTable printing functionality to 1.5 users.
    I can check if JRE in use is 1.5 and then invoke getPrintable(...) method via reflection, but I do not find a way to pass its first argument (an enum) via reflection, because in 1.4.x enum type does not exist, and without solving this the compiler reports a compilation error.
    Here is the code I'm using:String sJavaVer = System.getProperty( "java.version" );
           if( sJavaVer.charAt( 0 ) == '1' && sJavaVer.charAt( 2 ) < '5' )
               MessageFormat mfHeader = new MessageFormat( sHeader );
               MessageFormat mfFooter = new MessageFormat( sFooter );
               Printable     p        = getPrintable( PrintMode.FIT_WIDTH, mfHeader, mfFooter );
               PrintShop     ps       = new PrintShop( p );
               if( bPreview )
                   ps.showPreview( "Preview: "+ sHeader, getPreferredScrollableViewportSize() );
               else
                   ps.print( bPageDialog );
           else
               App.showMessage( "Warning", "You need JRE 1.5.0 or above to be able to print tables." );
           }Obviously this can't compile under 1.4.x
    Every suggestion is more than welcome.

    I haven't worked with 1.5 enums, but my best guess is that you'd have to get instances of the enums via reflection as well.
    As an incidental suggestion: rather than doing a text search on the "java.version" property, you should simply try to retrieve the "getPrintable" method via reflection. The "if" condition then checks to see if you got anything back.

  • Question about java reflection and "int" type

    hi, using reflections I should invoke a Method (meth3) that have as parameter an INT type (not integer). I've tryed with this code:
                        int num = 3;
                        Class[] vettClax = {int.class};
                        Object[] vettParam = {num};
                        Method meth3 = temp.getMethod("meth3", vettClax);
                        meth.invoke(o, vettParam);My problem is that the int value is catched as an Integer value and reflection doesn't found a method that accept an INTEGER as parameter, who can help me?

    Works fine when I try it.
    public class t
        public static void main(String args[])
         throws Exception
         Class temp = t.class;
         t o = new t();
         int num = 3;
         Class[] vettClax = {int.class};
         Object[] vettParam = {num};
         Method meth = temp.getMethod("meth3", vettClax);
         meth.invoke(o, vettParam);
        public void meth3(int n)
         System.out.println("hello " + n);
    }Is your meth3() public?

  • Is there any way to stretch what was recorded as HD from the camera that became SD on FCE back to HD in the project. I have tried all settings and none seem to make any difference. Anamorphic doesn't seem to retain its setting when I set up a new sequenc.

    i am using FCE4

    yes, I recorded straight from camera to computer. The camera is a Sony HDRSR12 and it was set to wide screen it ran through a Canopus ADVC300 via firewire to the computer.
    I burnt some to DVD and if you set the TV screen on widescreen it looked great. But for those still with SD it will be skinny.
    So I am not sure how to get the footage into a widescreen format in a sequence as the anamorphic setting doesn't work for this footage.

  • TS2755 Is there a fix to deleting already deleted address book contact, from messages search? i.e. when you type in say letter c in messages search, all contact with a c, past already deleted and current all appear?  How do you make the old deleted ones a

    Is there a fix to deleting already deleted address book contact, from messages search? i.e. when you type in say letter c in messages search, all contact with a c, past already deleted and current all appear?  How do you make the old deleted ones appear?

    only way is to restore the phone as new.  OR wait until IOS 7 comes out in the fall.

  • How can I delete all the Time Machine backups to make room for more? And how do I force the trash to empty?

    I moved a bunch of my husband's files from his Macbook (which is dieing) to my iMac.  I created a user for him on my iMac so he'd be able to keep his stuff separate from mine.  All is working great except my Time Machine is now unable to backup.  The total of used space on my hard drive (including the recently added user's files) is about 420 GB.  The amount of capacity of my external hard drive is 999GB.  I think Time Machine failed because there was all of a sudden so much more data and a new full backup would be more than the unused capacity of the HD?  Regardless I don't need any old backups.  I have all my files and all his files.  So I moved all the backups from the external HD to the trash.  Apparently that's a no no.  I can't fully empty the trash now and that is making my iMac crazy slow. 
    1) Can anyone tell me how to force the trash to empty?
    2) Is there a way to delete the whole external HD and start over with a new full backup via Time Machine?  In Disk Utility I try to erase the partition and get an error "Volume Erase failed with the error: Couldn't unmount disk." Then I try to Unmount it and get another "Unmount failed. The disk Backup iOmega could not be unmounted.  Make sure that all applications and files are closed on this disk." I turned off Time Machine and tried again but with the same errors.
    The external HD is called iOmega.  It only connects to the iMac with USB.  Any help is much appreciated!!!!

    Try this instead:
    Drive Partition and Format
    1. Open Disk Utility in your Utilities folder.
    2. Select the backup volume from the left side list. Click on the Erase tab in the DU main window.
    3. Set the format type to Mac OS Extended (Journaled.)
    4. Click on the Erase button.
    You will need to reconfigure Time Machine preferences for the backup.
    FYI: Never remove Time Machine backup data except through the Time Machine application. If you aren't sure about using Time Machine then visit Pondini's Time Machine FAQ for help with all things related to Time Machine.

  • My messages on OS mountain lion are apperaring all blank and its not allowing me to send any Imessages, it will let me type it and as soon as i hit enter it disappears somewhere. I have updated my software and this hasn't helped! Thanks

    My messages on OS mountain lion are apperaring all blank and its not allowing me to send any Imessages, it will let me type it and as soon as i hit enter it disappears somewhere. I have updated my software and this hasn't helped! Thanks

    what a long post....Apple, btw, does not read this stuff, so ranting, raving, and complaining here might make you feel good, but it does no good at all. That being said, I, too have a Mac Pro Quad Core Xeon with 6 gigs of ram and an nVidia 8800 GT graphics card (not as good as yours, alas) and I've had no problems at all with it. Yes, it doesn't have Thunderbolt, but maybe we Mac pro owners will get lucky and someone will come out with an adapter (probably not). No, you probably don't have to throw away your Mac Pro, but if you do, I'll take it, for a small "recycling" fee >:-) That was a joke.  Yes, the Mac Pro's future isn't quite clear, YET. Hopefully that will improve very soon. As for not being able to upgrade to Mountain Lion. Don't worry about that too much, Nobody is forcing you to do that.  Your Mac Pro won't quit working if it isn't installed. From what  I've heard, you should give the new OS a chance, and wait to get it, in case there might be some bugs, or stuff not working with the new OS, which has been known to happen. Yes, we Mac Pro owners don't like being treated like mushrooms-kept in the dark, and being fed......... but Apple is Apple and it will do what it does, and there is nothing you or me can really do to change that. All I can say is....trust, have faith, be patient, go for a walk, do something else to take your mind off of this problem. IF apple decides to drop the Mac Pro for good, and that's a big "IF", I think they will anger a whole bunch of people
    which isn't good. However, that hasn't happened...YET. Let us hope that it doesn't
    John B

  • When I download pictures from my camera, they turn out a nice big size in iPhoto; other pictures that have been e-mailed to me or imported from older libraries/other computers show up small.  Why is this, and how can I make them all the larger size?

    When I download pictures from my digital camera into iPhoto, they turn out a nice large size (usually almost the full screen), but when somebody e-mails me pictures and I import them into iPhoto, or when I transfer old photos from an old library into my new iPhoto library, they turn out very small--not exactly thumbnail-size, but too small to use for calendars or photo books.  I don't know much about computers, so I don't know how this happened.  Also, I can't find any discernible pattern to why this happens with some pictures and not others--ie: what I described above is usually true, but I have had e-mailed photos or old photos turn out the way I want them, which is in the larger size in iPhoto.  Why is this happening, and how can I make all the pictures the larger size?

    Some mail programs, including Apple Mail, can reduce the size of images that are attached to a message. It's happening at the sender's end, and all you can do is ask the sender for a larger image.

  • When I try to same an image under the command 'save as' it will only let me save as file types 'firefox document' or 'all files' and when I try to look at them later they dont work. How can I save an image as the same file type it is on the web site?!

    When I try to save an image under the command 'save as' it will only let me save as file types 'firefox document' or 'all files' and when I try to look at them later they dont work. How can I save an image as the same file type it is on the web site?!
    == This happened ==
    Every time Firefox opened
    == I updated to one of the firefox versions (Not sure which one it was)

    Thanks Alex, but sadly I already tried that. Neither .docx or .xlsx files show up in the content list. They both show as a Chrome HTML document so changing how Firefox addresses those doesn't help since it thinks its the same type of file. I don't think I can manually add files into the "Content Type" left side nav.

  • I have a new computer and I want to make it my home device for I tunes. I have home sharing, and all of the music and files are on the new computer. Now what do I do to make the new computer the home computer for Itunes?

    I have a new computer and I want to make it my home device for I tunes. I have home sharing, and all of the music and files are on the new computer. Now what do I do to make the new computer the home computer for Itunes?

    The computer (windows platform) where I initially began using Itunes has four other computers/devices that are shared with it. All four of the other computers show up in my account, and can be managed. Or I can remove them. But on the new computer that I want to be my base computer (home if you will). The computer I want it to replace, when ITunes is open, has a tool bar, with various functions. All of the other devices are linked to that computer in ITunes, under Home SHaring. The new computer, shows the downloads via Home Sharing, but it does not show/have any tool bar.
    I want to activate the new computer to be the computer via ITunes where all of the devices are linked to it as the base for ITunes. And, I don't know how to make that happen.
    I hope that makes sense.

  • If I was to get a new computer and transfer all my music from my itunes on my old computer to hard drive then to my new computer and itunes, could I make a new itunes account on my new computer and still be able to use my old songs?

    If I was to get a new computer and transfer all my music from my itunes on my old computer to hard drive then to my new computer and itunes, could I make a new itunes account on my new computer and still be able to use my old songs?
    I am getting a new computer and I know I can transfer my music on my old computer to my new one with a hard drive but me and brother currently share an account and I would like my own, once I get a new computer can I make a new account on my new itunes and still be able to keep my old music and be able to sync it and play it etc?? Anyone with information on this would be muchly appreciated!!! Thank you in advance! Oh and I currently have a windows but will be getting a mac book pro most likely

    The music sync is one one way - computer to ipod.  The exception is itunes purchases.  File>Transfer Purchases
    Have you failed to maintain a backup copy of your computer?

  • My photos are in the wrong albums and some photos are missing all together. How can I make them go back to their correct albums?

    iTunes is placing my photos in the wrong albums and some photos are missing all together. How can I make them go to their correct albums?

    Nevermind. I just renamed the folder on my mac and synced it again and everything is now in its proper place.

  • I have a mac osX 10.5.8 and i could always make photo books with iphoto , now all of a sudden i cant because i have iphoto version 7.1.5 i have tried countless updates and nothing is working ? help ?

    i have a mac osX 10.5.8 and i could always make photo books with iphoto , now all of a sudden i cant because i have iphoto version 7.1.5 i have tried countless updates and nothing is working ? help ?

    Books are no longer supported with iPhoto '08 (a roughly six yeal old product) - you can purchase an iLife '09 DVD from someplace like Amazon or eBay and install it - iPhoto '09 is still supported this year
    LN

  • Best way to make a menu that shows up on all pages and that's easy to add links to later?

    Hi everyone, first post on the forums.  I am very new to using Dreamweaver and making web pages in general, so bear with me
    Here's what I want to do:
    1. Make a web site with a menu bar on the left with about 30 links.
    2. All 30 links go to different pages on the same website, and each page has the exact same layout, only the body text is different (same placement of advertising, menu, etc.)
    3. I want to be able to add links to that menu quickly and easily.
    In other words, I basically want to just make one static menu that shows up the same  way on each page of my site.
    Now, how I am thinking is best to do this is to make one menu its own page (in its own frame??) and just have each page on my site link to that menu, so that whenever I want to update the menu, I don't have to update the static menu on each page of my website, only the one menu.html or whatever.
    This is probably the easiest thing in the world to do and I'm probably not using the proper terminology or anything, but I hope that I have explained myself clearly.
    Please respond if you have any ideas about how to accomplish this.  Thank you!

    While Breqent is right that server side includes are the best way of doing this if you aren't up on
    server side coding then you can use Dreamweaver to manage you menu.
    You do this by simply ensuring you never edit the menu area on any individual page.
    It should therefore be identical on all page and as such you can just use find and replace across the entire site or folder to edit all occurances of your menu.
    I hope this helps.
    Andy
    Best Reception

Maybe you are looking for