public static void insertFromBoolean ( final Boolean booleanValue , final DeviceAttribute deviceAttributeWritten ) throws DevFailed { Integer integerValue = 0 ; if ( booleanValue . booleanValue ( ) ) { integerValue = 1 ; } switch ( deviceAttributeWritten . getType ( ) ) { case TangoConst . Tango_DEV_SHORT : deviceAttributeWritten . insert ( integerValue . shortValue ( ) ) ; break ; case TangoConst . Tango_DEV_USHORT : deviceAttributeWritten . insert_us ( integerValue . shortValue ( ) ) ; break ; case TangoConst . Tango_DEV_CHAR : Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "input type Tango_DEV_CHAR not supported" , "AttributeHelper.insertFromBoolean(Boolean value,deviceAttributeWritten)" ) ; break ; case TangoConst . Tango_DEV_UCHAR : deviceAttributeWritten . insert_uc ( integerValue . shortValue ( ) ) ; break ; case TangoConst . Tango_DEV_LONG : deviceAttributeWritten . insert ( integerValue . intValue ( ) ) ; break ; case TangoConst . Tango_DEV_ULONG : deviceAttributeWritten . insert_ul ( integerValue . longValue ( ) ) ; break ; case TangoConst . Tango_DEV_LONG64 : Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "input type Tango_DEV_LONG64 not supported" , "AttributeHelper.insertFromBoolean(Boolean value,deviceAttributeWritten)" ) ; break ; case TangoConst . Tango_DEV_ULONG64 : deviceAttributeWritten . insert_u64 ( integerValue . longValue ( ) ) ; break ; case TangoConst . Tango_DEV_INT : deviceAttributeWritten . insert ( integerValue . intValue ( ) ) ; break ; case TangoConst . Tango_DEV_FLOAT : deviceAttributeWritten . insert ( integerValue . floatValue ( ) ) ; break ; case TangoConst . Tango_DEV_DOUBLE : deviceAttributeWritten . insert ( integerValue . doubleValue ( ) ) ; break ; case TangoConst . Tango_DEV_STRING : deviceAttributeWritten . insert ( Boolean . toString ( booleanValue . booleanValue ( ) ) ) ; break ; case TangoConst . Tango_DEV_BOOLEAN : deviceAttributeWritten . insert ( booleanValue . booleanValue ( ) ) ; break ; case TangoConst . Tango_DEV_STATE : deviceAttributeWritten . insert ( DevState . from_int ( integerValue . intValue ( ) ) ) ; break ; default : Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "input type " + deviceAttributeWritten . getType ( ) + " not supported" , "AttributeHelper.insertFromBoolean(Boolean value,deviceAttributeWritten)" ) ; break ; } }
Insert data in DeviceAttribute from a Boolean .