Is it possible to find an instance of an object without it being passed to

Hi all,
I have a parser class "MessageParser" which i pass a message which is of type "String" to it for it to be parsed. The parsing method signature for the class is
public void parse(String message);
I need to pass an instance of "Properties" to it but i dont want to change the signature of the method to add a new argument to it. I have been struggling with this for the last couple of days and have tried a couple of options - see http://stackoverflow.com/questions/5134462/sending-in-an-object-of-type-object-instead-of-string-polymorphism
The class that calls the parsing method "ParserManager" knows of the properties object. Is there a way for the MessageParser to find the properties object without it being passed to it?
Thanks
ps - also posted in http://stackoverflow.com/questions/5140795/is-it-possible-to-find-an-instance-of-an-object-without-it-being-passed-to-the-me

ziggy wrote:
I need to pass an instance of "Properties" to it but i dont want to change the signature of the method to add a new argument to it. I have been struggling with this for the last couple of days and have tried a couple of options - see http://stackoverflow.com/questions/5134462/sending-in-an-object-of-type-object-instead-of-string-polymorphism
The class that calls the parsing method "ParserManager" knows of the properties object. Is there a way for the MessageParser to find the properties object without it being passed to it?I completely agree with Kayaman if you can get away with only the passing the Properties once (as he suggests, at construction time).
If you can't (ie, you must pass the Properties with each message), then I suspect you have a new type of Parser, and your design will have to reflect that.
One possibility would be to extend Parser with a PropertiesParser interface that defines a new parse() method and either update the current ParserManager to "understand" the difference, or create a new one.
The problem with the first option is that the manager then becomes a dispatcher, which kind of goes against the grain of OO programming (what if you need to add a third type of parser, or a fourth?).
Another possibility (probably better) would be to create a variant of your MessageObject class that includes Properties, and a variant of your MessageCParser that knows how to deal with such an object.
There are many ways to go, and only you probably know which is best.
That said, if you can get away with passing the Properties once, definitely follow Kayaman's advice.
Winston

