Logo Search packages:      
Sourcecode: libjson-java version File versions

int net::sf::json::JSONArray::getInt ( int  index  )  [inline]

Get the int value associated with an index.

Parameters:
index The index must be between 0 and size() - 1.
Returns:
The value.
Exceptions:
JSONException If the key is not found or if the value cannot be converted to a number. if the value cannot be converted to a number.

Definition at line 1959 of file JSONArray.java.

References getDouble().

Referenced by optInt().

                                  {
      Object o = get( index );
      if( o != null ){
         return o instanceof Number ? ((Number) o).intValue() : (int) getDouble( index );
      }
      throw new JSONException( "JSONArray[" + index + "] is not a number." );
   }


Generated by  Doxygen 1.6.0   Back to index