KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jode > jvm > NewObject


1 /* NewObject Copyright (C) 1999-2002 Jochen Hoenicke.
2  *
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU Lesser General Public License as published by
5  * the Free Software Foundation; either version 2, or (at your option)
6  * any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program; see the file COPYING.LESSER. If not, write to
15  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
16  *
17  * $Id: NewObject.java,v 1.5.2.1 2002/05/28 17:34:12 hoenicke Exp $
18  */

19
20 package jode.jvm;
21
22 /**
23  * This class represents a new object, that may not be initialized yet.
24  *
25  * @author Jochen Hoenicke
26  */

27 public class NewObject {
28     Object JavaDoc instance;
29     String JavaDoc type;
30
31     public NewObject(String JavaDoc type) {
32     this.type = type;
33     }
34
35     public String JavaDoc getType() {
36     return type;
37     }
38
39     public void setObject(Object JavaDoc obj) {
40     instance = obj;
41     }
42
43     public Object JavaDoc objectValue() {
44     return instance;
45     }
46
47     public String JavaDoc toString() {
48     if (instance == null)
49         return "new "+type;
50     else
51         return instance.toString();
52     }
53 }
54
55
Popular Tags