com.codestreet.messageforge
Class RFldTibrvIPAddr

java.lang.Object
  extended bycom.codestreet.messageforge.RFld
      extended bycom.codestreet.messageforge.RFldTibrvIPAddr
All Implemented Interfaces:
RFldInterface, java.io.Serializable

public class RFldTibrvIPAddr
extends RFld

Class to represent a TibrvIPAddr field.

Author:
Jawaid Hakim.
See Also:
TibrvIPAddr, Serialized Form

Field Summary
protected  com.tibco.tibrv.TibrvIPAddr dataObj_
          Data.
protected static java.lang.String XML_TAG
          XML tag for this element type.
 
Fields inherited from class com.codestreet.messageforge.RFld
desc_, fieldId_, locked_, name_, optional_, propertyName_, tags_, transient_, valSet_
 
Constructor Summary
RFldTibrvIPAddr()
          Default constructor.
RFldTibrvIPAddr(java.lang.String name, int fieldId)
          Constructor.
RFldTibrvIPAddr(java.lang.String name, int fieldId, java.lang.String desc)
          Constructor.
RFldTibrvIPAddr(java.lang.String name, int fieldId, java.lang.String desc, byte[] value)
          Constructor.
RFldTibrvIPAddr(java.lang.String name, int fieldId, java.lang.String desc, byte b1, byte b2, byte b3, byte b4)
          Constructor.
RFldTibrvIPAddr(java.lang.String name, int fieldId, java.lang.String desc, java.net.InetAddress value)
          Constructor.
RFldTibrvIPAddr(java.lang.String name, int fieldId, java.lang.String desc, int value)
          Constructor.
 
Method Summary
 boolean equals(java.lang.Object anObject)
          Check if another field is equal to this field.
 java.lang.String getTag()
          Get the XML tag for this field type.
 RFldType getType()
          Get field type.
 com.tibco.tibrv.TibrvIPAddr getValue()
          Get data.
 java.util.Hashtable getValueAsHashtable()
          Get the field value as a java.util.Hashtable.
 int getValueAsInt()
          Get the field value as an int.
 java.lang.Object getValueAsObject()
          Get the field value as an Object.
 java.lang.String getValueAsString()
          Get the int field value as a String.
 int hashCode()
          Returns the hash code value for the field.
 void reset()
          Reset the field value.
 RFld set(byte[] newData)
          Set data.
 RFld set(org.jdom.Element elem)
          Set the field value from a JDOM element.
 RFld set(java.lang.Object newData)
          Set data.
 RFld set(com.tibco.tibrv.TibrvIPAddr newData)
          Set data.
static void setTag(java.lang.String tag)
          Set the XML tag for this field type.
 void validate()
          Validate against constraints.
 void validate(com.tibco.tibrv.TibrvIPAddr newData)
          Check if a new value will satifsy constraints.
 
Methods inherited from class com.codestreet.messageforge.RFld
addConstraint, buildMinMaxConstraintKey, getConstraint, getConstraintCount, getDesc, getId, getName, getOptional, getPropertyName, getTags, getTransient, isConstrained, isLocked, isProperty, isValSet, marshal, marshal, setId, setLocked, setName, setOptional, setPropertyName, setTags, setTransient, setXmlAttrNames, setXmlTags
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_TAG

protected static transient java.lang.String XML_TAG
XML tag for this element type.


dataObj_

protected com.tibco.tibrv.TibrvIPAddr dataObj_
Data.

Constructor Detail

RFldTibrvIPAddr

public RFldTibrvIPAddr()
Default constructor.


RFldTibrvIPAddr

public RFldTibrvIPAddr(java.lang.String name,
                       int fieldId)
Constructor.

Parameters:
name - Field name.
fieldId - Field id. Field ids must be either 0 to indicate that there is no id on the field, or greater. In addition, field ids must be unique within a messages - no two fields are allowed to have the same field id.

RFldTibrvIPAddr

public RFldTibrvIPAddr(java.lang.String name,
                       int fieldId,
                       java.lang.String desc)
Constructor.

Parameters:
name - Field name.
fieldId - Field id. Field ids must be either 0 to indicate that there is no id on the field, or greater. In addition, field ids must be unique within a messages - no two fields are allowed to have the same field id.
desc - Field description.

RFldTibrvIPAddr

public RFldTibrvIPAddr(java.lang.String name,
                       int fieldId,
                       java.lang.String desc,
                       byte[] value)
                throws FieldValidationException
Constructor.

Parameters:
name - Field name.
fieldId - Field id. Field ids must be either 0 to indicate that there is no id on the field, or greater. In addition, field ids must be unique within a messages - no two fields are allowed to have the same field id.
desc - Field description.
value - Create an IP address from an array of 4 bytes. For aaa.bbb.ccc.ddd, let bytes[0] be the high byte aaa, and bytes[3] be the low byte ddd.

RFldTibrvIPAddr

public RFldTibrvIPAddr(java.lang.String name,
                       int fieldId,
                       java.lang.String desc,
                       java.net.InetAddress value)
                throws FieldValidationException
