KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > internal > content > DefaultDescription


1 /*******************************************************************************
2  * Copyright (c) 2004, 2005 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.core.internal.content;
12
13 import org.eclipse.core.runtime.QualifiedName;
14 import org.eclipse.core.runtime.content.IContentDescription;
15
16 /**
17  * A content description for which all properties have default values.
18  */

19 public final class DefaultDescription extends BasicDescription {
20
21     public DefaultDescription(IContentTypeInfo contentTypeInfo) {
22         super(contentTypeInfo);
23     }
24
25     public boolean equals(Object JavaDoc obj) {
26         if (!(obj instanceof DefaultDescription))
27             return false;
28         // see ContentType.equals()
29
return contentTypeInfo.equals(((DefaultDescription) obj).contentTypeInfo);
30     }
31
32     /**
33      * @see IContentDescription
34      */

35     public String JavaDoc getCharset() {
36         return (String JavaDoc) getProperty(CHARSET);
37     }
38
39     /**
40      * @see IContentDescription
41      */

42     public Object JavaDoc getProperty(QualifiedName key) {
43         return contentTypeInfo.getDefaultProperty(key);
44     }
45
46     public int hashCode() {
47         return contentTypeInfo.getContentType().hashCode();
48     }
49
50     /**
51      * @see IContentDescription
52      */

53     public boolean isRequested(QualifiedName key) {
54         return false;
55     }
56
57     /**
58      * @see IContentDescription
59      */

60     public void setProperty(QualifiedName key, Object JavaDoc value) {
61         throw new IllegalStateException JavaDoc();
62     }
63
64     public String JavaDoc toString() {
65         return "{default} : " + contentTypeInfo.getContentType(); //$NON-NLS-1$
66
}
67 }
68
Popular Tags