org.axonframework.eventstore.jpa
Class SimpleSerializedDomainEventData<T>

java.lang.Object
  extended by org.axonframework.eventstore.jpa.SimpleSerializedDomainEventData<T>
Type Parameters:
T - The data type expected for the serialized objects
All Implemented Interfaces:
SerializedDomainEventData<T>

public class SimpleSerializedDomainEventData<T>
extends Object
implements SerializedDomainEventData<T>

Simple implementation of the SerializedDomainEventData class, used to reduce memory consumptions by queries accessing Event Entries. Querying from them directly will cause the EntityManager to keep a reference to them, preventing them from being garbage collected.

Since:
2.0
Author:
Allard Buijze

Constructor Summary
SimpleSerializedDomainEventData(String eventIdentifier, String aggregateIdentifier, long sequenceNumber, Object timestamp, SerializedObject<T> serializedPayload, SerializedObject<T> serializedMetaData)
          Initialize an instance using given properties.
SimpleSerializedDomainEventData(String eventIdentifier, String aggregateIdentifier, long sequenceNumber, Object timestamp, String payloadType, String payloadRevision, T payload, T metaData)
          Initialize an instance using given properties.
 
Method Summary
 Object getAggregateIdentifier()
          Returns the Identifier of the Aggregate to which the Event was applied.
 String getEventIdentifier()
          Returns the identifier of the serialized event.
 SerializedObject<T> getMetaData()
          Returns the serialized data of the MetaData of the serialized Event.
 SerializedObject<T> getPayload()
          Returns the serialized data of the Event Message's payload.
 long getSequenceNumber()
          Returns the sequence number of the event in the aggregate.
 org.joda.time.DateTime getTimestamp()
          Returns the timestamp at which the event was first created.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleSerializedDomainEventData

public SimpleSerializedDomainEventData(String eventIdentifier,
                                       String aggregateIdentifier,
                                       long sequenceNumber,
                                       Object timestamp,
                                       String payloadType,
                                       String payloadRevision,
                                       T payload,
                                       T metaData)
Initialize an instance using given properties. This constructor assumes the default SerializedType for meta data (name = 'org.axonframework.domain.MetaData' and revision = null).

Note that the given timestamp must be in a format supported by DateTime#DateTime(Object)}.

Parameters:
eventIdentifier - The identifier of the event
aggregateIdentifier - The identifier of the aggregate
sequenceNumber - The sequence number of the event
timestamp - The timestamp of the event (format must be supported by DateTime.DateTime(Object))
payloadType - The type identifier of the serialized payload
payloadRevision - The revision of the serialized payload
payload - The serialized representation of the event
metaData - The serialized representation of the meta data

SimpleSerializedDomainEventData

public SimpleSerializedDomainEventData(String eventIdentifier,
                                       String aggregateIdentifier,
                                       long sequenceNumber,
                                       Object timestamp,
                                       SerializedObject<T> serializedPayload,
                                       SerializedObject<T> serializedMetaData)
Initialize an instance using given properties. In contrast to the other constructor, this one allows to explicitly indicate the SerializedType used to represent MetaData.

Note that the given timestamp must be in a format supported by DateTime#DateTime(Object)}.

Parameters:
eventIdentifier - The identifier of the event
aggregateIdentifier - The identifier of the aggregate
sequenceNumber - The sequence number of the event
timestamp - The timestamp of the event (format must be supported by DateTime.DateTime(Object))
serializedPayload - The serialized representation of the event
serializedMetaData - The serialized representation of the meta data
Method Detail

getEventIdentifier

public String getEventIdentifier()
Description copied from interface: SerializedDomainEventData
Returns the identifier of the serialized event.

Specified by:
getEventIdentifier in interface SerializedDomainEventData<T>
Returns:
the identifier of the serialized event

getAggregateIdentifier

public Object getAggregateIdentifier()
Description copied from interface: SerializedDomainEventData
Returns the Identifier of the Aggregate to which the Event was applied.

Specified by:
getAggregateIdentifier in interface SerializedDomainEventData<T>
Returns:
the Identifier of the Aggregate to which the Event was applied

getSequenceNumber

public long getSequenceNumber()
Description copied from interface: SerializedDomainEventData
Returns the sequence number of the event in the aggregate.

Specified by:
getSequenceNumber in interface SerializedDomainEventData<T>
Returns:
the sequence number of the event in the aggregate

getTimestamp

public org.joda.time.DateTime getTimestamp()
Description copied from interface: SerializedDomainEventData
Returns the timestamp at which the event was first created.

Specified by:
getTimestamp in interface SerializedDomainEventData<T>
Returns:
the timestamp at which the event was first created

getMetaData

public SerializedObject<T> getMetaData()
Description copied from interface: SerializedDomainEventData
Returns the serialized data of the MetaData of the serialized Event.

Specified by:
getMetaData in interface SerializedDomainEventData<T>
Returns:
the serialized data of the MetaData of the serialized Event

getPayload

public SerializedObject<T> getPayload()
Description copied from interface: SerializedDomainEventData
Returns the serialized data of the Event Message's payload.

Specified by:
getPayload in interface SerializedDomainEventData<T>
Returns:
the serialized data of the Event Message's payload


Copyright © 2010-2016. All Rights Reserved.