Similar Messages

  • Is it possible to bind an instance of a class(Object)

    Hi All
    Is it possible to bind an instance i.e an Object to a name in JNDI and later when
    U look up I should get the same object with the state as of the object when I
    had bound the Object.
    For Ex: Suppose there is a class A having two variables x and y.
    Now I will create an object with name objA using
    A objA = new A();
    objA.setX(2)
    objA.setY(6)
    now I will bind objA to JNDI tree.
    Later I will look up for objA which I had bound.
    now what does objA.getX will return?
    Please clarify my doubt
    Thanks
    Mrutyunjay
    now objA.getX

    ziggy wrote:
    I need to pass an instance of "Properties" to it but i dont want to change the signature of the method to add a new argument to it. I have been struggling with this for the last couple of days and have tried a couple of options - see http://stackoverflow.com/questions/5134462/sending-in-an-object-of-type-object-instead-of-string-polymorphism
    The class that calls the parsing method "ParserManager" knows of the properties object. Is there a way for the MessageParser to find the properties object without it being passed to it?I completely agree with Kayaman if you can get away with only the passing the Properties once (as he suggests, at construction time).
    If you can't (ie, you must pass the Properties with each message), then I suspect you have a new type of Parser, and your design will have to reflect that.
    One possibility would be to extend Parser with a PropertiesParser interface that defines a new parse() method and either update the current ParserManager to "understand" the difference, or create a new one.
    The problem with the first option is that the manager then becomes a dispatcher, which kind of goes against the grain of OO programming (what if you need to add a third type of parser, or a fourth?).
    Another possibility (probably better) would be to create a variant of your MessageObject class that includes Properties, and a variant of your MessageCParser that knows how to deal with such an object.
    There are many ways to go, and only you probably know which is best.
    That said, if you can get away with passing the Properties once, definitely follow Kayaman's advice.
    Winston

  • Find All Instances Scripting

    Hello, I was wondering if there was a way to programatically use the Find All Instances function with scripting?  At the moment my work around is very slow but works.  
    I have a reference to a VI and I have my project open, I then want to find all the places that this VI is used.  At the moment I get all VIs in Memory (Application >> All VIs in Memory), then for each VI I get all SubVIs on the block diagram (Traverse References).  Then for each subVI in each VI in memory, I get the path to the VI and compare it to the path of the VI I want to find.
    As one can imagine this takes too long.  Especially when I can right click my VI's Icon and say Find all Instances and get all 6 instances seemingly instantly.  I searched for a while and couldn't figure out if this was possible or how to do it.  Thanks.
    Attached is my attempt, which just counts the number of times the search VI is called.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.
    Solved!
    Go to Solution.
    Attachments:
    Find All Instances Slow.vi ‏20 KB

    Well that was easy, not sure why I didn't think of that.  In any case I made a new VI that does what you mention and it indeed works much faster.  Attached is the improved version in case someone was interested.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.
    Attachments:
    Find All Instances Faster.vi ‏19 KB

  • How to find bpel instance in 11g based on the index values using Java APIs

    Hi ,
    In SOA10G we had option to find the instances based on the index value using Java APIs like below.
    WhereCondition criteria= new WhereCondition(SQLDefs.CX_index_1 + " = ?");
    criteria.setString(1, "indexValue");
    Locator mLoc = getLocator();
    IInstanceHandle[] foundInstances = mLoc.listInstancesByIndex(criteria);
    Please tell me how to achieve the same functionality in SOA 11G using Java APIs
    Regards,
    Saba

    I have multiple bpel in my composite. I checked in ci_indexes table and it shows the instance number of the bpel process. But the em console is showing only the composite instance number. when I opened composite instance, I could see all the bpel process with instance number in the audit trail. How can I find the the actual composite instance number that I should search for in the em console ???

  • Is it possible to find a version of pages to install on 2007 mac mini running lion?

    Can't install the latest system on my mac mini, it's too old.
    Want to install pages to work with files a friend is sending me.
    The app store only shows the current version of pages which requires the current system.
    Is it possible to find an old version of pages to install to run on 10.7.5 ?
    or better yet on 10.6.8? (on which I'm stuck because quicken stuck there)
    Thank you.

    I cannot answer your Pages question, but...
    What type of file is your friend sending you?
    FYI: Quicken 2007 for Macs (Snow Leopard, Lion, Mt. Lion and Mavericks) is available for only $15 download directly from Intuit:
    http://quicken.intuit.com/personal-finance-software/quicken-2007-osx-lion.jsp
    Also, if/when you upgrade, be sure to partition your hard drive or add an external drive and install Lion, Mt. Lion or Mavericks there!
    Keep your Snow Leopard partition and DO NOT install upgrade over it, as the upgrade will destroy the Snow Leopard environment.

  • Using column value is it possible to find the table name in the database?

    Hi all,
    using column value is it possible to find the table name in the database?
    guys i need the table value
    Note:
    oracle-9i
    for example:
    i don't know NIC(column value) in which table in the database.
    Thank you,
    with regards,
    JP.
    Edited by: Guest on Feb 27, 2012 5:42 AM

    Hi,
    As far as I understand what you are asking for I would suggest 4 data dictionaries that will help you to know the table name from the column names
    1. USER_TAB_COLS
    2. ALL_TAB_COLS
    3. DBA_TAB_COLS
    4. COLS
    These can give you detail information about the columns and respective tables at user, schema, dba level. Further information on the table can be found by querying ALL_OBJECTS table giving table_name as Object_name, or you can join the data dictionaries too.
    To know about various data dictionaries avalible in Oracle please query select * from cat;
    Let us know if you need further assistance.
    Twinkle

  • STOLEN IPHONE - IS IT POSSIBLE TO FIND IT?

    Is it possible to find my stolen iPhone through the imie code? using iphone makes sense when you have an Apple ID. Is it possible to find my iPhone through IMEI if someone restored the pjone and connected it to a new Apple ID? That would mean that one IMEI is in two Apple Accounts. Is it possible to find out that?
    Second question - I didn't have Find My Phone software on the stolen iPhone, but installed it on another (old one i have) and it showed both iphones the old one i am using now and the stolen one. The fact that the stolen device appears in my account means that the phone has not been restored or it could have been restored and now works in another account?
    Thanks for information in advance.

    Dear AnaMusic,
    I read the infomration in the link you sent me, but there is no information about the option 'report a stolen device'. I can't see any option like that one. I can see only that I can look for it through 'Find My iPhone' application, which, I heard, is useless if the telephone has been restored.
    Where can I report a stolen iphone?
    regards,
    Martin

  • Is it possible to send a instance to error hospital for business errors?

    I have a business cenario where if an error is returned from an external service the first time it will automatically retry. The second time it will need to be sent for manual resolution which I was thinking of doing in the error hospital (human intervention) does anyone know if it is possible to send an instance for human-intervention from within the process rather from the fault policies?

    We have an instance where sometimes we are sending embedded tiff images to an external service and if the image is corrupt we need to allow the users to terminate the process. Unfrotunately there are no capabilities to send any notifications (email/sms/fax/voicemail) and need to notify the user of the corrupt image and to terminate the process. We could use a worklist task and but the business have defined this as a support team responsibility and want to use the same manual recovery console for all errors. (activities tab)

  • Is it possible to find out the names of the various objects (jpegs, pdf's, etc) in a keynote presentation?

    I have to re do a keynote presentation for powerpoint -- the export feature won't work on the pc -- it simply says that it wasn't possible to display some of the text and objects because they had become corrupted, and were replaced with blank slides.  I was wondering if it's possible to find out the names of the objects used in the presentation.  That way I could save them to a folder and just paste them in to the PPT version on the PC.  I know they have to be somewhere on the Mac that the presentation was made on, so is it also possible to find out where they would be?
    I tried right clicking on the objects in the slide, but there was no 'get info' option, like there is in a finder window.  Please help if you can.
    Chris

    There are a few options for you here. In the Inspector>Metrics Tab, when you click on the picture, it will display the name. Then you can use the find feature of the Finder to locate the picture. If you have Keynote set to save files as Packages, you can right click the file in the Finder (or control click) and then select Show Package Content. This will show you all the files that make up your Keynote and you can copy the pictures out of there into a new folder. Finally, if you can't find them any other way, you can select and copy the picture in Keynote, then open Preview and command-n (or File Menu>New from Clipboard) and then save the file to where ever you want so you can find it.

  • Is it possible to find the Equipment for given PP work center?

    Hello PM Masters,
    Is it possible to find the Equipment for given PP work center?
    Please tell me which table will lend me the EQUNR when I have the PP work center (ARBPL).
    Thank you.

    Yes,
    Provided you maintain this value in Equipment master Location tab like this.
    And then query by this field in IH08
    Jogeswara Rao K

  • Is it possible to find the  table based on the Date ?

    Dear Team ,
    Is it possible to find the table based on the Date ?
    I have created an table ,But forgot the Table Name .
    Is it possible to find the Tables created on particular Date .
    Regards ,
    Augustine

    as date is record the time also below query will work.
    select * from user_objects
    where
    object_type = 'TABLE' and
    to_date(created,'DD-MON-YYYY') =to_date('<your date value in DD-MON-YYYY format>','DD-MON-YYYY');
    Edited by: shaileshM on Feb 24, 2010 9:39 PM

  • Is it possible to find the serial of the last connected device (iPod Nano) in itunes?

    Is it possible to find the serial of the last connected device (iPod Nano) in itunes? Was stolen, trying to get info on my device.

    iTunes will only show the serial number for iOS devices backed up using iTunes (and the iPod nano is not an iOS device). For alternative ways to find the serial number, see:
    On your iPod packaging
    If you still have the original packaging for your iPod, you can find your serial number on the barcode label that's affixed to the packaging.
    On your iPod invoice or receipt
    Some retailers may include the serial number of your iPod on the receipt.
    Online at My Support Profile
    If you used your Apple ID to register or purchase your iPod, you may find the serial number listed in My Support Profile (available in the United States and Canada). Log in with your Apple ID and find your iPod in the My Products box on the main page:
    From iPod: How to find the serial number.

  • Is it possible to find the time a website was visited in safari history?

    Is it possible to find the time a website was visited in safari history?

    See:
    http://www.justanswer.com/computer-programming/7c5qf-iphone-settings-safari-adva nced-website-data.html

  • Is it possible to find the transaction code via table name ??

    Hi
    Can any body please let me know is it possible to find the transaction code via table name ??
    Thanks in advance
    Sesh
    Edited by: seshu_sapfico on Dec 8, 2009 12:21 PM

    Please, specify your requirement... A table could be modified by various programs which are called by numerous transactions.

  • Unable to find the instances in Instance tab

    Hi All ,
    We are unable to find out the instances in the Instance tab in BPEL Console but in Dashboard in
    Recently Completed BPEL Process Instances (More...) we are able to find the instances ..
    We are using 10.1.3.4 with MLR 7 Patch
    Can any one help on this
    Regards,
    Karthik

    Hi Amit Srivastava,
    I am using the WSDL file which is given from Client/Customer. After importing this into Extn Defn, i can see there is no messages in the Message Tab and No messages in the External Definitions.
    My current version of PI is 7.0 where i don't find the option for tools->importExterDefn. and when i am importing this in SOAP UI tool i can see all the messages.
    Please let me know is there steps missing
    Regards,
    Madhu

Maybe you are looking for

  • What now with these license?

    Hi, i got these License Claim:  WEBEX-UWL-BE-PAK - WebEx PAK - CUWL BE Can someone explain, what to do with it? Understand i right, that these are 25 Users for Webex? It was bought together with the Business Edition 6K. What can we use with this lice

  • Why do I have 2 separate charges?

    I have 2 separate charges on my credit card.One for $1 and another for $1.03. I only bought one song so what's with the 2 charges? Sony Vaio   Windows XP  

  • Dynamic Parameters in the Selection screen

    Hi, I want to have a pair of Parameters (Source & Target Field) in the Selection Screen. Is it possible to create more pairs of Parameters by click of a Button or something else? Sinan

  • Best Practises for using Content Types

    We had third party vendor who migrated and re structured contents and sites in Sharepoint 2010. I noticed one unusual thing : In most cases they new separate site content types for every library in a site i.e. even if two libraries contain same set o

  • Why has iCloud stopped working in Mavericks, why has iCloud stopped working in Mavericks

    I have a .me mail account since loading mavericks the site won't load, just sends an erroe message why?