|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.starhope.appius.sql.SQLPeerDatum
org.starhope.appius.sql.SQLPeerEnum
@Deprecated public abstract class SQLPeerEnum
This is a class for infrequently-changed objects that are enumerated types referenced by integer ID columns. Things like the set of available avatar classes fall into this category.
Note to Self: XXX On some future revision, it should be possible to (by contractual enforcement, since I don't think I can enforce this through Java inheritance, but I can put a runtime exception check on it) require implementors to register their class for reload events through a static initialiser and introduce a no-argument constructor.
e.g. ...
protected SQLPeerEnum () { if ( !hasRegisteredClass (this.getClass ())) { throw new RuntimeExceptionAgainstBadImplementation (this .getClass ()); } // ... }
Field Summary | |
---|---|
protected static ConcurrentHashMap<Class<? extends SQLPeerEnum>,ConcurrentHashMap<Integer,String>> |
enumeration
Deprecated. enumeration of all possible values |
private static ConcurrentHashMap<Class<? extends SQLPeerEnum>,Integer> |
hasCached
Deprecated. Index of which classes have been cached already. |
protected int |
instance
Deprecated. instance ID |
private static HashSet<Class<? extends SQLPeerEnum>> |
knownChildren
Deprecated. WRITEME: document this field (brpocock@star-hope.org, Dec 11, 2009) knownChildren (SQLPeerEnum) |
private static long |
serialVersionUID
Deprecated. WRITEME: document this field (brpocock@star-hope.org, Oct 13, 2009) serialVersionUID (long) |
Constructor Summary | |
---|---|
|
SQLPeerEnum(Class<? extends SQLPeerEnum> klass)
Deprecated. WRITEME |
protected |
SQLPeerEnum(Class<? extends SQLPeerEnum> klass,
int id)
Deprecated. WRITEME |
Method Summary | ||
---|---|---|
protected void |
cache(ResultSet set)
Deprecated. This method caches into the internal "enumeration" hashmap the results of an SQL query specific to this SQLPeerEnum class of object. |
|
private void |
doRealCacheReset()
Deprecated. Actually flush the cache for all SQLPeerEnums |
|
static void |
doRealCacheResetStatic()
Deprecated. WRITEME: document this method (brpocock@star-hope.org, Dec 11, 2009) |
|
boolean |
equals(Object o)
Deprecated. This is an overriding method. |
|
boolean |
equals(SQLPeerEnum o)
Deprecated. |
|
static
|
get(Class<T> klass,
int id)
Deprecated. WRITEME: document this method (brpocock@star-hope.org, Nov 19, 2009) |
|
static
|
Get(Class<T> klass,
int id)
Deprecated. use Nomenclator.getDataRecord(Class,int) |
|
static
|
get(Class<T> klass,
String str)
Deprecated. Get an instance of an enumerated type |
|
static
|
Get(Class<T> klass,
String ident)
Deprecated. use Nomenclator.getDataRecord(Class,String) |
|
protected String |
getCacheUniqueID()
Deprecated. This is an overriding method. |
|
protected ConcurrentHashMap<Integer,String> |
getEnumeration()
Deprecated. |
|
int |
getID()
Deprecated. WRITEME: document this method (brpocock@star-hope.org, Aug 14, 2009) |
|
int |
getID(String s)
Deprecated. WRITEME: document this method (brpocock@star-hope.org, Jul 8, 2009) |
|
protected abstract PreparedStatement |
getStatement(Connection connection)
Deprecated. WRITEME: document this method (brpocock@star-hope.org, Aug 14, 2009) |
|
String |
getString()
Deprecated. WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
|
String |
getString(int id)
Deprecated. WRITEME: document this method (brpocock@star-hope.org, Jul 8, 2009) |
|
int |
hashCode()
Deprecated. This is an overriding method. |
|
static void |
invalidateCache()
Deprecated. WRITEME: document this method (brpocock@star-hope.org, Dec 11, 2009) |
|
static void |
invalidateCaches()
Deprecated. WRITEME: document this method (brpocock@star-hope.org, Dec 11, 2009) |
|
protected void |
prepCache()
Deprecated. WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
|
private static void |
registerClass(Class<? extends SQLPeerEnum> klass)
Deprecated. WRITEME: document this method (brpocock@star-hope.org, Dec 11, 2009) |
|
void |
resetCache()
Deprecated. WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009) |
|
void |
set(int id)
Deprecated. WRITEME: document this method (brpocock@star-hope.org, Nov 19, 2009) |
|
void |
set(String str)
Deprecated. Set the contents of the string value of the instance of the enumeration |
|
org.json.JSONObject |
toJSON()
Deprecated. This is an overriding method. |
|
String |
toString()
Deprecated. Create a stringified version of this enumeration. |
Methods inherited from class org.starhope.appius.sql.SQLPeerDatum |
---|
changed, compareTo, findInCache, flush, get, saveInCache, set, set |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final ConcurrentHashMap<Class<? extends SQLPeerEnum>,ConcurrentHashMap<Integer,String>> enumeration
private static final ConcurrentHashMap<Class<? extends SQLPeerEnum>,Integer> hasCached
private static final HashSet<Class<? extends SQLPeerEnum>> knownChildren
private static final long serialVersionUID
protected int instance
Constructor Detail |
---|
public SQLPeerEnum(Class<? extends SQLPeerEnum> klass)
klass
- WRITEMEprotected SQLPeerEnum(Class<? extends SQLPeerEnum> klass, int id)
klass
- WRITEMEid
- the specific IDMethod Detail |
---|
public static void doRealCacheResetStatic()
public static <T extends SQLPeerEnum> T get(Class<T> klass, int id)
T
- WRITEMEklass
- WRITEMEid
- WRITEME
public static <T extends SQLPeerEnum> T get(Class<T> klass, String str)
T
- the enumerated type to getklass
- the enumerated type's class, passed in as a
parameterstr
- the identifying string for that type
@Deprecated public static <T extends DataRecord> T Get(Class<T> klass, int id)
Nomenclator.getDataRecord(Class,int)
T
- classklass
- classid
- ID
@Deprecated public static <T extends DataRecord> T Get(Class<T> klass, String ident)
Nomenclator.getDataRecord(Class,String)
T
- classklass
- classident
- ID
public static void invalidateCache()
public static void invalidateCaches()
private static void registerClass(Class<? extends SQLPeerEnum> klass)
klass
- WRITEMEprotected void cache(ResultSet set) throws SQLException
set
- The ResultSet from the SQL query
SQLException
- if anything goes wrong from the queryprivate void doRealCacheReset()
public boolean equals(Object o)
equals
in class Object
Object.equals(java.lang.Object)
public boolean equals(SQLPeerEnum o)
o
- The other type
Object.equals(Object)
protected String getCacheUniqueID()
getCacheUniqueID
in class SQLPeerDatum
SQLPeerDatum.getCacheUniqueID()
protected ConcurrentHashMap<Integer,String> getEnumeration()
public int getID()
public int getID(String s)
s
- the string value for which to search
protected abstract PreparedStatement getStatement(Connection connection) throws SQLException
connection
- WRITEME
SQLException
- WRITEMEpublic String getString()
public String getString(int id)
id
- The value
public int hashCode()
hashCode
in class Object
Object.hashCode()
protected void prepCache()
public void resetCache()
public void set(int id)
id
- WRITEMEpublic void set(String str)
str
- the new value for this enumerated instancepublic org.json.JSONObject toJSON()
toJSON
in class SQLPeerDatum
SQLPeerDatum.toJSON()
public String toString()
toString
in class Object
Object.toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |