?? jobdatamap.java
字號:
super.put(key, strValue); } /** * <p> * Adds the given <code>Serializable</code> object value to the <code>JobDataMap</code>. * </p> */ public Object put(Object key, Object value) { if (!(key instanceof String)) throw new IllegalArgumentException( "Keys in map must be Strings."); return super.put(key, value); } /** * <p> * Retrieve the identified <code>int</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not an Integer. */ public int getInt(String key) { Object obj = get(key); try { return ((Integer) obj).intValue(); } catch (Exception e) { throw new ClassCastException("Identified object is not an Integer."); } } /** * <p> * Retrieve the identified <code>long</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a Long. */ public long getLong(String key) { Object obj = get(key); try { return ((Long) obj).longValue(); } catch (Exception e) { throw new ClassCastException("Identified object is not a Long."); } } /** * <p> * Retrieve the identified <code>float</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a Float. */ public float getFloat(String key) { Object obj = get(key); try { return ((Float) obj).floatValue(); } catch (Exception e) { throw new ClassCastException("Identified object is not a Float."); } } /** * <p> * Retrieve the identified <code>double</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a Double. */ public double getDouble(String key) { Object obj = get(key); try { return ((Double) obj).doubleValue(); } catch (Exception e) { throw new ClassCastException("Identified object is not a Double."); } } /** * <p> * Retrieve the identified <code>boolean</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a Boolean. */ public boolean getBoolean(String key) { Object obj = get(key); try { return ((Boolean) obj).booleanValue(); } catch (Exception e) { throw new ClassCastException("Identified object is not a Boolean."); } } /** * <p> * Retrieve the identified <code>char</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a Character. */ public char getChar(String key) { Object obj = get(key); try { return ((Character) obj).charValue(); } catch (Exception e) { throw new ClassCastException( "Identified object is not a Character."); } } /** * <p> * Retrieve the identified <code>String</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a String. */ public String getString(String key) { Object obj = get(key); try { return (String) obj; } catch (Exception e) { throw new ClassCastException("Identified object is not a String."); } } /** * <p> * Retrieve the identified <code>int</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a String. */ public int getIntFromString(String key) { Object obj = get(key); return new Integer((String) obj).intValue(); } /** * <p> * Retrieve the identified <code>int</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a String or Integeger. */ public long getIntValue(String key) { Object obj = get(key); if(obj instanceof String) return getIntFromString(key); else return getInt(key); } /** * <p> * Retrieve the identified <code>int</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a String. */ public Integer getIntegerFromString(String key) { Object obj = get(key); return new Integer((String) obj); } /** * <p> * Retrieve the identified <code>boolean</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a String. */ public boolean getBooleanValueFromString(String key) { Object obj = get(key); return new Boolean((String) obj).booleanValue(); } /** * <p> * Retrieve the identified <code>boolean</code> value from the * <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a String or Boolean. */ public boolean getBooleanValue(String key) { Object obj = get(key); if(obj instanceof String) return getBooleanValueFromString(key); else return getBoolean(key); } /** * <p> * Retrieve the identified <code>Boolean</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a String. */ public Boolean getBooleanFromString(String key) { Object obj = get(key); return new Boolean((String) obj); } /** * <p> * Retrieve the identified <code>char</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a String. */ public char getCharFromString(String key) { Object obj = get(key); return ((String) obj).charAt(0); } /** * <p> * Retrieve the identified <code>Character</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a String. */ public Character getCharacterFromString(String key) { Object obj = get(key); return new Character(((String) obj).charAt(0)); } /** * <p> * Retrieve the identified <code>double</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a String. */ public double getDoubleValueFromString(String key) { Object obj = get(key); return new Double((String) obj).doubleValue(); } /** * <p> * Retrieve the identified <code>double</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a String or Double. */ public double getDoubleValue(String key) { Object obj = get(key); if(obj instanceof String) return getDoubleValueFromString(key); else return getDouble(key); } /** * <p> * Retrieve the identified <code>Double</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a String. */ public Double getDoubleFromString(String key) { Object obj = get(key); return new Double((String) obj); } /** * <p> * Retrieve the identified <code>float</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a String. */ public float getFloatValueFromString(String key) { Object obj = get(key); return new Float((String) obj).floatValue(); } /** * <p> * Retrieve the identified <code>float</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a String or Float. */ public float getFloatValue(String key) { Object obj = get(key); if(obj instanceof String) return getFloatValueFromString(key); else return getFloat(key); } /** * <p> * Retrieve the identified <code>Float</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a String. */ public Float getFloatFromString(String key) { Object obj = get(key); return new Float((String) obj); } /** * <p> * Retrieve the identified <code>long</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a String. */ public long getLongValueFromString(String key) { Object obj = get(key); return new Long((String) obj).longValue(); } /** * <p> * Retrieve the identified <code>long</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a String or Long. */ public long getLongValue(String key) { Object obj = get(key); if(obj instanceof String) return getLongValueFromString(key); else return getLong(key); } /** * <p> * Retrieve the identified <code>Long</code> value from the <code>JobDataMap</code>. * </p> * * @throws ClassCastException * if the identified object is not a String. */ public Long getLongFromString(String key) { Object obj = get(key); return new Long((String) obj); } public String[] getKeys() { return (String[]) keySet().toArray(new String[size()]); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -