|
PenProfile 2.x | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.livescribe.afp.PropertyCollection
public abstract class PropertyCollection
This class manages a set of properties for a penlet. The properties are persisted in a file. The file name is either directly specified or chosen by the system using a given area ID.
It is a good idea to let this class handle the file contents to keep consistency in the future.
Region.getAreaId()| Constructor Summary | |
|---|---|
PropertyCollection()
|
|
| Method Summary | |
|---|---|
abstract boolean |
addProperty(long propId,
Object value)
Adds a property to the collection. |
abstract boolean |
destroy()
Destroys this property collection. |
static boolean |
exists(PenletContext context,
String fileName)
Tests if the specified property file exists. |
static PropertyCollection |
getInstance(PenletContext context,
Region region)
This is a factory method that returns an instance of the requested property collection. |
static PropertyCollection |
getInstance(PenletContext context,
Region region,
boolean createIfNotFound)
This is a factory method that returns an instance of the requested property collection. |
static PropertyCollection |
getInstance(PenletContext context,
String fileName)
This is a factory method that returns an instance of the requested property collection. |
static PropertyCollection |
getInstance(PenletContext context,
String fileName,
boolean createIfNotFound)
This is a factory method that returns an instance of the requested property collection. |
abstract String |
getProperty(long propId)
Gets the value of the specified property. |
abstract int |
getPropertyCount()
Gets the property count. |
abstract int |
removeProperties(int count)
Deprecated. |
abstract boolean |
removeProperty(long propId)
Removes the specified property. |
abstract boolean |
setProperty(long propId,
Object value)
Sets a property value. |
abstract boolean |
setProperty(long propId,
Object value,
boolean overwrite)
Sets a property value. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PropertyCollection()
| Method Detail |
|---|
public static PropertyCollection getInstance(PenletContext context,
String fileName,
boolean createIfNotFound)
createIfNotFound flag is set to
true. If the file does not exist and
createIfNotFound is set to false then this
will return null.
It is common to use an ".xml" suffix for the files.
This will also return null if the file exists but is not
valid.
context - the associated penlet contextfileName - the file to accesscreateIfNotFound - indicates whether to create the file if it is
not found
null on failure.
public static PropertyCollection getInstance(PenletContext context,
String fileName)
It is common to use an ".xml" suffix for the files.
This will return null if the file exists but is not
valid.
context - the associated penlet contextfileName - the file to access
null on failure.
public static PropertyCollection getInstance(PenletContext context,
Region region)
This will return null if the file exists but is not
valid.
context - the associated penlet contextregion - use the area ID from this Region
null on failure.Region.getAreaId()
public static PropertyCollection getInstance(PenletContext context,
Region region,
boolean createIfNotFound)
createIfNotFound flag in the same way as
getInstance(PenletContext, String, boolean).
This will return null if the file exists but is not
valid.
context - the associated penlet contextregion - use the area ID from this Region
null on failure.Region.getAreaId()
public static boolean exists(PenletContext context,
String fileName)
context - the associated penlet contextfileName - the property file name
true if the file exists and false
otherwise.
public abstract boolean addProperty(long propId,
Object value)
false.
The property value will be converted to a string via its
Object.toString() method.
This will return false if the value is null
or the collection has been destroyed.
propId - the 64-bit property IDvalue - the property value, will be converted to a string
public abstract boolean setProperty(long propId,
Object value,
boolean overwrite)
overwrite is set to true.
This will return false if the value is null,
the property was not modified, or if the collection has been
destroyed.
propId - the 64-bit property IDvalue - the new property value, will be converted to a stringoverwrite - indicates whether an existing property should be
overwritten
public abstract boolean setProperty(long propId,
Object value)
This will return false if the value is null
or the collection has been destroyed.
propId - the 64-bit property IDvalue - the new property value
setProperty(long, Object, boolean)public abstract boolean removeProperty(long propId)
This will return false if the collection has been
destroyed.
propId - the 64-bit property ID
public abstract int removeProperties(int count)
This will return zero if the collection has been destroyed.
count - the number of properties to remove
public abstract String getProperty(long propId)
null.
This will return null if the collection has been
destroyed.
propId - the 64-bit property ID
null if the property does
not exist.public abstract boolean destroy()
public abstract int getPropertyCount()
This will return zero if the collection has been destroyed.
|
PenProfile 2.x | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||