org.starhope.appius.game.intangible
Class ItemTemplate
java.lang.Object
org.starhope.appius.util.ManagedReferenceHolder
org.starhope.appius.util.BaseDatum
org.starhope.appius.game.intangible.ItemTemplate
- All Implemented Interfaces:
- com.sun.sgs.app.ManagedObject, Externalizable, Serializable, CastsToJSON
public class ItemTemplate
- extends BaseDatum
An ItemTemplate represents a "class" of items. Typically, ItemTemplate:s
exist in stores; once purchased, they become SpecificItem:s. Potentially, an
NPC other than a "store" could have ItemTemplate:s as well, for spawning new
SpecificItem:s at need.
- Author:
- brpocock
- See Also:
- Serialized Form
Methods inherited from class org.starhope.appius.util.BaseDatum |
changed, commitToDatabase, delete, equals, flush, get, get, getID, getUniqueBoundName, readExternal, refJSON, setID, sqlDateTime, writeExternal |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
description
private String description
domain
private Domain domain
filename
private String filename
itemType
private ItemType itemType
name
private String name
portrait
private Image portrait
ItemTemplate
public ItemTemplate()
get
public static ItemTemplate get(org.json.JSONObject object)
throws RuntimeException,
NotFoundException,
org.json.JSONException
- Parameters:
object
- the JSON object
- Returns:
- the ItemTemplate object it refers to
- Throws:
org.json.JSONException
- if the JSON data is funky
NotFoundException
- if the object (or some part of it) can't be
found
RuntimeException
- if there's something really bad going on
get
public static ItemTemplate get(String id)
throws RuntimeException,
NotFoundException
- Parameters:
id
- the database ID
- Returns:
- the instantiated ItemTemplate object
- Throws:
NotFoundException
- if the ID isn't found
RuntimeException
- if something strange were to happen
getDescription
public String getDescription()
- Returns:
- the description
getDomain
public Domain getDomain()
- Returns:
- the domain
getFilename
public String getFilename()
- Returns:
- the filename
getItemType
public ItemType getItemType()
- Returns:
- the itemType
getName
public String getName()
- Returns:
- the name
getPortrait
public Image getPortrait()
- Returns:
- the portrait
set
public void set(org.json.JSONObject o)
- Description copied from interface:
CastsToJSON
- This method will attempt to set the data contents of this object
to the values derived from the JSON object being passed-in.
All exceptions are ignored, but any errors in the JSON data could
cause the command to fail, completely or partially.
- Specified by:
set
in interface CastsToJSON
- Overrides:
set
in class BaseDatum
- Parameters:
o
- The JSON object containing a the new data for this
object.- See Also:
CastsToJSON.set(org.json.JSONObject)
setDescription
public void setDescription(String description)
- Parameters:
description
- the description to set
setDomain
public void setDomain(Domain domain)
- Parameters:
domain
- the domain to set
setFilename
public void setFilename(String filename)
throws DataException
- Parameters:
filename
- the filename to set
- Throws:
DataException
- if the filename is not from 1..50 chars
setItemType
public void setItemType(ItemType itemType)
- Parameters:
itemType
- the itemType to set
setName
public void setName(String name)
throws DataException
- Parameters:
name
- the name to set
- Throws:
DataException
- if the name is less than 1 or more than 50 chars
setPortrait
public void setPortrait(Image portrait)
- Parameters:
portrait
- the portrait to set
toJSON
public org.json.JSONObject toJSON()
- Description copied from interface:
CastsToJSON
- This returns a copy of the object's data cast into a JSON form.
- Specified by:
toJSON
in interface CastsToJSON
- Overrides:
toJSON
in class BaseDatum
- Returns:
- The string representing this object in JSON format
- See Also:
BaseDatum.toJSON()
toSpecificItem
public SpecificItem toSpecificItem()
- Returns:
- a specific instance of this type of item