View Javadoc

1   /*
2    *  jDTAUS Core API
3    *  Copyright (C) 2005 Christian Schulte
4    *  <cs@schulte.it>
5    *
6    *  This library is free software; you can redistribute it and/or
7    *  modify it under the terms of the GNU Lesser General Public
8    *  License as published by the Free Software Foundation; either
9    *  version 2.1 of the License, or any later version.
10   *
11   *  This library is distributed in the hope that it will be useful,
12   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   *  Lesser General Public License for more details.
15   *
16   *  You should have received a copy of the GNU Lesser General Public
17   *  License along with this library; if not, write to the Free Software
18   *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19   *
20   */
21  package org.jdtaus.core.container;
22  
23  import java.io.Serializable;
24  
25  /**
26   * Base model object.
27   *
28   * @author <a href="mailto:cs@schulte.it">Christian Schulte</a>
29   * @version $JDTAUS: ModelObject.java 8743 2012-10-07 03:06:20Z schulte $
30   */
31  public class ModelObject implements Serializable
32  {
33      //--Constants---------------------------------------------------------------
34  
35      /** Serial version UID for backwards compatibility with 1.5.x classes. */
36      private static final long serialVersionUID = 994580334374636235L;
37  
38      //---------------------------------------------------------------Constants--
39      //--ModelObject-------------------------------------------------------------
40  
41      /**
42       * The model version of the object.
43       * @serial
44       */
45      private String modelVersion;
46  
47      /**
48       * The documentation of the object.
49       * @serial
50       */
51      private Text documentation;
52  
53      /** Creates a new {@code ModelObject} instance. */
54      public ModelObject()
55      {
56          super();
57      }
58  
59      /**
60       * Gets the model version of the object.
61       *
62       * @return the model version of the object.
63       */
64      public String getModelVersion()
65      {
66          return this.modelVersion;
67      }
68  
69      /**
70       * Setter for property {@code modelVersion}.
71       *
72       * @param value the new model version of the object.
73       */
74      public void setModelVersion( final String value )
75      {
76          this.modelVersion = value;
77      }
78  
79      /**
80       * Gets the documentation of the object.
81       *
82       * @return the documentation of the object.
83       */
84      public Text getDocumentation()
85      {
86          if ( this.documentation == null )
87          {
88              this.documentation = new Text();
89          }
90  
91          return this.documentation;
92      }
93  
94      /**
95       * Setter for property {@code documentation}.
96       *
97       * @param value the new documentation of the object.
98       */
99      public void setDocumentation( final Text value )
100     {
101         this.documentation = value;
102     }
103 
104     /**
105      * Creates a string representing the properties of an instance.
106      *
107      * @param modelObject the instance to create a string for.
108      *
109      * @return a string representing the properties of {@code modelObject}.
110      */
111     String internalString( final ModelObject modelObject )
112     {
113         return new StringBuffer( 500 ).append( "modelVersion=" ).append(
114             modelObject.getModelVersion() ).
115             append( ", documentation=" ).
116             append( modelObject.getDocumentation() ).toString();
117 
118     }
119     //-------------------------------------------------------------ModelObject--
120 }