Code example for AtomicReference

Methods: compareAndSet, get

0
     * It is public to be able to check if the image is provided. 
     */ 
    public static final Image UNKNOWN_IMAGE = getImageImpl(UNKNOWN_TYPE, null);
     
    public String getDisplayName() {
        if (myDisplayName.get() == null) {
            try { 
                myDisplayName.compareAndSet(null,
                        NbBundle.getMessage(NodeType.class, this.toString()));
            } catch(Exception ex) {
                myDisplayName.compareAndSet(null, name());
            } 
        } 
        return myDisplayName.get();
    } 
     
    public String getHelpId() {
        if (myHelpId == null) {
            myHelpId = HELP_ID_PREFIX + "." + this.toString(); // NOI18N
        } 
        return myHelpId;