/** * Checks whether or not the value is a Number * * @return true is this value is a number */ public boolean isNumber() { if ( value == null ) { return false; } return value.getType() == VALUE_TYPE_NUMBER; }
/** * Checks whether or not this value is an Integer * * @return true if this value is an integer */ public boolean isInteger() { if ( value == null ) { return false; } return value.getType() == VALUE_TYPE_INTEGER; }
/** * Checks whether or not this value is a boolean * * @return true if this value has type boolean. */ public boolean isBoolean() { if ( value == null ) { return false; } return value.getType() == VALUE_TYPE_BOOLEAN; }
/** * Returns the type of this Value * * @return the type of this Value */ public int getType() { if ( value == null ) { return VALUE_TYPE_NONE; } return value.getType(); }
/** * Checks wheter or not the value is a String. * * @return true if the value is a String. */ public boolean isString() { if ( value == null ) { return false; } return value.getType() == VALUE_TYPE_STRING; }
/** * Checks whether or not this value is a Date * * @return true if the value is a Date */ public boolean isDate() { if ( value == null ) { return false; } return value.getType() == VALUE_TYPE_DATE; }
/** * Checks whether or not the value is a Big Number * * @return true is this value is a big number */ public boolean isBigNumber() { if ( value == null ) { return false; } return value.getType() == VALUE_TYPE_BIGNUMBER; }
/** * Checks whether or not this value is of type Serializable * * @return true if this value has type Serializable */ public boolean isSerializableType() { if ( value == null ) { return false; } return value.getType() == VALUE_TYPE_SERIALIZABLE; }
/** * Checks whether or not this value is of type Binary * * @return true if this value has type Binary */ public boolean isBinary() { // Serializable is not included here as it used for // internal purposes only. if ( value == null ) { return false; } return value.getType() == VALUE_TYPE_BINARY; }
/** * Get the Serializable of this Value. If the Value is not of type Serializable, it returns null. * * @return the Serializable of this Value. */ public Serializable getSerializable() { if ( value == null || isNull() || value.getType() != VALUE_TYPE_SERIALIZABLE ) { return null; } return value.getSerializable(); }
/** * Sets the Value to a String text * * @param str * The StringBuffer to get the text from */ public void setValue( StringBuffer str ) { if ( value == null || value.getType() != VALUE_TYPE_STRING ) { value = new ValueString( str.toString() ); } else { value.setString( str.toString() ); } setNull( str == null ); }
/** * Sets the Value to a String text * * @param str * The StringBuilder to get the text from */ public void setValue( StringBuilder str ) { if ( value == null || value.getType() != VALUE_TYPE_STRING ) { value = new ValueString( str.toString() ); } else { value.setString( str.toString() ); } setNull( str == null ); }
public void setSerializedValue( Serializable ser ) { if ( value == null || value.getType() != VALUE_TYPE_SERIALIZABLE ) { value = new ValueSerializable( ser ); } else { value.setSerializable( ser ); } setNull( ser == null ); }
/** * Sets the Value to a boolean * * @param bool * The boolean to set the Value to */ public void setValue( boolean bool ) { if ( value == null || value.getType() != VALUE_TYPE_BOOLEAN ) { value = new ValueBoolean( bool ); } else { value.setBoolean( bool ); } setNull( false ); }
/** * Sets the Value to a Date * * @param dat * The Date to set the Value to */ public void setValue( Date dat ) { if ( value == null || value.getType() != VALUE_TYPE_DATE ) { value = new ValueDate( dat ); } else { value.setDate( dat ); } setNull( dat == null ); }
/** * Sets the Value to a String text * * @param str * The String to get the text from */ public void setValue( String str ) { if ( value == null || value.getType() != VALUE_TYPE_STRING ) { value = new ValueString( str ); } else { value.setString( str ); } setNull( str == null ); }
/** * Sets the Value to a long integer * * @param l * The long integer to which the Value is set. */ public void setValue( long l ) { if ( value == null || value.getType() != VALUE_TYPE_INTEGER ) { value = new ValueInteger( l ); } else { value.setInteger( l ); } setNull( false ); }
/** * Sets the value to a BigDecimal number value. * * @param num * The number value to set the value to */ public void setValue( BigDecimal num ) { if ( value == null || value.getType() != VALUE_TYPE_BIGNUMBER ) { value = new ValueBigNumber( num ); } else { value.setBigNumber( num ); } setNull( false ); }
/** * Sets the value to a double Number value. * * @param num * The number value to set the value to */ public void setValue( double num ) { if ( value == null || value.getType() != VALUE_TYPE_NUMBER ) { value = new ValueNumber( num ); } else { value.setNumber( num ); } setNull( false ); }
/** * Sets the Value to a byte array * * @param b * The byte array to which the Value has to be set. */ public void setValue( byte[] b ) { if ( value == null || value.getType() != VALUE_TYPE_BINARY ) { value = new ValueBinary( b ); } else { value.setBytes( b ); } if ( b == null ) { setNull( true ); } else { setNull( false ); } }