]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.utils/src/org/simantics/utils/ExtendableDataContainer.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.utils / src / org / simantics / utils / ExtendableDataContainer.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 /*
13  * Created on 16.12.2005
14  * 
15  */
16 package org.simantics.utils;
17
18
19 /**
20  * DataContainer is used as return argument
21  * 
22  * 
23  * @author Toni Kalajainen 
24  */
25 public class ExtendableDataContainer<T> {
26
27     private T data;
28     
29     public ExtendableDataContainer() {       
30     }
31     
32     public ExtendableDataContainer(T initialData) {
33         this.data = initialData;
34     }
35     
36     public boolean isEmpty() {
37         return data==null;
38     }
39     
40     public void set(T value) {
41         data = value;
42     }
43     
44     public T get() {
45         return data;
46     }
47     
48     public boolean hasContent() {
49         return data!=null;
50     }
51     
52     public static ExtendableDataContainer<Integer> getIntegerContainer() {
53         return new ExtendableDataContainer<Integer>();
54     }
55         
56     public static ExtendableDataContainer<Double> getDoubleContainer() {
57         return new ExtendableDataContainer<Double>();
58     }
59         
60     public static ExtendableDataContainer<String> getStringContainer() {
61         return new ExtendableDataContainer<String>();
62     }
63         
64 }