Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not sure I entirely understand what you are doing, but from what you wrote it looks like you are creating a new Map_Delegate each time. So you create one object and set the values then you create another object and try to get the values (but by creating a new object the values are initialised to null). You should be calling get on the object you first created, which requires holding a reference to it and passing it around to wherever it is needed.</p> <p>Alternatively it might be that you are trying to implement the Singleton design pattern. Using the Singleton design pattern means that there will only ever be one instance of a given class so you don't need to pass the reference around you can just get it by calling getInstance again. Basically to achieve singleton for your case you would do:</p> <pre><code>public class Map_Delegate { private static Map_Delegate instance; private Map_Delegate() { // Private constructor so nobody can create an instance of your class. } public static Map_Delegate getInstance() { if (instance == null) { instance = new Map_Delegate(); } return instance; } // All the rest of your code can go here. } </code></pre> <p>Now you can do:</p> <pre><code>Map_Delegate a = Map_Delegate.getInstance(); a.setMyName("Name"); // Whatever else. </code></pre> <p>Then later on you can do:</p> <pre><code>Map_Delegate b = Map_Delegate.getInstance(); String name = b.getMyName(); </code></pre> <p>and name won't be null becuase you are using the same instance from before.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload