Collection available to all the classes

Hello,
I am just wondering if I can have a collection of an object and that collection is made available to all the classes rather than creating that collection again and again. For example I am deserializing an object from the file in one of the class, how can I make that object available to all the classes, I don’t want to read it again and again. This can be done easily when using java servlet, but my application is standalone, so is there any way of achieving this?
Any idea will be appreciated.
Many Thanks,

JoachimSauer wrote:
veer2go wrote:
Yeah Thanks mate, do u think, this approach is better or passing the collection through the parameters is better?That question is opening a huge can of worms.
Normally I'd say avoid the static version as much as possible. Pass the Set to all objects that need it.
This could lead to the Set being passed through many levels of calls, 'though. This usually means that your classes are not isolated enough and need to be refactored.
So both solutions can become quite ugly and writing a clean one takes some experience.+1
The assumption that all classes need to see this collection is to be challenged. It's usually made in order to avoid working out exactly what needs the object in question

Similar Messages

  • How to load all the classes in a JAR file at runtime?

    Any clues o:
    "How can I force JVM to load all the classes in a specified JAR at once?"
    Thanx!
    -Rajeev

    Well I was thinking may be there exists an option with "java", when I
    am starting an application from a jar file, I could force it to load all
    the classes in the JAR. I don't want to do it programically. Is there such
    an option available?? Or in other words can I ask JVM to not do the dynamic
    loading for the JAR??
    Thanx.
    List all JarEntries and convert the paths to fully
    qualified class files
    e.g file in jar
    [1] /com/mycompany/proj/X.class
    should become
    [2] com.mycompany.proj.X
    then for each entry issue
    Class.forName( [2] );

  • How to keep track of all the classes/methods/properties created in a long script

    Hi,
    I'm curious to know what method people use to keep track of all the classes, methods, and properties you've created when writing a longer script.
    For quick scripts, this isn't a problem. But for long scripts it can get quite difficult to keep track of all the objects one has created, and all their methods and properties, and overloaded constructors, etc.
    ESTK is great, and it's the IDE I use for InDesign scripting, if only because of it's powerful debugging options.
    But it doesn't provide any way of keeping track of this stuff. No proper Intellisense as in Visual Studio.
    I'd be interested to hear how people solve this issue.

    Hi Ariel,
    Not sure it is relevant to your question but I have an old snippet that collects and displays ExtendScript references using $.list(). This may help to track some object relationships.
    // WARNING: this is just a WIP -- Not tested in all platforms and versions
    $.scanRefs = function scanRefs(/*0|1*/showAll)
        var s = $.list(),
            p = (!showAll) && s.indexOf('[toplevel]'),
            a = ((!showAll) ? s.substr(0,10+p) : s).split(/[\r\n]+/),
            n = a.length,
            // --- Address:1     L:2  Rf:3   Pp:4  Type:5  Name:6
            re = /^([0-9a-z]{8}) (.) +(\d+) +(\d+) (.{10}) (.{1,17})/,
            reTrim = / +$/,
            i, t, k, m,
            refBy, type, name, tag, rest, rfCount, props, j,
            o = {},
            TYPES = {'Function':"FCT", 'Object':"OBJ", 'Array':"ARR", 'RegExp':"REG"};
        for( i=2, refBy=0 ; i < n ; ++i )
            s=a[i];
            while( s && m=s.match(re) )
                k = '&'+m[1].toUpperCase();
                rfCount = parseInt(m[4],10);
                rest = s.substr(m[0].length);
                type = m[5].replace(reTrim,'');
                name = m[6].replace(reTrim,'');
                if( 0x5B==rest.charCodeAt(0) )
                    p = rest.indexOf(']');
                    tag = rest.substr(0,1+p);
                    rest = rest.substr(1+p);
                else
                    tag = '';
                if( 0x20==rest.charCodeAt(0) )
                    rest=rest.substr(1);
                if( p=!(rest.indexOf("referenced by:")) )
                    rest = rest.substr(14);
                o[k] || (o[k] = {
                    locked:        +('L'==m[2]),
                    rfCount:    parseInt(m[3],10),
                    ppCount:    rfCount,
                    type:        TYPES[type]||type,
                    name:        name,
                    tag:        tag,
                    from:        [],
                    order:        -1,
                if( 0 < refBy )
                    if( p || !rest ){ throw "Unable to parse references." }
                    props = rest.split(' ');
                    refBy -= (j=props.length);
                    while( j-- ) t.from.push([k,props[j]]);
                    (props.length=0)||(props=null);
                    rest = '';
                else
                    refBy = rfCount;
                    if( p != !!refBy )
                        if( p ){ throw "Unable to parse references."; }
                        refBy = 0;
                    (t = o[k]).order = n - i;
                (m.length=0)||(m=null);
                s = rest;
        a.length=i=0;
        for( k in o )
            if( !o.hasOwnProperty(k) ) continue;
            a[i++] = k;
        a.sort( function(x,y){return o[x].order-o[y].order;} );
        //a.sort( function(x,y){return parseInt(x.substr(1),16)-parseInt(y.substr(1),16);} );
        var u,
            pngLock = "\x89PNG\r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\x051\xA3K\x91d{(\x8B\xBC\xFE\t\xC1TI!\xE3L\x03\x7F\x00\x00\x00\x00IEND\xAEB`\x82",
            pngNop = "\x89PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x00\x0E\x00\x00\x00\x0E\b\x03\x00\x00\x00(\x96\xDD\xE3\x00\x00\x00\x03PLTE\x00\x00\x00\xA7z=\xDA\x00\x00\x00\x01tRNS\x00@\xE6\xD8f\x00\x00\x00\x15IDATx\xDA\xDD\xC1\x01\x01\x00\x00\x00\x80\x90\xFE\xAF\xF6#\xDA\x01\x00\xD2\x00\x01\xCC \x10\x14\x00\x00\x00\x00IEND\xAEB`\x82",
            w = new Window('dialog', " ExtendScript Memory"),
            p1 = w.add('panel', u, "References"),
            lRefs = p1.add('listbox', u, "",
                numberOfColumns: 4,
                showHeaders: true,
                columnTitles: ["Address", "Type", "Name", "Refs"],
                columnWidths: [90,60,120,36],
            g = w.add('group'),
            pFrom = g.add('panel', u, "From"),
            lFrom = pFrom.add('listbox', u, "",
                numberOfColumns: 4,
                showHeaders: true,
                columnTitles: ["Address", "Type", "Name", "Property"],
                columnWidths: [90,60,120, 120],
            pTo = g.add('panel', u, "To"),
            lTo = pTo.add('listbox', u, "",
                numberOfColumns: 4,
                showHeaders: true,
                columnTitles: ["Property", "Address", "Type", "Name"],
                columnWidths: [120,90,60, 120],
        g.orientation = 'column';
        w.orientation = 'row';
        w.alignChildren = ['left','top'];
        lRefs.maximumSize = lRefs.minimumSize = [330,450];
        lFrom.maximumSize = lFrom.minimumSize = [420,120];
        lTo.maximumSize = lTo.minimumSize = [420,220];
        lRefs.onChange = function()
            lFrom.removeAll();
            lTo.removeAll();
            lFrom.parent.text = "From";
            lTo.parent.text = "To";
            if( !this.selection ) return;
            var key = '&'+this.selection.text,
                t = o[key],
                from = t.from,
                i = from.length,
                k;
            lFrom.parent.text = "["+key.substr(1)+"] is reachable from " + t.ppCount + (1<t.ppCount ? " properties" : " property");
            if( t.ppCount && !i )
                with( lFrom.add('item', '--------') )
                    image = pngNop;
                    subItems[0].text = '';
                    subItems[1].text = '<UNKNOWN REFERRER>';
                    subItems[2].text = '';
            while( i-- )
                k = from[i][0];
                t = o[k];
                with( lFrom.add('item', k.substr(1)) )
                    image = t.locked ? pngLock : pngNop;
                    subItems[0].text = t.type;
                    subItems[1].text = t.name + ' ' + t.tag;
                    subItems[2].text = from[i][1];
            for( k in o )
                if( !o.hasOwnProperty(k) ) continue;
                t = o[k];
                from = o[k].from;
                i = from.length;
                while( i-- )
                    if( from[i][0]!=key ) continue;
                    with( lTo.add('item', from[i][1]) )
                        image = pngNop;
                        subItems[0].text = k.substr(1);
                        subItems[1].text = t.type;
                        subItems[2].text = t.name + ' ' + t.tag;
            lTo.parent.text = "["+key.substr(1)+"]'s properties had access to " + lTo.items.length + " addr.";
            from = t = null;
        for( i=0, n=a.length ; i < n ; ++i )
            t = o[k=a[i]];
            with( lRefs.add('item', k.substr(1)) )
                image = t.locked ? pngLock : pngNop;
                subItems[0].text = t.type;
                subItems[1].text = t.name + ' ' + t.tag;
                subItems[2].text = t.ppCount + '/' + t.rfCount;
        w.show ();
    // TEST
    var t;
    var f = function MyFunc()
        (function MyInnerFunc(){})();
    $.scanRefs(1);
    @+
    Marc

  • I have been a Quicken user for many years but have heard that the move to Yosemite is a Quicken nightmare - so I'm trying to research new software.  I'm overwhelmed by the number of available programs, all the things that each program can do and perp

    I have been a Quicken user for many years but have heard that the move to Yosemite is a Quicken nightmare - so I'm trying to research new software.  I'm overwhelmed by the number of available programs, all the things that each program can do and perplexed by the arguments for and against each feature in each program. 
    My needs are relatively simple for my small business:  1)  I need to be able to import years worth of Quicken data into the new program  2)  I need to easily print checks  3)  I need to easily reconcile my checking account each month and  4)  I need to generate basic reports for my accountant (e.g. P & L statements, category summaries).
    I have been a FileMaker user since 1.0 so I don't need (or want) A/R, A/P, inventory management, invoicing, etc.
    I just need a solid, dependable electronic checkbook per above.
    Suggestions?

    Bobreba wrote:
    I am using Quicken Essentials 1.7.4 on a [Mac Pro, 2.8 Ghz Quad Core Intel Xeon with 16 Gb of memory], running 10.7.5.  I am in the process of upgrading everything to work on Yosemite and Quicken seems to be the most difficult problem to overcome.
    Thanks for your response and feedback.
    I would recommend you continue with Quicken Essentials.  As noted by others, it performs well on Yosemite.
    My personal experience is Quicken 2007 for Mac also on 10.7.5 (with many reports of it both updated and successfully running on Yosemite) and I personally would not touch Quicken Essentials with a 10 foot pole -- BUT, if it ain't broke for you, don't fix it!

  • Linking Equipments to all the classes and characteristics

    Hello Everyone,
    I need a list of all the equipments for a specific technical object type in a given plant with their classes ,characteristics and values.
    I tried to do it with standard list editing IH08, but it restricts me to max of 20 characteristics.
    Can some one help me with an alternative or a query to pull up all the classification info ( classes, characteristics, and characteristic values)
    Thanks in advance
    Sumit

    Hi,
    The work around I am using to overcome this problem is Unzipping th ear/war file created by servicegen task and including all the classes. Then creating the ear file again by creating a new ant target.
    I know this is not a neater way, but this works for me.

  • Adding all the classes and external jars in webservice WAR using servicegen

    Hi,
    Can someone please tell me how do I include all the classes and my external jar files to the ear/war file that is created using servicegen. I don't see any option in servicegen tag where I can include my classes and jar files to the ear/war file. The war it creates only contains the web service implementation class but I want to all the classes in the service code and jars in the same war. Any ideas on how to do that instead of putting in the classpath.
    here is the snippet of my build file
    <servicegen
           destEar="${deploy}/myservice.ear"
           warName="myservice.war">
           <service
             javaClassComponents="com.ws.service.TestService"
             targetNamespace="http://xmlns.test.com/tool/myservice"
             serviceName="myservice"
             serviceURI="/myservice"
             style="document"
             protocol="http"
             expandMethods="True">
           </service>
          <classpath>
            <pathelement path="${classes}"/>
            <pathelement path="${lib}/*.jar"/>
         <pathelement path="C:/bea/weblogic92/server/lib/webserviceclient.jar"/>
          </classpath>      
    </servicegen>
    ..........................Thanks

    Hi,
    The work around I am using to overcome this problem is Unzipping th ear/war file created by servicegen task and including all the classes. Then creating the ear file again by creating a new ant target.
    I know this is not a neater way, but this works for me.

  • Actual Mechanism of Object class as Parent Class to all the classes

    Hi All,
    We know that all the classes in the java platform are descendants of Object class. Even if we are writing a new class also, in the absence of any other explicit superclass, every class is implicitly a subclass of Object. As we are not extending the Object class directly, then how come the methods in the Object are inheriting to the Sub class what we have written? How the java maintain this heirarchy?
    Can you please explain this elaborately?
    Thanks in Advance,
    Uday

    Udaya Shankara Gandhi wrote:
    Hi All,
    We know that all the classes in the java platform are descendants of Object class. Even if we are writing a new class also, in the absence of any other explicit superclass, every class is implicitly a subclass of Object. As we are not extending the Object class directly, then how come the methods in the Object are inheriting to the Sub class what we have written? How the java maintain this heirarchy? Because the language is defined that way. Compilers implement the language according to the rules of the JLS. Exactly how they do that is undefined. It's up to each compiler. As long as it follows the rules defined in the JLS for parsing the code and generating the .class file, that's all that matters. However, somewhere in the compiler is code that does approximately this:
    if (class has an extends clause) {
      generate corresponding bytes for extends in .class file
    else {
      generate bytes for extends java.lang.Object in .class file
    }No great mystery, nor philosophical question.

  • Is it possible to get a count of all the class files in a Flash Builder project?

    Is it possible to get a count of all the class files in a Flash Builder project?
    Thanks!

    Resultsets are one per connection unless you have copied them. Do you have lots of connections are you properly reusing them or at least closing and discarding all references?
    See tutorial and Javadoc of API too

  • How can I know about the latest updates / versions which when available for all the CC products, without having to install and check it with the Desktoip Creative Cloud Application ?

    How can I know about the latest updates / versions which when available for all the CC products, without having to install and check it with the Desktoip Creative Cloud Application ?

    Thanks for looking into this Jeff!
    I work with an Inventory module software and is responsible for software detection across several computers. Once an updated version comes up, I update our database with latest software details to get it detected if installed on any machines.
    The problem tracking updates with Desktop Creative Cloud Software are;
    1)We have to have it installed with the CC applications in-order to get the notification of the latest updates and have to check everyday.
    2)Only relates to the latest updates, so in-between we may miss a prior update unknowingly.Hence, the remote machines having those updates may not get  detected with the software version update which would create problem in reporting.
    3)For all CC products, there is no base or previous updates available for installation if we miss one.
    I went through the Adobe Products Update pages [Product updates] which holds good when it comes to Acrobat and Reader software which I follow to track down any newer updates but this is inconsistent when it comes to CC products like in After Effects CC, Dreamweaver CC etc...
    So overall to be very specific, is there any one channel I can follow to get the notifications only for the updates on CC products and then may be I can rely on Desktop Creative Cloud for installation if not available anywhere like in product update pages of Adobe ?
    Regards,
    Subrat

  • Installed cs6 master collection wont install all the components for photoshop , after effects or FB yet everything else is fine

    installed cs6 master collection wont install all the components for photoshop , after effects or FB yet everything else is fine

    Alanh61734259 are you receiving any specific error messages in the installation log files?  You can find details on how to locate and interpret the installation log files at Troubleshoot with install logs | CS5, CS5.5, CS6, CC.  You are welcome to post any specific errors you discover to this discussion.

  • Cannot re enable the add ons after the new 13.0.1 update ,it shows no update available and all the add-ons are disabled

    cannot re enable the add ons after the new 13.0.1 update ,it shows no update available and all the add-ons are disabled

    I have the same problem. One minute everything was okay, the next minute all my addons were disabled.
    Adobe Acrobat 10.1.3.23
    AVG Site Safety Plugin 11.1.0.4
    Google Update 1.3.21.115
    Java Deployment Toolkit 7.0.50.255 10.5.1.255
    Java Platform SE 7 U5 10.5.1.255
    Shockwave Flash 11.3.300.265
    VLC Web Plugin 2.0.2.0
    Windows Presentation Foundation 3.5.30739.1
    I can reenable them but FF will disable them on the next startup. I uninstalled version 13 and installed version 12. Problem gone! So I'm still using version 12 and am afraid to update to version 13.
    This problem began when I was trying to research and fix a problem (no history all-of-a-sudden) so it probably was something I caused. Can't recall everything I did though.
    So: Does the addon problem I described have a solution? If so, I'll update my version 12 to version 13. Please respond.....

  • When ios5 is going to be available for all the devices ?? ??

    hey, i been waiting for ios5  since forever and i want to know when is it going to be available for all Apple devices !! if you have any info plzz tell me even if it's some randome thoughts. i'll accept it thank you !!

    correct. And once ios5 is on a device it can be synced via wifi to both itunes and the icloud. Softwareupdates over the air. You only need that cable to charge the battery . That makes our devices real independant .

  • How to access all the classes in a jar file

    hai
    i have a custom built JAR file which has many classes(Translets) in it . i want to access the classes inthe JAR file in a JSP page or an servlet. I have tried setting the classpaths etc , but nothing has happened.
    Where should the jar file be Palced - i am using Tomcat Server.
    How Can i Access the class files .. Very Urgent .. Please Help me ..
    Peter Iyer

    What is showing a file not found error? The web browser? if so, that's probably not a problem with the jar file.
    Also, have you expanded your jar file to make sure that you jarred it up correctly?

  • Why is not the E90 available on all the other netw...

    I have a Nokia 9500 on the Orange network. I need to change this quickly because the phone is falling to pieces. However orange have told me that the phone is not available to them. I have sent an email to nokia but they have not replyed & this has been over a month ago. I have tried to locate the phone but the only options availabe to me are either to change to the O2 network which i dont want to do because i have been through them all & for me & my business the best network by far is the Orange network. The other option is to buy this outright & sim free but people are charging from £499 up to £650 which is a complete no no!!! please can anyone tell me why the E90 is not available to the Orange network?
    Kind regards,
    Neil Watson

    This sounds like a question for "Orange" not Nokia forums.
    Have you tried on-line auctions to see if you can get one SIM free and unlocked??
    Also, It would be worth searching these forums just to check that the E90 will do "Exactly" what you want, or maybe buy another 9500?.
    I am not trying to be negative, because I think the E90 most have come from canine decent.... The dogs B......s.
    But, this is my 1st communicator, and I am very very pleased with it so far.
    I would like to think that with another Firmware release, it will be even better? Flash Lite 3 support etc....
    But some previous Comummunicator owners have shown some disapointment with the E90's offerings compared with the 9500 on these forums.
    It is not a cheap device, so making the right choice is worth a bit of research!!
    Some things in life are guaranteed, but can you claim on them?

  • No Master Collection available in ALL of India?

    Hello,
    I'm trying to buy the CS5 Master collection, having recently moved here to India to do some work.
    Now I was pretty surprised to see that there's no seller listed when I'm looking to buy the master collection in India.
    I was even more surprised that I can't even do a download purchase, as India isn't listed in the supported regions.
    I know India isn't a very wealthy country but there are more than 1.2 billion people living here, surely some of them would want to use Adobe products legally? Is there ANY way to actually get the Master Collection without setting my invoice address to 'Singapore' or something like that?
    Update: Setting my country to Singapore doesn't work, I HAVE to be registered in the same country to which I wanna ship. Grrr.....

    Hi There,
    Adobe product resellers are available throughout India. You can start from the alternate purchasing options at http://www.adobe.com/buy/
    In case you need the direct link, please use http://resellers.adobe.com/cgi-bin/user.cgi?country=in&countrycode=in
    Regards,
    Rao Parasa

Maybe you are looking for