📄 jobdatamap.java
字号:
super.put(key, strValue); } /** * <p> * Adds the given <code>Integer</code> value as a string version to the * <code>Job</code>'s data map. * </p> */ public void putAsString(String key, Integer value) { String strValue = value.toString(); super.put(key, strValue); } /** * <p> * Adds the given <code>long</code> value as a string version to the * <code>Job</code>'s data map. * </p> */ public void putAsString(String key, long value) { String strValue = new Long(value).toString(); super.put(key, strValue); } /** * <p> * Adds the given <code>Long</code> value as a string version to the * <code>Job</code>'s data map. * </p> */ public void putAsString(String key, Long value) { String strValue = value.toString(); 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. */ 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. */ 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. */ 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. */ 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. */ 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 + -