private int getIntegerIndex(SoyValue key) {
    try {
      return ((IntegerData) key).integerValue();
    } catch (ClassCastException cce) {
      try {
        // TODO: Remove this old bad behavior after existing code is compliant.
        return Integer.parseInt(key.coerceToString());
      } catch (NumberFormatException nfe) {
        throw new SoyDataException(
            "SoyList accessed with non-integer key (got key type "
                + key.getClass().getName()
                + ").");
      }
    }
  }
private int getIntegerIndex ( SoyValue key ) { try { return ( ( IntegerData ) key ) . integerValue ( ) ; } catch ( ClassCastException cce ) { try { return Integer . parseInt ( key . coerceToString ( ) ) ; } catch ( NumberFormatException nfe ) { throw new SoyDataException ( "SoyList accessed with non-integer key (got key type " + key . getClass ( ) . getName ( ) + ")." ) ; } } }
Gets the integer index out of a SoyValue key, or throws SoyDataException if the key is not an
integer.

@param key The SoyValue key.
@return The index.