summaryrefslogtreecommitdiff
path: root/src/plugins/preflighting.core/src/com/motorolamobility/preflighting/core/validation/ParameterDescription.java
blob: 75b022899328b463ebfa405a01331e6d133cf92c (plain)
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
/*
 * Copyright (C) 2012 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.motorolamobility.preflighting.core.validation;

import java.util.ArrayList;
import java.util.List;

/**
 * This class contains the description for a given parameter.
 */
public class ParameterDescription
{
    private String name = null;

    private String description = null;

    private String valueDescription = null;

    private boolean valueRequired = false;

    /**
     * The type of value held by the parameter
     */
    private ParameterType Type;

    /**
     * Default value
     */
    private Value defaultValue = null;

    /**
     * List of values allowed from this parameter
     */
    private List<Value> allowedValues = new ArrayList<Value>();

    /**
     * Gets the list of {@link Value} objects which are allowed.
     * 
     * @return Returns a {@link List} of values which are allowed as parameters.
     */
    public List<Value> getAllowedValues()
    {
        return allowedValues;
    }

    /**
     * Sets the {@link List} of {@link Value} objects which are allowed.
     * 
     * @param allowedValues {@link List} of allowed {@link Value} objects to be set.
     */
    public void setAllowedValues(List<Value> allowedValues)
    {
        this.allowedValues = allowedValues;
    }

    /**
     * Gets the description of a Parameter (e.g. used in help)
     * 
     * @return Return the description of a Parameter.
     */
    public String getDescription()
    {
        return description;
    }

    /**
     * Sets the description of a Parameter.
     * 
     * @param description The description of a Parameter to be set.
     */
    public void setDescription(String description)
    {
        this.description = description;
    }

    /**
     * Gets the default value of a Parameter
     * 
     * @return Returns the default value of a Parameter.
     */
    public Value getDefaultValue()
    {
        return defaultValue;
    }

    /**
     * Sets the default value of a Parameter.
     * 
     * @param defaultValue The default value of a Parameter to be set.
     */
    public void setDefaultValue(Value defaultValue)
    {
        this.defaultValue = defaultValue;
    }

    /**
     * Gets the Parameter object name.
     * 
     * @return Returns the Parameter object name.
     */
    public String getName()
    {
        return name;
    }

    /**
     * Sets the Parameter object´s name.
     * 
     * @param name Parameter´s name to be set.
     */
    public void setName(String name)
    {
        this.name = name;
    }

    /**
     * Gets the {@link ParameterType}. This represents the several
     * object which a {@link ParameterDescription} can have.
     * 
     * @return Returns the {@link ParameterType} of this instance.
     */
    public ParameterType getType()
    {
        return Type;
    }

    /**
     * Set the {@link ParameterType} of this instance. This represents the several
     * object which a {@link ParameterDescription} can have.
     * 
     * @param type The {@link ParameterType} to be set.
     */
    public void setType(ParameterType type)
    {
        Type = type;
    }

    /**
     * Gets a description of the value being assigned to a parameter (used in help)
     * 
     * @return Returns the value description.
     */
    public String getValueDescription()
    {
        return valueDescription;
    }

    /**
     * Sets the description of the value being assigned to a parameter (used in help).
     * 
     * @param description The value description to be set.
     */
    public void setValueDescription(String description)
    {
        this.valueDescription = description;
    }

    /**
     * Returns <code>true</code> if this parameter is required, 
     * <code>false</code> otherwise.
     * 
     * @return <code>true</code> if required, <code>false</code> otherwise
     */
    public boolean isValueRequired()
    {
        return valueRequired;
    }

    /**
     * Sets if the value is required to run the checker or condition.
     * 
     * @param valueRequired Set <code>true</code> in case this {@link ParameterDescription}
     * is required, <code>false</code> otherwise.
     */
    public void setValueRequired(boolean valueRequired)
    {
        this.valueRequired = valueRequired;
    }

    /**
     * This implementation provides a human-readable text of this
     * {@link ParameterDescription}.
     * 
     * @return Returns a human-readable text of this {@link ParameterDescription}.
     * 
     * @see Object#toString()
     */
    @Override
    public String toString()
    {
        return "ParameterDescription [name=" + name + ", description=" + description //$NON-NLS-1$ //$NON-NLS-2$
                + ", defaulfValue=" + defaultValue + ", allowedValues=" + allowedValues + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }

}