TAPField.java
4.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/**
* This file is a part of EpnTAPClient.
* This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer.
* See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861
* Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
*
* This program is free software: you can
* redistribute it and/or modify it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at your option) any later
* version. This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details. You should have received a copy of
* the GNU General Public License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
package eu.omp.irap.vespa.epntapclient.model;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
/**
* An object representing a VOTable column.
*
* @author N. Jourdane
*/
public class TAPField {
/** The ID property of the VOTable column. */
private String id;
/** The arraySize property of the VOTable column. */
private String arraySize;
/** The datatype property of the VOTable column. */
private String datatype;
/** The name property of the VOTable column. */
private String name;
/** The ucd property of the VOTable column. */
private String ucd;
/** The utype property of the VOTable column. */
private String utype;
/** The description of the VOTable column. */
private String description;
/**
* Method constructor
*
* @param id The ID property of the VOTable column.
* @param arraySize The arraySize property of the VOTable column.
* @param datatype The datatype property of the VOTable column.
* @param name The name property of the VOTable column.
* @param ucd The ucd property of the VOTable column.
* @param utype The utype property of the VOTable column.
* @param description The description of the VOTable column.
*/
public TAPField(String id, String arraySize, String datatype, String name, String ucd,
String utype, String description) {
this.id = id;
this.arraySize = arraySize;
this.datatype = datatype;
this.name = name;
this.ucd = ucd;
this.utype = utype;
this.description = description;
}
/**
* Method constructor
*
* @param node The XML node of the column.
*/
public TAPField(Node node) {
id = ((Element) node).getAttribute(VOTableTags.DOM_ATTR_ID);
arraySize = ((Element) node).getAttribute(VOTableTags.DOM_ATTR_ARRAYSIZE);
datatype = ((Element) node).getAttribute(VOTableTags.DOM_ATTR_DATATYPE);
name = ((Element) node).getAttribute(VOTableTags.DOM_ATTR_NAME);
ucd = ((Element) node).getAttribute(VOTableTags.DOM_ATTR_UCD);
utype = ((Element) node).getAttribute(VOTableTags.DOM_ATTR_UTYPE);
try {
description = ((Element) node).getElementsByTagName(VOTableTags.DOM_TAG_DESCRIPTION)
.item(0)
.getTextContent();
} catch (@SuppressWarnings("unused") NullPointerException e) {
description = new String();
}
}
@SuppressWarnings("nls")
@Override
public String toString() {
return VOTableTags.DOM_ATTR_ID + ": " + id + "\n\t" +
VOTableTags.DOM_ATTR_ARRAYSIZE + ": " + arraySize + "\n\t" +
VOTableTags.DOM_ATTR_DATATYPE + ": " + datatype + "\n\t" +
VOTableTags.DOM_ATTR_NAME + ": " + name + "\n\t" +
VOTableTags.DOM_ATTR_UCD + ": " + ucd + "\n\t" +
VOTableTags.DOM_ATTR_UTYPE + ": " + utype + "\n\t" +
VOTableTags.DOM_TAG_DESCRIPTION + ": " + description + "\n";
}
/**
* @return The ID of the column.
*/
public String getId() {
return id;
}
/**
* @return The arraySize of the column.
*/
public String getArraySize() {
return arraySize;
}
/**
* @return The dataType of the column.
*/
public String getDatatype() {
return datatype;
}
/**
* @return The name of the column.
*/
public String getName() {
return name;
}
/**
* @return The UCD of the column.
*/
public String getUcd() {
return ucd;
}
/**
* @return The UType of the column.
*/
public String getUtype() {
return utype;
}
/**
* @return The description of the column.
*/
public String getDescription() {
return description;
}
}