Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.knipp.rritoolkit.message
Class Message

    java.lang.Object
      de.knipp.rritoolkit.message.Message

All Implemented Interfaces:
  java.io.Serializable

Direct Known Subclasses:
  AuthInfo2NotifyMessage, AuthInfoExpireMessage, ChangeProvMessageBase, DeleteLegalMessage, DeleteMessageBase, ExpireMessageBase

    public abstract class Message

extends java.lang.Object
implements java.io.Serializable

base class for all messages

Version:
  $Revision: 15119 $
Author:
  Klaus Malorny
See Also:
  Serialized Form

Nested Class Summary
`static class` | `Message.Type` enumeration for the different message types

Field Summary
`private java.util.Date` | `created` the point in time the message was generated
`private static java.util.Map<java.lang.String,Message.Type>` | `elementToTypeMap` map from the XML element's local name to the type
`private java.lang.String` | `messageID` the message ID
`private Message.Type` | `type` the type of the message

Constructor Summary
`Message()`

Method Summary
`abstract void` | `accept(MessageVisitor visitor)` calls the suitable method of the given visitor
`protected static Message` | `createMessage(Message.Type type)` factory for the various message types
`protected abstract void` | `dataFromList(KVList list)` setups the object's data from the given list.
`protected abstract void` | `dataFromXml(org.w3c.dom.Element el)` setup the object's data from the given XML element.
`static Message` | `fromList(KVList list)` initializes the instance from the given key-value multi-list
`static Message` | `fromXml(org.w3c.dom.Element el)` create an instance from the given XML element
`java.util.Date` | `getCreationDate()` returns the point in time at which the message was generated
`java.lang.String` | `getMessageID()` returns the message ID
`Message.Type` | `getType()` returns the type of the message
`protected void` | `setData(java.lang.String theID, Message.Type theType, java.util.Date theCreationDate)` set the member variables of this base class
`java.lang.String` | `toString()` returns a string representation for debugging purposes

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### messageID

    private java.lang.String messageID

  the message ID

### type

    private Message.Type type

  the type of the message

### created

    private java.util.Date created

  the point in time the message was generated

### elementToTypeMap

    private static final java.util.Map<java.lang.String,Message.Type> elementToTypeMap

  map from the XML element's local name to the type

Constructor Detail

### Message

    public Message()

Method Detail

### setData

    protected void setData(java.lang.String theID,
                           Message.Type theType,
                           java.util.Date theCreationDate)

  set the member variables of this base class

  Parameters:
    `theID` - the message ID
    `theType` - the type
    `theCreationDate` - the date

### createMessage

    protected static Message createMessage(Message.Type type)

  factory for the various message types

  Parameters:
    `type` - the type, may be `null` (which behaves as an unknown type)
  Returns:
    the instance
  Throws:
    `java.lang.IllegalArgumentException` - if the given type is unknown or unsupported

### fromXml

    public static Message fromXml(org.w3c.dom.Element el)
                           throws org.w3c.dom.DOMException,
                                  ResponseParseException

  create an instance from the given XML element

  Parameters:
    `el` - the element
  Returns:
    the created object
  Throws:
    `org.w3c.dom.DOMException` - on DOM exceptions
    `ResponseParseException` - if the data was not recognised

### dataFromXml

    protected abstract void dataFromXml(org.w3c.dom.Element el)
                                 throws org.w3c.dom.DOMException,
                                        ResponseParseException

  setup the object's data from the given XML element.

  Parameters:
    `el` - the element
  Throws:
    `org.w3c.dom.DOMException` - on DOM exceptions
    `ResponseParseException` - if the data was not recognised

### fromList

    public static Message fromList(KVList list)
                            throws ResponseParseException

  initializes the instance from the given key-value multi-list

  Parameters:
    `list` - the list
  Returns:
    the created message
  Throws:
    `ResponseParseException` - if the list does not contain the expected content

### dataFromList

    protected abstract void dataFromList(KVList list)
                                  throws ResponseParseException

  setups the object's data from the given list. Subclasses should override this method and call the superclass first.

  Parameters:
    `list` - the list
  Throws:
    `ResponseParseException` - if the list does not contain the expected content

### getMessageID

    public java.lang.String getMessageID()

  returns the message ID

  Returns:
    the message ID

### getType

    public Message.Type getType()

  returns the type of the message

  Returns:
    the type

### getCreationDate

    public java.util.Date getCreationDate()

  returns the point in time at which the message was generated

  Returns:
    the time

### accept

    public abstract void accept(MessageVisitor visitor)

  calls the suitable method of the given visitor

  Parameters:
    `visitor` - the visitor

### toString

    public java.lang.String toString()

  returns a string representation for debugging purposes

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    the string representation

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005-2011 Knipp Medien und Kommunikation GmbH