Constructor.

Parameters:
name - Field name.
fieldId - Field id. Field ids must be either 0 to indicate that there is no id on the field, or greater. In addition, field ids must be unique within a messages - no two fields are allowed to have the same field id.
desc - Field description.
value - Value. No copy is made - be careful when modifying the data.

RFldTibrvIPAddr

public RFldTibrvIPAddr(java.lang.String name,
                       int fieldId,
                       java.lang.String desc,
                       int value)
                throws FieldValidationException
Constructor.

Parameters:
name - Field name.
fieldId - Field id. Field ids must be either 0 to indicate that there is no id on the field, or greater. In addition, field ids must be unique within a messages - no two fields are allowed to have the same field id.
desc - Field description.
value - Value. No copy is made - be careful when modifying the data.

RFldTibrvIPAddr

public RFldTibrvIPAddr(java.lang.String name,
                       int fieldId,
                       java.lang.String desc,
                       byte b1,
                       byte b2,
                       byte b3,
                       byte b4)
                throws FieldValidationException
Constructor. Create an IP address from these 4 bytes. For aaa.bbb.ccc.ddd, let b1 be the high byte aaa, and b4 be the low byte ddd.

Parameters:
name - Field name.
fieldId - Field id. Field ids must be either 0 to indicate that there is no id on the field, or greater. In addition, field ids must be unique within a messages - no two fields are allowed to have the same field id.
desc - Field description.
b1 - High byte.
b2 - Byte 2.
b3 - Byte 3.
b4 - Low byte.
Method Detail

getType

public final RFldType getType()
Get field type.

Specified by:
getType in interface RFldInterface
Specified by:
getType in class RFld
Returns:
Field type IPADDR32.
See Also:
RFldType

equals

public boolean equals(java.lang.Object anObject)
Check if another field is equal to this field. Equality is defined as the fields having the same value.

Specified by:
equals in class RFld
Parameters:
anObject - Another field.
Returns:
true if another field is equal to this field. Otherwise, returns false.

hashCode

public int hashCode()
Returns the hash code value for the field.

Specified by:
hashCode in class RFld
Returns:
a hash code value for the field, delegate to the value of int TibrvIPAddr.getAddr() method.

reset

public void reset()
           throws FieldValidationException
Reset the field value.

Specified by:
reset in class RFld
Throws:
FieldValidationException
See Also:
RFld.isValSet()

set

public RFld set(java.lang.Object newData)
         throws FieldValidationException
Set data.

Specified by:
set in interface RFldInterface
Specified by:
set in class RFld
Parameters:
newData - New data.
Returns:
Reference to self so method chaining can be used.
Throws:
FieldValidationException

set

public RFld set(byte[] newData)
         throws FieldValidationException
Set data.

Parameters:
newData - New data.
Throws:
FieldValidationException

set

public final RFld set(org.jdom.Element elem)
               throws FieldValidationException
Set the field value from a JDOM element.

Specified by:
set in interface RFldInterface
Specified by:
set in class RFld
Parameters:
elem - Field value as a JDOM element.
Returns:
Reference to self so method chaining can be used.
Throws:
FieldValidationException

set

public RFld set(com.tibco.tibrv.TibrvIPAddr newData)
         throws FieldValidationException
Set data.

Parameters:
newData - New data.
Throws:
FieldValidationException

validate

public void validate()
              throws FieldValidationException
Validate against constraints. A field is valid if either it's value is set and satisfies all constraints, or the the field is optional.

Specified by:
validate in class RFld
Throws:
FieldValidationException

validate

public void validate(com.tibco.tibrv.TibrvIPAddr newData)
              throws FieldValidationException
Check if a new value will satifsy constraints.

Parameters:
newData - New value.
Throws:
FieldValidationException

getValue

public com.tibco.tibrv.TibrvIPAddr getValue()
Get data.

Returns:
data Data. Returns null if the field value is not set.

getValueAsObject

public java.lang.Object getValueAsObject()
Get the field value as an Object.

Returns:
Field value as an Object. Returns null if the field value is not set.

getValueAsString

public java.lang.String getValueAsString()
Get the int field value as a String.

Specified by:
getValueAsString in class RFld
Returns:
Field value as a String. Returns null if the field value is not set.
See Also:
getValueAsInt()

getValueAsInt

public int getValueAsInt()
Get the field value as an int.

Returns:
Field value as an int. Returns -1 if the field value is not set.

getValueAsHashtable

public java.util.Hashtable getValueAsHashtable()
                                        throws FieldValidationException
Get the field value as a java.util.Hashtable. Not supported - throws an exception.

Returns:
Field value as java.util.Hashtable. Returns null if the field value is not set.
Throws:
FieldValidationException

getTag

public final java.lang.String getTag()
Get the XML tag for this field type.

Specified by:
getTag in class RFld
Returns:
XML tag for this field type.

setTag

public static void setTag(java.lang.String tag)
Set the XML tag for this field type.

Parameters:
tag - New XML tag for this field type.


Copyright © 2003-2006 CodeStreet. All Rights Reserved.