public class ObjectHelper extends Object
ConfigurableObject
or be special-cased. They can optionally rely on a parameter class for
configuration. See the various datatypes in this directory for examples.
Usage example:
// In a hydra configuration file...
objects.SizedStringPrms-size = 1024; // create strings of size 1K
// In one vm...
Object name = ObjectHelper.createName( i );
Object value = ObjectHelper.createObject( "objects.SizedString", i );
cache.put( name, value );
// In a different vm...
Object name = ObjectHelper.createName( i );
Object value = cache.get( name );
ObjectHelper.validate( i, value );
| Constructor and Description |
|---|
ObjectHelper() |
| Modifier and Type | Method and Description |
|---|---|
static Object |
createName(int index)
Generates an object name of type java.lang.String encoding the supplied
index.
|
static Object |
createName(String classname,
int index)
Generates an object key of the specified type encoding the supplied index.
|
static Object |
createObject(String classname,
int index)
Generates an object of the specified type encoding the specified index,
using the settings in the corresponding parameter class for the type, if
any.
|
static int |
getIndex(Object obj)
Returns the index encoded in the object.
|
static long |
getTimestamp(Object obj)
Returns the timestamp encoded in the object, if any.
|
static void |
resetTimestamp(Object obj)
Resets the timestamp encoded in the object to the current time.
|
static void |
update(Object obj)
Updates the object by invoking
UpdatableObject.update(). |
static void |
validate(int index,
Object obj)
Validates whether the index is encoded in the object, if this
applies, and performs other validation checks as needed.
|
public static Object createName(int index)
public static Object createName(String classname, int index)
HydraConfigException - The class could not be found.ObjectCreationException - An error occured when creating the object. See the error
message for more details.public static Object createObject(String classname, int index)
ConfigurableObject.init(int) on the object, if it
applies, otherwise handles specially supported types.HydraConfigException - The class is not a supported type or could not be found.ObjectCreationException - An error occured when creating the object. See the error
message for more details.public static int getIndex(Object obj)
ConfigurableObject.getIndex() on the object, if it
applies, otherwise handles it as a specially supported type.HydraConfigException - The class is not a supported type.ObjectAccessException - An error occured when accessing the object. See the error
message for more details.public static void validate(int index,
Object obj)
ConfigurableObject.validate(int) on the object, if it
applies, otherwise handles it as a specially supported type.HydraConfigException - The class is not a supported type.ObjectAccessException - An error occured when accessing the object. See the error
message for more details.ObjectValidationException - The object failed validation. See the error message for more
details.public static long getTimestamp(Object obj)
TimestampedObject.getTimestamp() on the object, if it
applies, otherwise tries to handle it as a specially supported type.HydraConfigException - The class is not a supported type.ObjectAccessException - An error occured when accessing the object. See the error
message for more details.public static void resetTimestamp(Object obj)
TimestampedObject.resetTimestamp() on the object, if it
applies, otherwise tries to handle it as a specially supported type.HydraConfigException - The class is not a supported type.ObjectAccessException - An error occured when accessing the object. See the error
message for more details.public static void update(Object obj)
UpdatableObject.update().HydraConfigException - The class is not a supported type.ObjectAccessException - An error occured when accessing the object. See the error
message for more details.Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.