public abstract class ValueObject extends java.lang.Object implements ValueObjectInterface, java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
static int |
defaultTTL
This is the default "time to live".
|
java.util.Locale |
locale
The Locale that this object was created in.
|
static boolean |
traceDefault
Set to true to force connector tracing.
|
static double |
valueForTrue |
ANYTYPE, ARRAYTYPE, BINARYTYPE, BOOLEANTYPE, BYTETYPE, CHARTYPE, DISPLAYVALUE, DOUBLETYPE, FLOATTYPE, GROUP_NAME, INITIALVALUE, INTTYPE, LOG_MESSAGE, LONGTYPE, NAME, OBJECTTYPE, ORDER, PASSWORD_DIGEST, PROPERTYTYPE, QUALITY_BAD, QUALITY_COMM_FAILURE, QUALITY_DEVICE_FAILURE, QUALITY_EGU_EXCEEDED, QUALITY_EVALUATION_EXPIRED, QUALITY_GOOD, QUALITY_IMPOSSIBLE, QUALITY_INITIAL, QUALITY_LAST_USABLE, QUALITY_OUT_OF_SERVICE, QUALITY_PROPERTYONLY, QUALITY_REMOTE_PROXY_INIT, QUALITY_SIMULATED, QUALITY_SOURCE_REMOVED, QUALITY_TRANSITIONAL, QUALITY_UNKNOWN, QUALITY_WARNING, QUALITY_WORST, QUALITY_WRITE_IN_PROGRESS, REQUESTCURRENTVALUE, REQUESTHISTORICAL, SHORTTYPE, STRINGTYPE, TRACE, TWODTYPE, UNSIGNEDBYTETYPE, UNSIGNEDINTTYPE, UNSIGNEDLONGTYPE, UNSIGNEDSHORTTYPE, USER_NAME
Constructor and Description |
---|
ValueObject()
Generic constructor.
|
ValueObject(java.util.Locale locale)
Generic constructor.
|
Modifier and Type | Method and Description |
---|---|
static void |
acquireLatestPropertiesFrom(ValueObjectInterface target,
ValueObjectInterface source1,
ValueObjectInterface source2)
This method will do an "acquirePropertiesFrom" on both the incoming
values.
|
void |
acquirePropertiesFrom(ValueObjectInterface source)
Copies many of the attributes from this object to the target object.
|
java.util.Enumeration<java.lang.String> |
attributeNames()
This will return an enumeration of all the current keys.
|
int |
compareTo(ValueObjectInterface otherValueObject)
This is our implementation (for JDK 1.1 compatibility) of the Comparable
interface of Java 2.
|
ValueObjectInterface |
convertToLowestPrecisionNumber()
This returns the ValueObject unadulterated.
|
int |
decrementTTL()
Decrements and returns the current value of the ttl field.
|
boolean |
equals(java.lang.Object obj)
Compare the string values
|
static java.lang.String |
escapeJSON(java.lang.String original) |
boolean |
getAlwaysSend()
This is if you always want this value to be send to the client...
|
byte[] |
getBinaryValue()
This will return the current value of the ValueObject as a byte array.
|
java.awt.Color |
getColor()
This will return the color associated with the current value.
|
java.util.Date |
getDate()
This is the date and time when the value was created.
|
java.util.Locale |
getLocale()
This method returns the Locale that this object was created in.
|
static ValueObjectInterface |
getLowestPrecisionValueObject(java.lang.String value)
Returns the lowest precision value object that the string can be
converted to.
|
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
Return a copy of the properties map.
|
java.lang.Object |
getProperty(java.lang.String attribute)
This is additional information that is sent with the property.
|
int |
getQuality()
This is the quality of the reading.
|
static java.lang.String |
getQualityString(int quality)
Returns a descriptive string for the given quality.
|
double |
getTime()
this will return the date as a double ((double)date.getTime())/1000
|
long |
getTimeMillis()
This will return the number of milliseconds since Jan 1st 1970.
|
int |
getTTL() |
char |
getType()
Returns a 'C','Z', 'B', 'I', 'F', 'J', 'S', 'D', 'L', or 's' depending on if the
currentValue was set as a char, boolean, byte, int, float, long, short, double, serializable object, or a string.
|
static ValueObjectInterface |
getValueObject(boolean newValue)
Static method that will return a LongValueObject generated from the newValue.
|
static ValueObjectInterface |
getValueObject(byte newValue)
Static method that will return a LongValueObject generated from the newValue.
|
static ValueObjectInterface |
getValueObject(char newValue)
Static method that will return a LongValueObject generated from the newValue.
|
static ValueObjectInterface |
getValueObject(java.awt.Color color)
Static method that will return a GenericValueObject generated from the
Color.
|
static ValueObjectInterface |
getValueObject(double newValue)
Static method that will return a DoubleValueObject generated from the newValue.
|
static ValueObjectInterface |
getValueObject(float newValue)
Static method that will return a DoubleValueObject generated from the newValue.
|
static ValueObjectInterface |
getValueObject(int newValue)
Static method that will return a LongValueObject generated from the newValue.
|
static ValueObjectInterface |
getValueObject(long newValue)
Static method that will return a LongValueObject generated from the newValue.
|
static ValueObjectInterface |
getValueObject(java.lang.Object newValue) |
static ValueObjectInterface |
getValueObject(short newValue)
Static method that will return a LongValueObject generated from the newValue.
|
static ValueObjectInterface |
getValueObject(java.lang.String newValue)
Static method that will return a StringValueObject generated from the newValue.
|
int |
hashCode() |
boolean |
replaces(ValueObjectInterface oldValue,
double deadband)
this is used to determine if we should send this valueobject to
replace oldValue.
|
void |
setAlwaysSend(boolean newValue)
This is if you always want this value to be send to the client...
|
void |
setColor(java.awt.Color newColor)
Sets the color object.
|
void |
setDate(java.util.Date newValue)
This is the date and time when the value was created.
|
void |
setLocale(java.util.Locale locale)
Sets the locale.
|
void |
setProperty(java.lang.String attribute,
java.lang.Object value)
This is additional information that is sent with the property.
|
void |
setQuality(int quality)
This is the quality of the reading.
|
void |
setTimeMillis(long timeMillis)
This will set the time as the number of milliseconds since Jan 1st 1970.
|
void |
setTTL(int ttl) |
void |
setType(char newValue)
This allows people to specify what type a specific subclass represents.
|
static void |
setValueForTrue(double newValue)
This will change the default value for true (when someone creates a valueobject
sending the parameter of true, or the default hi value on a box.
|
static boolean |
shouldTrace(ValueObjectInterface value)
Returns true if the TRACE parameter is set and starts with a 'y' or 'Y'
|
java.lang.String |
toJSON()
Build a json representation of the object, structured:
{
"type": "object"|"array"|"2d",
"value": \
|
java.lang.String |
toJSON(boolean incFormatted,
boolean stringDate)
Build a json representation of the object, structured:
{
"type": "object"|"array"|"2d",
"value": \
|
java.lang.String |
toJSON(boolean incFormatted,
boolean stringDate,
java.lang.String dateFormat)
Build a json representation of the object, structured:
{
"type": "object"|"array"|"2d",
"value": \
|
java.lang.String |
toString()
This will display the value as a string.
|
copy, getBoolValue, getByteValue, getDoubleValue, getFloatValue, getIntValue, getLongValue, getNumericValue, getObjectValue, getShortValue, getStringValue
public static int defaultTTL
ttl
public java.util.Locale locale
public static boolean traceDefault
public static double valueForTrue
public ValueObject()
public ValueObject(java.util.Locale locale)
public static void acquireLatestPropertiesFrom(ValueObjectInterface target, ValueObjectInterface source1, ValueObjectInterface source2)
public void acquirePropertiesFrom(ValueObjectInterface source)
acquirePropertiesFrom
in interface ValueObjectInterface
target
- the target of the copypublic java.util.Enumeration<java.lang.String> attributeNames()
attributeNames
in interface ValueObjectInterface
public int compareTo(ValueObjectInterface otherValueObject)
compareTo
in interface ValueObjectInterface
otherValueObject
- the object to be compared topublic ValueObjectInterface convertToLowestPrecisionNumber()
convertToLowestPrecisionNumber
in interface ValueObjectInterface
StringValueObject
public int decrementTTL()
decrementTTL
in interface ValueObjectInterface
public boolean equals(java.lang.Object obj)
equals
in interface ValueObjectInterface
equals
in class java.lang.Object
public static java.lang.String escapeJSON(java.lang.String original)
public boolean getAlwaysSend()
getAlwaysSend
in interface ValueObjectInterface
ValueObjectInterface.setAlwaysSend(boolean)
public byte[] getBinaryValue()
getBinaryValue
in interface ValueObjectInterface
public java.awt.Color getColor()
getColor
in interface ValueObjectInterface
public java.util.Date getDate()
getDate
in interface ValueObjectInterface
setDate(java.util.Date)
public java.util.Locale getLocale()
getLocale
in interface ValueObjectInterface
public static ValueObjectInterface getLowestPrecisionValueObject(java.lang.String value)
public java.util.Map<java.lang.String,java.lang.Object> getProperties()
public java.lang.Object getProperty(java.lang.String attribute)
getProperty
in interface ValueObjectInterface
attribute
- additional informationsetProperty(java.lang.String, java.lang.Object)
public int getQuality()
getQuality
in interface ValueObjectInterface
ValueObjectInterface.setQuality(int)
public static java.lang.String getQualityString(int quality)
public double getTime()
getTime
in interface ValueObjectInterface
public long getTimeMillis()
getTimeMillis
in interface ValueObjectInterface
public int getTTL()
getTTL
in interface ValueObjectInterface
public char getType()
getType
in interface ValueObjectInterface
public static ValueObjectInterface getValueObject(boolean newValue)
public static ValueObjectInterface getValueObject(byte newValue)
public static ValueObjectInterface getValueObject(char newValue)
public static ValueObjectInterface getValueObject(java.awt.Color color)
getColor
will be
the color parameter as will the value of the value object.color
- the color stored in the value object as well as the value of the objectpublic static ValueObjectInterface getValueObject(double newValue)
public static ValueObjectInterface getValueObject(float newValue)
public static ValueObjectInterface getValueObject(int newValue)
public static ValueObjectInterface getValueObject(long newValue)
public static ValueObjectInterface getValueObject(java.lang.Object newValue)
public static ValueObjectInterface getValueObject(short newValue)
public static ValueObjectInterface getValueObject(java.lang.String newValue)
public int hashCode()
hashCode
in class java.lang.Object
public boolean replaces(ValueObjectInterface oldValue, double deadband)
replaces
in interface ValueObjectInterface
public void setAlwaysSend(boolean newValue)
setAlwaysSend
in interface ValueObjectInterface
newValue
- a boolean setting the "always send" stateValueObjectInterface.getAlwaysSend()
public void setColor(java.awt.Color newColor)
setColor
in interface ValueObjectInterface
newColor
- The color associated with the current value.public void setDate(java.util.Date newValue)
setDate
in interface ValueObjectInterface
getDate()
public void setLocale(java.util.Locale locale)
locale
- The locale to set.public void setProperty(java.lang.String attribute, java.lang.Object value)
setProperty
in interface ValueObjectInterface
attribute
- the attribute Stringvalue
- the Serializable value of this attribute#getValue
public void setQuality(int quality)
setQuality
in interface ValueObjectInterface
quality
- the data qualityValueObjectInterface.getQuality()
public void setTimeMillis(long timeMillis)
setTimeMillis
in interface ValueObjectInterface
public void setTTL(int ttl)
setTTL
in interface ValueObjectInterface
ttl
- The ttl to set.public void setType(char newValue)
setType
in interface ValueObjectInterface
public static void setValueForTrue(double newValue)
public static boolean shouldTrace(ValueObjectInterface value)
public java.lang.String toJSON()
ValueObjectInterface
toJSON
in interface ValueObjectInterface
public java.lang.String toJSON(boolean incFormatted, boolean stringDate)
incFormatted
- true if the string value of this value object is to be provided under the "formattedValue" keystringDate
- if true, the "timestamp" key will be a String of the form "yyyy-MM-dd HH:mm:ss.zzz"public java.lang.String toJSON(boolean incFormatted, boolean stringDate, java.lang.String dateFormat)
incFormatted
- true if the string value of this value object is to be provided under the "formattedValue" keystringDate
- if true, the "timestamp" key will be a String of the form "yyyy-MM-dd HH:mm:ss.zzz"public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 1999-2025 ErgoTech Systems, Inc. All Rights Reserved.