/** * 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 * . */ 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; } }