001 // $HeadURL: https://svn.wald.intevation.org/svn/deegree/base/branches/2.3_testing/src/org/deegree/datatypes/parameter/OperationParameterIm.java $ 002 /*---------------------------------------------------------------------------- 003 This file is part of deegree, http://deegree.org/ 004 Copyright (C) 2001-2009 by: 005 Department of Geography, University of Bonn 006 and 007 lat/lon GmbH 008 009 This library is free software; you can redistribute it and/or modify it under 010 the terms of the GNU Lesser General Public License as published by the Free 011 Software Foundation; either version 2.1 of the License, or (at your option) 012 any later version. 013 This library is distributed in the hope that it will be useful, but WITHOUT 014 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 015 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 016 details. 017 You should have received a copy of the GNU Lesser General Public License 018 along with this library; if not, write to the Free Software Foundation, Inc., 019 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 020 021 Contact information: 022 023 lat/lon GmbH 024 Aennchenstr. 19, 53177 Bonn 025 Germany 026 http://lat-lon.de/ 027 028 Department of Geography, University of Bonn 029 Prof. Dr. Klaus Greve 030 Postfach 1147, 53001 Bonn 031 Germany 032 http://www.geographie.uni-bonn.de/deegree/ 033 034 e-mail: info@deegree.org 035 ----------------------------------------------------------------------------*/ 036 package org.deegree.datatypes.parameter; 037 038 import java.io.Serializable; 039 import java.util.LinkedHashSet; 040 import java.util.Set; 041 042 /** 043 * @author <a href="mailto:poth@lat-lon.de">Andreas Poth </a> 044 * @author last edited by: $Author: mschneider $ 045 * 046 * @version $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $ 047 */ 048 public class OperationParameterIm extends GeneralOperationParameterIm implements Serializable { 049 050 private static final long serialVersionUID = -837184501017553294L; 051 052 private Comparable<?> maximumValue; 053 054 private Comparable<?> minimumValue; 055 056 private Set<?> validValues; 057 058 private Class<?> valueClass; 059 060 private Object defaultValue; 061 062 /** 063 * Convenience constructor. 064 * 065 * @param name 066 * @param validValues 067 */ 068 public OperationParameterIm( String name, String[] validValues ) { 069 this( name, null, 1, 0, null, null, buildSet( validValues ), String.class, null ); 070 } 071 072 /** 073 * Convenience constructor. 074 * 075 * @param name 076 * @param validValues 077 * @param defaultValue to default to. 078 */ 079 public OperationParameterIm( String name, String[] validValues, Object defaultValue ) { 080 this( name, null, 1, 0, null, null, buildSet( validValues ), defaultValue.getClass(), defaultValue ); 081 } 082 083 /** 084 * @param name 085 * @param remarks 086 * @param maximumOccurs 087 * @param minimumOccurs 088 * @param maximumValue 089 * @param minimumValue 090 * @param validValues 091 * @param valueClass 092 * @param defaultValue 093 */ 094 public OperationParameterIm( String name, String remarks, int maximumOccurs, int minimumOccurs, 095 Comparable<?> maximumValue, Comparable<?> minimumValue, Set<?> validValues, Class<?> valueClass, 096 Object defaultValue ) { 097 super( name, remarks, maximumOccurs, minimumOccurs ); 098 this.maximumValue = maximumValue; 099 this.minimumValue = minimumValue; 100 this.validValues = validValues; 101 this.valueClass = valueClass; 102 this.defaultValue = defaultValue; 103 } 104 105 /** 106 * @return Returns the defaultValue. 107 */ 108 public Object getDefaultValue() { 109 return defaultValue; 110 } 111 112 /** 113 * @param defaultValue 114 * The defaultValue to set. 115 */ 116 public void setDefaultValue( Object defaultValue ) { 117 this.defaultValue = defaultValue; 118 } 119 120 /** 121 * @return Returns the maximumValue. 122 * 123 */ 124 public Comparable<?> getMaximumValue() { 125 return maximumValue; 126 } 127 128 /** 129 * @param maximumValue 130 * The maximumValue to set. 131 */ 132 public void setMaximumValue( Comparable<?> maximumValue ) { 133 this.maximumValue = maximumValue; 134 } 135 136 /** 137 * @return Returns the minimumValue. 138 */ 139 public Comparable<?> getMinimumValue() { 140 return minimumValue; 141 } 142 143 /** 144 * @param minimumValue 145 * The minimumValue to set. 146 */ 147 public void setMinimumValue( Comparable<?> minimumValue ) { 148 this.minimumValue = minimumValue; 149 } 150 151 /** 152 * @return Returns the validValues. 153 */ 154 public Set<?> getValidValues() { 155 return validValues; 156 } 157 158 /** 159 * @param validValues 160 * The validValues to set. 161 */ 162 public void setValidValues( Set<?> validValues ) { 163 this.validValues = validValues; 164 } 165 166 /** 167 * @return Returns the valueClass. 168 */ 169 public Class<?> getValueClass() { 170 return valueClass; 171 } 172 173 /** 174 * @param valueClass 175 * The valueClass to set. 176 */ 177 public void setValueClass( Class<?> valueClass ) { 178 this.valueClass = valueClass; 179 } 180 181 /** 182 * 183 * @param values 184 * @return a set of the given String. 185 */ 186 private static Set<String> buildSet( String[] values ) { 187 Set<String> valueSet = new LinkedHashSet<String>(); 188 if ( values != null ) { 189 for ( int i = 0; i < values.length; i++ ) { 190 valueSet.add( values[i] ); 191 } 192 } 193 return valueSet; 194 } 195 }