|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.commerce.util.PlaceList
public class PlaceList
This class represents a list of places, each of which has a code and an associated display name. For example, you might use this class to store a list of US states together with their two-letter abbreviations, or a list of countries each with a shipping code and a display name.
The class is initialized by providing a list of strings in the property
strings
, alternating codes and display names. For example,
this properties file demonstrates initializing an instance of PlaceList
with a (partial) list of US states:
$class=atg.commerce.util.PlaceList $description=A list of states and territories that we can ship to strings=\ AK, Alaska,\ MA, Massachusetts,\ ME, Maine,\ NH, New Hampshire
places
property and iterating over it with a droplet
like ForEach
. The places
property is an
array, each of whose elements has properties named code
and displayName
.
This example shows how you might use a PlaceList in a JHTML page:
<droplet bean="/atg/dynamo/droplet/ForEach"> <param name="array" value="bean:/com/acme/store/shipping/States.places"> <oparam name="outputStart"> We can ship to the following states:<p> <ol> </oparam> <oparam name="outputEnd"> </ul> </oparam> <oparam name="output"> <li><valueof param="element.code"/> - <valueof param="element.displayName"/> </oparam> <oparam name="empty"> We can't ship anything anywhere. What good are we? </oparam> </droplet>
Nested Class Summary | |
---|---|
static class |
PlaceList.Place
Inner class used to associate a code with a display name to define a single place. |
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
|
protected java.lang.String[] |
mInitStrings
|
protected PlaceList.Place[] |
mPlaces
|
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
PlaceList()
|
Method Summary | |
---|---|
void |
doStartService()
Parse the list of initialization strings from strings
into an array of Place objects and store them in places |
PlaceList.Place |
getPlaceForCode(java.lang.String pCode)
Get the place object that corresponds to the input place code. |
PlaceList.Place[] |
getPlaces()
Get the list of Place objects managed by this object. |
java.lang.String[] |
getStrings()
Get the list of initialization strings provided to this object. |
void |
setStrings(java.lang.String[] pStrings)
Specify the list of places, alternating codes and display names. |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
protected java.lang.String[] mInitStrings
protected PlaceList.Place[] mPlaces
Constructor Detail |
---|
public PlaceList()
Method Detail |
---|
public void setStrings(java.lang.String[] pStrings)
public java.lang.String[] getStrings()
public PlaceList.Place[] getPlaces()
code
and
displayName
.
public void doStartService() throws ServiceException
strings
into an array of Place objects and store them in places
doStartService
in class GenericService
ServiceException
- if the Service had a problem starting uppublic PlaceList.Place getPlaceForCode(java.lang.String pCode)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |