View Javadoc

1   /**
2    * Copyright (c) 2009 Ordina and committers to Mod4j
3    * All rights reserved. This program and the accompanying materials
4    * are made available under the terms of the Eclipse Public License v1.0
5    * which accompanies this distribution, and is available at
6    * http://www.eclipse.org/legal/epl-v10.html
7    *
8    * Contributors:
9    * Ordina - initial implementation
10   */
11  package org.mod4j.runtime.dto;
12  
13  import java.io.Serializable;
14  
15  /**
16   * Abstract base class for all Data Transfer Objects (DTO's), containing features that all DTO's have, like id and
17   * version properties.
18   * 
19   * @author Eric Jan Malotaux
20   */
21  @SuppressWarnings("serial")
22  public class AbstractDto implements Serializable {
23  
24      /**
25       * id: The identifier of this object.
26       */
27      private final Long id;
28  
29      /**
30       * version: The version of this object.
31       */
32      private final Integer version;
33  
34      /**
35       * The default no-argument constructor.
36       */
37      public AbstractDto() {
38          this.id = null;
39          this.version = null;
40      }
41  
42      /**
43       * Constructor for use by the DTO Translator.
44       * 
45       * @param id
46       *            The ID of the referenced business object.
47       * @param version
48       *            The version of the referenced business object.
49       */
50      public AbstractDto(final Long id, final Integer version) {
51          this.id = id;
52          this.version = version;
53      }
54  
55      /**
56       * @return the id
57       */
58      public Long getId() {
59          return id;
60      }
61  
62      /**
63       * @return the version
64       */
65      public Integer getVersion() {
66          return version;
67      }
68  
69  }