public BsonNumber asNumber ( ) { if ( getBsonType ( ) != BsonType . INT32 && getBsonType ( ) != BsonType . INT64 && getBsonType ( ) != BsonType . DOUBLE ) { throw new BsonInvalidOperationException ( format ( "Value expected to be of a numerical BSON type is of unexpected type %s" , getBsonType ( ) ) ) ; } return ( BsonNumber ) this ; }
Gets this value as a BsonNumber if it is one otherwise throws exception