KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tctest > spring > bean > SimpleInitializingSingleton


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tctest.spring.bean;
5
6 import org.springframework.beans.factory.InitializingBean;
7
8 import com.tc.aspectwerkz.proxy.Uuid;
9
10 public class SimpleInitializingSingleton implements InitializingBean, ISimpleInitializingSingleton {
11   public static final String JavaDoc ME = "me";
12   private transient long id = System.identityHashCode(this) + Uuid.newUuid();
13
14   public static ISimpleInitializingSingleton afterPropertiesSetThis;
15   private String JavaDoc name;
16
17   public void afterPropertiesSet() throws Exception JavaDoc {
18     afterPropertiesSetThis = this;
19     this.name = ME;
20   }
21
22   public String JavaDoc getName() {
23     return name;
24   }
25   
26   public long getId() {
27     return id;
28   }
29   
30   public long getInnerId() {
31     return afterPropertiesSetThis.getId();
32   }
33   
34   public boolean isTheSameInstance() {
35     return afterPropertiesSetThis == this;
36   }
37 }
38
Popular Tags