Method: DocumentationSpec()

1: /*******************************************************************************
2: * Copyright (c) 2008, 2012 Obeo.
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: * Obeo - initial API and implementation
10: *******************************************************************************/
11: package org.eclipse.acceleo.model.mtl.impl.spec;
12:
13: import org.eclipse.acceleo.common.IAcceleoConstants;
14: import org.eclipse.acceleo.model.mtl.impl.DocumentationImpl;
15:
16: /**
17: * Specializes the documentation implementation.
18: *
19: * @author <a href="mailto:stephane.begaudeau@obeo.fr">Stephane Begaudeau</a>
20: */
21: public class DocumentationSpec extends DocumentationImpl {
22:
23:         /**
24:          * {@inheritDoc}
25:          *
26:          * @see org.eclipse.acceleo.model.mtl.impl.ModuleElementImpl#toString()
27:          */
28:         @Override
29:         public String toString() {
30:                 StringBuffer result = new StringBuffer();
31:                 if (this.getBody() != null) {
32:                         result.append(IAcceleoConstants.COMMENT).append(' ').append(this.getBody().getValue());
33:                 } else {
34:                         result.append(IAcceleoConstants.COMMENT);
35:                 }
36:
37:                 result.append(' ' + this.getStartPosition()).append('-').append(this.getEndPosition());
38:                 return result.toString();
39:         }
40:
41: }