View Javadoc

1   /*
2    * $Id: BaseParameterDescription.java,v 1.4 2005/07/05 08:27:01 clq2 Exp $
3    *
4    * Created on 26 November 2003 by Paul Harrison
5    * Copyright 2003 AstroGrid. All rights reserved.
6    *
7    * This software is published under the terms of the AstroGrid
8    * Software License version 1.2, a copy of which has been included
9    * with this distribution in the LICENSE.txt file.
10   */
11  
12  package org.astrogrid.applications.description.base;
13  
14  import org.astrogrid.applications.beans.v1.parameters.types.ParameterTypes;
15  import org.astrogrid.applications.description.ParameterDescription;
16  /***
17   *Basic implementation of a {@link org.astrogrid.applications.description.ParameterDescription}.
18   *<p />
19   *Simple data bean - adds setters for each of the getters defined in <tt>ParameterDescription</tt>
20   *@author Noel Winstanley
21   */
22  public class BaseParameterDescription implements ParameterDescription {
23  
24     static protected org.apache.commons.logging.Log logger =
25        org.apache.commons.logging.LogFactory.getLog(BaseParameterDescription.class);
26     public String getName(){ return name; }
27  
28     public void setName(String name){ this.name = name; }
29  
30     public String getDisplayName(){ return displayName; }
31  
32     public void setDisplayName(String displayName){ this.displayName = displayName; }
33  
34     public String getDisplayDescription(){ return displayDescription; }
35  
36     public void setDisplayDescription(String displayDescription){ this.displayDescription = displayDescription; }
37  
38     public String getUcd(){ return ucd; }
39  
40     public void setUcd(String ucd){ this.ucd= ucd; }
41  
42     protected String name;
43     protected String displayName = "";
44     protected String displayDescription = "";
45     protected String ucd = "";
46     protected ParameterTypes type;
47     protected String acceptEncodings = "";
48     protected String subtype = "";
49     protected String defaultValue = "";
50     protected String units = "";
51     public String getAcceptEncodings() {return acceptEncodings;}
52     public void setAcceptEncodings(String a) {this.acceptEncodings = a;}
53     public String getSubType() {return subtype;}
54     public void setSubType(String st) {this.subtype = st;}
55     
56     public String getUnits() {return units;}
57     public void setUnits(String u) {this.units = u;}
58     
59     public String getDefaultValue() {return defaultValue;}
60     public void setDefaultValue(String s) {this.defaultValue = s;}
61     
62     public ParameterTypes getType() { return type;}
63     public void setType(ParameterTypes type) {this.type= type;}
64     
65    
66      /***
67       * @see java.lang.Object#toString()
68       */
69      public String toString() {
70          return "Parameter: " + getName() + " /" + getType()  +  (getSubType() != null ? "(" + getSubType() + ")/" : "")                        
71              + (getDefaultValue() != "" ? "::Default Value: " + getDefaultValue(): "")
72              + (getDisplayName() != "" ? " ::Display Name: " + getDisplayName():"")
73              + (getDisplayDescription() != "" ? "::Display Description: " + getDisplayDescription():"")
74              + (getUcd() != "" ? "::UCD: " + getUcd():"")
75              + (getUnits() != "" ? "::Units: " + getUnits():"")
76              + (getAcceptEncodings() != "" ? "::Accept Encodings: " + getAcceptEncodings():"");
77              
78      }
79  
80  }