Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
StringAndObject.java
Go to the documentation of this file.
1
package
fi.jyu.mit.fxgui;
2
3
/**
4
* Packeting class to hold the name alongside the actual object
5
* @author Tero Paavolainen
6
* @version 9.1.2017
7
* @param <T> mitä luokkaa tallennetaan
8
*/
9
public
class
StringAndObject<T> {
10
private
String
name
;
11
private
T
object
;
12
13
/**
14
* Creates a string and object -object for storing data
15
* @param name the displayed object name
16
* @param obj the object that is stored
17
*/
18
public
StringAndObject
(String name,T obj){
19
this.setName(name);
20
this.setObject(obj);
21
}
22
23
24
@Override
25
public
String
toString
(){
26
return
getName() != null ? getName() : getObject().toString();
27
}
28
29
30
/**
31
* Returns the name of the pair
32
* @return name
33
*/
34
public
String
getName
() {
35
return
name;
36
}
37
38
39
/**
40
* Sets the name of the pair
41
* @param name name for pair
42
*/
43
public
void
setName
(String name) {
44
this.name = name;
45
}
46
47
48
/**
49
* Returns the object of the pair
50
* @return object
51
*/
52
public
T
getObject
() {
53
return
object;
54
}
55
56
57
/**
58
* Sets the object of the pair
59
* @param object the new object
60
*/
61
public
void
setObject
(T
object
) {
62
this.
object
= object;
63
}
64
}
trunk
FXGui
src
fi
jyu
mit
fxgui
StringAndObject.java
Generated on Sat Feb 4 2017 23:18:40 by
1.8.3