Code for singleton design pattern

Hi,
This is kalyan. Can u provide code for Singleton design pattern.
Thanks in Advance

public class Singleton {
  private Singleton() {
  private static Singleton instance;
  public Singleton getSingleton() {
    if (instance == null) instance = net Singleton();
    return instance;
}Does it make sense?

Similar Messages

  • T code for report  designer

    Hi ,
    Please let me know the t code for report designer.
    Regards
    siddartha

    Hi
    There is no direct Tcode to Query Designer / Report Designer .. You need to go Start -- Programs -- Bex
    You can use Tcode RRMX to reach Query Analyzer.

  • Suggest good book for J2EE Design Pattern.

    Is there any good book for J2EE Design pattern? I know Head First Design Pattern book, but is focuses oncore java. I want to learn in detail with examples J2EE design pattern.
    Please suggest good books.
    Thanks in advance.
    Rahul.

    most j2ee patterns are discredited now. they were mostly workarounds for deficiencies in ejb 1 & 2 specs.
    "core j2ee patterns" is your best bet, but take it with a grain of salt.
    better to learn spring, IMO:
    springframework.org
    %

  • Any good article on Singleton design pattern recently updated.

    Hi,
    Can anyone suggest me a good article on Singleton design pattern recently updated..?
    Thanks in advance.

    Check out the following Singleton Design Pattern Tutorial
    http://www.beginner-java-tutorial.com/singleton.html

  • What is singleton design pattern

    Hi All,
    Anybody please tell me what is Singleton Design Pattern ?
    What is the right definition of it and where can I get the right information about it.
    Please help and reply soon
    Thanks
    Amitindia

    Not meaning to be arrogant: check the topic "Public singleton". It explains what the singleton pattern tries to achieve and show various ways of creating singleton classes.

  • Is there any transaction code for Report Designer,Query Designer and WAD

    HI Gurus,
    please tell me s there any transaction code for
    1 Report Designer
    2 Query Designer
    3 WAD
    Thanks in advance
    Prashant

    Hi Prashant,
    We don't have any Transaction Codes for these.
    Since these are installed along with the SAPLOGON BI components, it cannot be called using a standard transaction.
    You have to use only .
    Goto Start -> Programs -> Business Explorer -> Web Application Designer/Report Designer/Query Designer.
    Hope it helps.
    Reward with points if helpful.
    Regards
    Hemant Khemani
    Edited by: Hemant Khemani on May 16, 2008 5:39 PM

  • Real structures for this design pattern

    Hello , this is my first time posting and I hope to be doing it in the right section. I have a school assignment that says the following: Identify real or abstract structures that could be modeled by the class diagrams represented below: [http://img704.imageshack.us/img704/3523/diagrams.png]
    Upon searching I found out that this is a composite design pattern. I have to implement 2 scenarios for this class system. I was thinking of taking class A (from the uploaded image) to be the Software ( more like a program oriented towards a certain domain like multimedia ), B1,B2 could be an Application/Compiler, and the composite class (D) is an Operating System( because is is usually compiled out of many software (program) pieces) . I want to ask for your opinions on this example because I'm not sure whether this is correct or not. If it isn't could you please give me a real-life example of a correct model ?.

    Roronoa_Zorro wrote:
    Hello , this is my first time posting and I hope to be doing it in the right section. I have a school assignment that says the following: Identify real or abstract structures that could be modeled by the class diagrams represented below: [http://img704.imageshack.us/img704/3523/diagrams.png]
    Upon searching I found out that this is a composite design pattern. I have to implement 2 scenarios for this class system. I was thinking of taking class A (from the uploaded image) to be the Software ( more like a program oriented towards a certain domain like multimedia ), B1,B2 could be an Application/Compiler, and the composite class (D) is an Operating System( because is is usually compiled out of many software (program) pieces) . I want to ask for your opinions on this example because I'm not sure whether this is correct or not. If it isn't could you please give me a real-life example of a correct model ?.Unless your assignment specifically required you to use a computer analogy I would use something else, and even then, I'd still use something else first to understand it better.Since OperatingSystem objects aren't composed with other OperatingSystem objects this doesn't really fit the pattern. Now of course you may be able to run several virtual operating systems inside one but that stretches the example too much for my taste. A directory tree may be seen as an example of the composite pattern -- class A can be a Node, different types of files are specializations of a Node (B1, B2, ...) and are not composable (can't put one file inside another), and a Directory (D) is a Composable specialization of a Node -- it can contain other Nodes. [Edit: I see Saish beat me to the file system analogy]
    With real-world examples you have to be careful as some obvious examples that seem to correspond to computer world, such as containers, boxes, etc, don't actually work, e.g. boxes aren't composable because if box1 fits into box2, then box2 won't fit into box1. Power extension cords and surge protectors are composable extensions of Pluggable class, though not recommended that you take advantage of that feature too much lest you burn your house down. Bags are composable in the real world since they aren't rigid and can be folded up -- class A would just be Object, class B1, B2, etc would be stuff that isn't composable like Apple and Orange, and D would be Bag. You can put Apple, Orange, and Bag instances inside another Bag instance.
    Maybe we should have a contest here -- who can come up with the most creative real-world analogy to the Composite pattern? I know mine are pretty lame.
    Edited by: fromrussiawithjava on Mar 30, 2010 5:36 AM

  • How do I get product key code for Crystal Designer 10

    We've been using the designer for years and it suddenly quit working.  On doing the re-install I'm prompted for product key code and our has expired.  I don't see anywhere else on the site to get this.  Anyone know a link or a support number or a product key code?
    Thank you.

    Maybe try this "Contact Us" Link:
    https://www.sap.com/contactsap/index.epx
    I used it last week for a general inquiry and got an email reply within about 30 minutes.

  • Ask for a design pattern

    Note: THis is a cross post at stackover .
    Got no answer ,so post it here. :)
    We are working on web application with a search model.
    In the search servlet it capture the request parameters from the client, and then build a hibernate-search query for searching.
    Now the problem is the parameters from the clien are mutable!.
    All the parameters we accepts are listed as following:
    1)keyword.
    The keyword(s) using for searching,a search request can be processed even just this parameter is passed. Valid example:
    /search?keyword="test"
    2)lowleftX,lowleftY,upperrightX,upperrightY.
    These four parameter must occur at the same time or never.Since these four paramers are used for a TermRangeQuery in lucene.If one of them occur,the rest three must be occur also. And,these four parameter can occur with the "keyword" at the sametime. Valid example:
    /search?lowleftX=10&lowleftY=10&upperrightX=40&upperrightY=30
    /search?lowleftX=10&lowleftY=10&upperrightX=40&upperrightY=30&keyword="test"
    3)category
    This is used to limit the search scope(just search within the special category).
    4)start,limit
    These two parameters are using for paging.
    5)returnFields
    The returnFields which will be retivived from the index(if it is Stored in the index) and return to the client.
    So I have no idea about how to build the query using the estimate syntax(if....else....if...).
    Anyone can tell me how ?

    using the estimate syntaxNo idea what that means.
    But the steps are.
    1. Parse parameters.
    2. Validate parameters. I would use one method for each step you outlined. Validation must include some way to determine which step failed. For example an exception that says "keyword must have a non-empty value"
    3. Build hibernate query

  • Singleton design pattern doubt

    Hi All,
    I have created a helper class (which is singleton) and this class is having a method which will eventually calls a web service and returns back the result in the form of VO(value object).
    The number of clients accessing this helper class would be very high (approx., 10lakhs hits per hour).
    Is it safe to have singleton? Please let me know. I am not having any member variables defined in the class only methods are present.
    Multiple threads would be sharing methods and not the variable(as I didn't define any member variables).
    Thanks in advance.
    Thanks & Regards,
    Girish.K
    Edited by: Girish.Kgk on May 5, 2010 12:34 AM

    Girish.Kgk wrote:
    Hi All,
    I have created a helper class (which is singleton) and this class is having a method which will eventually calls a web service and returns back the result in the form of VO(value object).
    The number of clients accessing this helper class would be very high (approx., 10lakhs hits per hour). I don't know how big a lakh is, but I bet that 10 lakh/hour is nothing.
    Multiple threads would be sharing methods and not the variable(as I didn't define any member variables).Then thread-safety is not an issue. Thread safety only comes into play when you have multiple concurrent threads accessing shared variables, and only member variables can be shared.

  • Singleton design pattern

    i am a novice in java programming.suppose we create an object in static block of a class,then how to access that object outside that class.

    i want to create only one object in static block and
    (not in static method) and use it in another
    class.how to do it.That is what I have answered. Create a static attribute, initialize it, and create a static method which returns the static attribute.
    Kaj

  • Example for singleton pattern

    Describe a class in the JDK that uses the Singleton design pattern

    I am sorry............... could you please explain a
    class in JDK which follews singleton pattern?
    I was asked this question in an interview yesterday?See reply #2 for a fine example of a potential Singleton object.
    kind regards,
    Jos

  • Design patterns for updating a fact table

    I have a fact table and about 10 dimensions.
    One of these dimensions can be missing values, so the fact table row will link to an UNKNOWN value.
    When the correct value is finally entered in the dimension table i want to update any associated fact rows.
    Whats the most efficient way of doing this?

    I know i have to use a lookup transformation ;-) 
    I wouldnt be at teh stage of even having a fact table if i didnt know that! I was looking for a design pattern, not the name of a shape!
    The solution i went with was to take a hard line on any rows with unknown values. If when importing the data there are unknown values for two of the most important dimensions, those rows are not inserted into the fact table, but instead pushed to an ErrorLog
    table.
    Users run a report that shows what this table contains and if they really want those rows, they insert the correct dimension values and rerun the import, which will only import any rows not already in the fact table.
    This way:
    1. all sorting & filtering issues are resolved as there will be no unknown rows for the most important dimensions used in sorting and filtering.
    2. we can quickly see any rows with unknown values and figure out whats wrong. its always missing reference data that the client didnt think to give us. a quick insert of the dimension data and import and the rows get imported.
    thanks for the replies.

  • ABAP Object X Design Patterns X Extreme Program

    Hi Evebody,
    I’m postgraduate in Object Oriented Analysis and Programming.
    I’ve been working with ABAP procedural development for two years and I’ve started to work with ABAP Objects has few months.
    I’d like to get deeply knowledge in my development’s skills, could someone tell me if <b>ABAP Object X Designer Patterns X Extreme Program</b> is a good path to follow?
    I’d like to share material and guides about this topic.
    I’ve already bought these books to help me.
    <b>ABAP Objects</b> - H. Keller; Hardcover <i>(Pre-Order)</i>
    <b>Design Patterns Explained</b> - Alan Shalloway
    I’ll be very grateful with any help.

    > And do you think these themes are a great combination
    > for ABAP development?
    Design pattern are very abstract and can be used with any OO programming language. The implementations will differ but the core concepts are always the same.
    XP is an agile development process and can also be used with any programming language.
    Learning what design pattern are and how to use them is very important in my opinion. Most companies expect that you are familiar and have experience with them.
    Extreme Programming (XP) on the other side is different. When I began to explore XP it got me started on how software should be developed in general. Since the concepts behind XP are quite different, it should at least stimulate you to start thinking about how you develop software at the moment and if there might be better ways of doing it.
    If you have only time to study one subject go for the design pattern. You might also consider reading the following books if you want to improve your OO coding skills:
    <a href="http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672/ref=pd_bbs_sr_1/102-4989641-7820932?ie=UTF8&s=books&qid=1173448197&sr=8-1">Refactoring: Improving the Design of Existing Code (a true classic)</a>
    <a href="http://www.amazon.com/Refactoring-Patterns-Addison-Wesley-Signature-Kerievsky/dp/0321213351/ref=pd_bbs_sr_2/102-4989641-7820932?ie=UTF8&s=books&qid=1173448197&sr=8-2">Refactoring to Patterns (Shows how to improve code by introducing design pattern)</a>
    cheers
    Thomas

  • Design patterns in log4j

    hi
    i have a question that was asked to me
    what pattern does log4j appender(consoleappender,rollingfileappender etc) implement?
    candidates can be dao, facade etc....
    can somebody xplain what pattern does it use and how
    techy

    actually this question was given in an exam and the
    answer that the teacher gave was proxy pattern.Actually, if you think about it, only the individuals that programmed the log4j code know what design patterns they actually used.
    As an outsider, just because an application "looks" like a pattern might have been used, does not mean it was actually used to design the application.
    Futhermore, just because an application's functionality may fit in well with how one envisions the pattern's possible implementation, this too, does automatically equate or represent the fact that the pattern(s) were used.
    This is a poor question to have on an exam, especailly if the individuals taking the exam were not the ones that worked on log4j. If the exam was given to log4j programmers, then it is a reasonable question.
    To ask this question to assess knowledge/experience with log4j or object-oriented design patterns is a bad decision, in my opinion.
    Only close and detailed inspection of the log4j source code will reveal what design patterns were actually used. Again, to question someone on this is inappropriate, unless it is for the log4j development team, in my opinion.
    i m not able to understand how it applies proxy
    pattern?I understand your confusion.

Maybe you are looking for