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

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

Get the long 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.

Definition at line 2010 of file JSONArray.java.

References getDouble().

Referenced by optLong().

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


Generated by  Doxygen 1.6.0   Back to index