public Map<String, Object> getContentMap() throws JMSException { initializeReading(); return map; } }
/** * Indicates whether an item exists in this <CODE>MapMessage</CODE> * object. * * @param name the name of the item to test * @return true if the item exists * @throws JMSException if the JMS provider fails to determine if the item * exists due to some internal error. */ @Override public boolean itemExists(String name) throws JMSException { initializeReading(); return map.containsKey(name); }
/** * Returns an <CODE>Enumeration</CODE> of all the names in the * <CODE>MapMessage</CODE> object. * * @return an enumeration of all the names in this <CODE>MapMessage</CODE> * @throws JMSException */ @Override public Enumeration<String> getMapNames() throws JMSException { initializeReading(); return Collections.enumeration(map.keySet()); }
/** * Returns the value of the object with the specified name. * <P> * This method can be used to return, in objectified format, an object in * the Java programming language ("Java object") that had been stored in the * Map with the equivalent <CODE>setObject</CODE> method call, or its * equivalent primitive <CODE>set <I>type </I></CODE> method. * <P> * Note that byte values are returned as <CODE>byte[]</CODE>, not * <CODE>Byte[]</CODE>. * * @param name the name of the Java object * @return a copy of the Java object value with the specified name, in * objectified format (for example, if the object was set as an * <CODE>int</CODE>, an <CODE>Integer</CODE> is returned); if * there is no item by this name, a null value is returned * @throws JMSException if the JMS provider fails to read the message due to * some internal error. */ @Override public Object getObject(String name) throws JMSException { initializeReading(); Object result = map.get(name); if (result instanceof UTF8Buffer) { result = result.toString(); } return result; }
/** * Returns the Unicode character value with the specified name. * * @param name the name of the Unicode character * @return the Unicode character value with the specified name * @throws JMSException if the JMS provider fails to read the message due to * some internal error. * @throws MessageFormatException if this type conversion is invalid. */ @Override public char getChar(String name) throws JMSException { initializeReading(); Object value = map.get(name); if (value == null) { throw new NullPointerException(); } else if (value instanceof Character) { return ((Character)value).charValue(); } else { throw new MessageFormatException(" cannot read a char from " + value.getClass().getName()); } }
/** * Returns the <CODE>byte</CODE> value with the specified name. * * @param name the name of the <CODE>byte</CODE> * @return the <CODE>byte</CODE> value with the specified name * @throws JMSException if the JMS provider fails to read the message due to * some internal error. * @throws MessageFormatException if this type conversion is invalid. */ @Override public byte getByte(String name) throws JMSException { initializeReading(); Object value = map.get(name); if (value == null) { return 0; } if (value instanceof Byte) { return ((Byte)value).byteValue(); } if (value instanceof UTF8Buffer) { return Byte.valueOf(value.toString()).byteValue(); } if (value instanceof String) { return Byte.valueOf(value.toString()).byteValue(); } else { throw new MessageFormatException(" cannot read a byte from " + value.getClass().getName()); } }
/** * Returns the <CODE>boolean</CODE> value with the specified name. * * @param name the name of the <CODE>boolean</CODE> * @return the <CODE>boolean</CODE> value with the specified name * @throws JMSException if the JMS provider fails to read the message due to * some internal error. * @throws MessageFormatException if this type conversion is invalid. */ @Override public boolean getBoolean(String name) throws JMSException { initializeReading(); Object value = map.get(name); if (value == null) { return false; } if (value instanceof Boolean) { return ((Boolean)value).booleanValue(); } if (value instanceof UTF8Buffer) { return Boolean.valueOf(value.toString()).booleanValue(); } if (value instanceof String) { return Boolean.valueOf(value.toString()).booleanValue(); } else { throw new MessageFormatException(" cannot read a boolean from " + value.getClass().getName()); } }
/** * Returns the <CODE>String</CODE> value with the specified name. * * @param name the name of the <CODE>String</CODE> * @return the <CODE>String</CODE> value with the specified name; if there * is no item by this name, a null value is returned * @throws JMSException if the JMS provider fails to read the message due to * some internal error. * @throws MessageFormatException if this type conversion is invalid. */ @Override public String getString(String name) throws JMSException { initializeReading(); Object value = map.get(name); if (value == null) { return null; } if (value instanceof byte[]) { throw new MessageFormatException("Use getBytes to read a byte array"); } else { return value.toString(); } }
/** * Returns the byte array value with the specified name. * * @param name the name of the byte array * @return a copy of the byte array value with the specified name; if there * is no item by this name, a null value is returned. * @throws JMSException if the JMS provider fails to read the message due to * some internal error. * @throws MessageFormatException if this type conversion is invalid. */ @Override public byte[] getBytes(String name) throws JMSException { initializeReading(); Object value = map.get(name); if (value == null) { return null; } if (value instanceof byte[]) { return (byte[])value; } else { throw new MessageFormatException(" cannot read a byte[] from " + value.getClass().getName()); } }
/** * Returns the <CODE>float</CODE> value with the specified name. * * @param name the name of the <CODE>float</CODE> * @return the <CODE>float</CODE> value with the specified name * @throws JMSException if the JMS provider fails to read the message due to * some internal error. * @throws MessageFormatException if this type conversion is invalid. */ @Override public float getFloat(String name) throws JMSException { initializeReading(); Object value = map.get(name); if (value == null) { return 0; } if (value instanceof Float) { return ((Float)value).floatValue(); } if (value instanceof UTF8Buffer) { return Float.valueOf(value.toString()).floatValue(); } if (value instanceof String) { return Float.valueOf(value.toString()).floatValue(); } else { throw new MessageFormatException(" cannot read a float from " + value.getClass().getName()); } }
/** * Returns the <CODE>double</CODE> value with the specified name. * * @param name the name of the <CODE>double</CODE> * @return the <CODE>double</CODE> value with the specified name * @throws JMSException if the JMS provider fails to read the message due to * some internal error. * @throws MessageFormatException if this type conversion is invalid. */ @Override public double getDouble(String name) throws JMSException { initializeReading(); Object value = map.get(name); if (value == null) { return 0; } else if (value instanceof Double) { return ((Double)value).doubleValue(); } else if (value instanceof Float) { return ((Float)value).floatValue(); } else if (value instanceof UTF8Buffer) { return Double.valueOf(value.toString()).doubleValue(); } else if (value instanceof String) { return Double.valueOf(value.toString()).doubleValue(); } else { throw new MessageFormatException("Cannot read a double from " + value.getClass().getName()); } }
initializeReading(); Object value = map.get(name); if (value == null) {
initializeReading(); Object value = map.get(name); if (value == null) {
initializeReading(); Object value = map.get(name); if (value == null) {
public Map<String, Object> getContentMap() throws JMSException { initializeReading(); return map; } }
public Map<String, Object> getContentMap() throws JMSException { initializeReading(); return map; } }
/** * Returns an <CODE>Enumeration</CODE> of all the names in the * <CODE>MapMessage</CODE> object. * * @return an enumeration of all the names in this <CODE>MapMessage</CODE> * @throws JMSException */ @Override public Enumeration<String> getMapNames() throws JMSException { initializeReading(); return Collections.enumeration(map.keySet()); }
/** * Returns an <CODE>Enumeration</CODE> of all the names in the * <CODE>MapMessage</CODE> object. * * @return an enumeration of all the names in this <CODE>MapMessage</CODE> * @throws JMSException */ @Override public Enumeration<String> getMapNames() throws JMSException { initializeReading(); return Collections.enumeration(map.keySet()); }
/** * Returns an <CODE>Enumeration</CODE> of all the names in the * <CODE>MapMessage</CODE> object. * * @return an enumeration of all the names in this <CODE>MapMessage</CODE> * @throws JMSException */ @Override public Enumeration<String> getMapNames() throws JMSException { initializeReading(); return Collections.enumeration(map.keySet()); }
/** * Returns an <CODE>Enumeration</CODE> of all the names in the * <CODE>MapMessage</CODE> object. * * @return an enumeration of all the names in this <CODE>MapMessage</CODE> * @throws JMSException */ public Enumeration<String> getMapNames() throws JMSException { initializeReading(); return Collections.enumeration(map.keySet()); }