KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > compiler > impl > StringConstant


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.jdt.internal.compiler.impl;
12
13 public class StringConstant extends Constant {
14 private String JavaDoc value;
15     
16
17 public static Constant fromValue(String JavaDoc value) {
18     return new StringConstant(value);
19 }
20
21 private StringConstant(String JavaDoc value) {
22     this.value = value ;
23 }
24
25 public String JavaDoc stringValue() {
26     //spec 15.17.11
27

28     //the next line do not go into the toString() send....!
29
return value ;
30
31     /*
32     String s = value.toString() ;
33     if (s == null)
34         return "null";
35     else
36         return s;
37     */

38     
39 }
40 public String JavaDoc toString(){
41
42     return "(String)\"" + value +"\""; } //$NON-NLS-2$ //$NON-NLS-1$
43
public int typeID() {
44     return T_JavaLangString;
45 }
46 }
47
Popular Tags