org.dps.core.model
Class CachedData
java.lang.Object
org.dps.core.model.CachedData
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- AccountBalance, AccountStatus, Asset, AttributeEnhancement, CalendarEventAttendee, Capsuleer, CharacterAccountBalance, CharacterAssets, CharacterCalendarEventAttendees, CharacterCertificate, CharacterContacts, CharacterMailingLists, CharacterMedal, CharacterMedalList, CharacterResearchAgents, CharacterRole, CharacterSheet, CharacterSkill, CharacterSkillInTraining, CharacterSkillQueue, CharacterStandings, CharacterTitle, CharacterUpcomingCalendarEvents, CombatSetting, Contact, Corporation, CorporationAccountBalances, CorporationAssets, CorporationContacts, CorporationMedal, CorporationMedalSet, CorporationMemberMedal, CorporationMemberMedalList, CorporationMemberSecurity, CorporationMemberTracking, CorporationShareholderList, CorporationSheet, CorporationStandings, CorporationStarbases, CorporationTitle, CorporationTitleSet, Division, FacWarStats, Fuel, HibernateCachedData, MailingList, MemberSecurity, MemberTracking, ResearchAgent, Role, SecurityRole, SecurityTitle, Shareholder, SkillInQueue, Standing, Starbase, StarbaseDetail, UpcomingCalendarEvent
public abstract class CachedData
- extends java.lang.Object
- implements java.io.Serializable
- See Also:
- Serialized Form
Constructor Summary |
CachedData(boolean createAsExpired)
Construct cached data with a choice as to the current expiry setting. |
Method Summary |
long |
expiresIn()
|
java.io.Serializable |
getMeta(java.lang.String key)
Convenience method for accessing meta-data values from the cached data
for this map. |
<K extends java.io.Serializable>
K |
|
getMeta(java.lang.String key,
java.lang.Class<K> clazz)
Another convenient getter which casts the return value to an appropriate
class and returns null if the mapped value can not be cast. |
boolean |
isExpired()
|
void |
putMeta(java.lang.String key,
java.io.Serializable value)
Convenience method for storing a meta-data pair. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
lock
public java.util.concurrent.locks.ReadWriteLock lock
currentTime
public long currentTime
cachedUntil
public long cachedUntil
apiVersion
public int apiVersion
dataMap
public java.util.Map<java.lang.String,java.io.Serializable> dataMap
CachedData
public CachedData(boolean createAsExpired)
- Construct cached data with a choice as to the current expiry setting.
Objects which will sync with the EVE API should be created as expired.
Objects which will never sync with the EVE API should be created as valid
forever (see below).
- Parameters:
createAsExpired
- if true, then currentTime is set to Long.MAX_VALUE and
cachedUntil is set to 0, making this object expired when it is
created. Otherwise, the settings are reversed, making this
object valid forever when it is created.
getMeta
public java.io.Serializable getMeta(java.lang.String key)
- Convenience method for accessing meta-data values from the cached data
for this map.
- Parameters:
key
- the key for the value to retrieve.
- Returns:
- the mapped value or null if the key does not map to any value.
getMeta
public <K extends java.io.Serializable> K getMeta(java.lang.String key,
java.lang.Class<K> clazz)
- Another convenient getter which casts the return value to an appropriate
class and returns null if the mapped value can not be cast.
- Parameters:
key
- the key for the value to retrieve.clazz
- the class to cast the value to.
- Returns:
- the mapped value cast to the appropriate class or null if the
value either doesn't exist or isn't of the appropriate type.
putMeta
public void putMeta(java.lang.String key,
java.io.Serializable value)
- Convenience method for storing a meta-data pair.
- Parameters:
key
- the key for the new pair.value
- the value for the new pair.
isExpired
public boolean isExpired()
expiresIn
public long expiresIn()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object