KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ltk > internal > core > refactoring > history > DefaultRefactoringDescriptorProxy


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 IBM Corporation and others.
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  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ltk.internal.core.refactoring.history;
12
13 import org.eclipse.core.runtime.Assert;
14
15 import org.eclipse.ltk.core.refactoring.RefactoringDescriptorProxy;
16
17 /**
18  * Default implementation of a refactoring descriptor proxy.
19  *
20  * @since 3.2
21  */

22 final class DefaultRefactoringDescriptorProxy extends RefactoringDescriptorProxy {
23
24     /** The description of the refactoring */
25     private final String JavaDoc fDescription;
26
27     /** The non-empty name of the project, or <code>null</code> */
28     private final String JavaDoc fProject;
29
30     /** The time stamp of the refactoring */
31     private final long fTimeStamp;
32
33     /**
34      * Creates a new default refactoring descriptor proxy.
35      *
36      * @param description
37      * the description
38      * @param project
39      * the project name, or <code>null</code>
40      * @param stamp
41      * the time stamp
42      */

43     public DefaultRefactoringDescriptorProxy(final String JavaDoc description, final String JavaDoc project, final long stamp) {
44         Assert.isTrue(project == null || !"".equals(project)); //$NON-NLS-1$
45
Assert.isTrue(description != null && !"".equals(description)); //$NON-NLS-1$
46
fDescription= description.intern();
47         fProject= project != null ? project.intern() : null;
48         fTimeStamp= stamp;
49     }
50
51     /**
52      * {@inheritDoc}
53      */

54     public String JavaDoc getDescription() {
55         return fDescription;
56     }
57
58     /**
59      * {@inheritDoc}
60      */

61     public String JavaDoc getProject() {
62         return fProject;
63     }
64
65     /**
66      * {@inheritDoc}
67      */

68     public long getTimeStamp() {
69         return fTimeStamp;
70     }
71
72     /**
73      * {@inheritDoc}
74      */

75     public String JavaDoc toString() {
76
77         final StringBuffer JavaDoc buffer= new StringBuffer JavaDoc(128);
78
79         buffer.append(getClass().getName());
80         buffer.append("[stamp="); //$NON-NLS-1$
81
buffer.append(fTimeStamp);
82         buffer.append(",project="); //$NON-NLS-1$
83
buffer.append(fProject);
84         buffer.append(",description="); //$NON-NLS-1$
85
buffer.append(fDescription);
86         buffer.append("]"); //$NON-NLS-1$
87

88         return buffer.toString();
89     }
90 }
91
Popular Tags