|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
Parameters.java | - | - | - | - |
|
1 |
/*
|
|
2 |
* Copyright (C) The JContainer Group. All rights reserved.
|
|
3 |
*
|
|
4 |
* This software is published under the terms of the JContainer
|
|
5 |
* Software License version 1.1, a copy of which has been included
|
|
6 |
* with this distribution in the LICENSE.txt file.
|
|
7 |
*/
|
|
8 |
package org.jcontainer.dna;
|
|
9 |
|
|
10 |
/**
|
|
11 |
* Parameters present flat configuration data. Contained
|
|
12 |
* in the Parameters object is a set of name-value pairs.
|
|
13 |
*
|
|
14 |
* @version $Revision: 1.9 $ $Date: 2003/09/23 08:10:14 $
|
|
15 |
*/
|
|
16 |
public interface Parameters |
|
17 |
{ |
|
18 |
/**
|
|
19 |
* Return the names of all the parameters.
|
|
20 |
*
|
|
21 |
* @return the names of all the parameters.
|
|
22 |
*/
|
|
23 |
String[] getParameterNames(); |
|
24 |
|
|
25 |
/**
|
|
26 |
* Return true of parameter with specified name exists.
|
|
27 |
*
|
|
28 |
* @param name the name
|
|
29 |
* @return true of parameter with specified name exists.
|
|
30 |
*/
|
|
31 |
boolean isParameter( String name );
|
|
32 |
|
|
33 |
/**
|
|
34 |
* Return value of parameter with specified name.
|
|
35 |
*
|
|
36 |
* @param name the name
|
|
37 |
* @return the value
|
|
38 |
* @throws ParameterException if unable to locate parameter
|
|
39 |
*/
|
|
40 |
String getParameter( String name ) |
|
41 |
throws ParameterException;
|
|
42 |
|
|
43 |
/**
|
|
44 |
* Return value of parameter with specified name.
|
|
45 |
*
|
|
46 |
* @param name the name
|
|
47 |
* @param defaultValue the defaultValue if specified parameter
|
|
48 |
* does not exist
|
|
49 |
* @return the value
|
|
50 |
*/
|
|
51 |
String getParameter( String name, String defaultValue ); |
|
52 |
|
|
53 |
/**
|
|
54 |
* Return value of parameter with specified name as an integer.
|
|
55 |
*
|
|
56 |
* @param name the name
|
|
57 |
* @return the value
|
|
58 |
* @throws ParameterException if unable to locate parameter
|
|
59 |
* or parameter can not be converted to correct type
|
|
60 |
*/
|
|
61 |
int getParameterAsInteger( String name )
|
|
62 |
throws ParameterException;
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Return value of parameter with specified name as an integer.
|
|
66 |
*
|
|
67 |
* @param name the name
|
|
68 |
* @param defaultValue the defaultValue if specified parameter
|
|
69 |
* does not exist or parameter can not be converted to
|
|
70 |
* the correct type
|
|
71 |
* @return the value
|
|
72 |
*/
|
|
73 |
int getParameterAsInteger( String name, int defaultValue ); |
|
74 |
|
|
75 |
/**
|
|
76 |
* Return value of parameter with specified name as a long.
|
|
77 |
*
|
|
78 |
* @param name the name
|
|
79 |
* @return the value
|
|
80 |
* @throws ParameterException if unable to locate parameter
|
|
81 |
* or parameter can not be converted to correct type
|
|
82 |
*/
|
|
83 |
long getParameterAsLong( String name )
|
|
84 |
throws ParameterException;
|
|
85 |
|
|
86 |
/**
|
|
87 |
* Return value of parameter with specified name as a long.
|
|
88 |
*
|
|
89 |
* @param name the name
|
|
90 |
* @param defaultValue the defaultValue if specified parameter
|
|
91 |
* does not exist or parameter can not be converted to
|
|
92 |
* the correct type
|
|
93 |
* @return the value
|
|
94 |
*/
|
|
95 |
long getParameterAsLong( String name, long defaultValue ); |
|
96 |
|
|
97 |
/**
|
|
98 |
* Return value of parameter with specified name as a boolean.
|
|
99 |
*
|
|
100 |
* @param name the name
|
|
101 |
* @return the value
|
|
102 |
* @throws ParameterException if unable to locate parameter
|
|
103 |
* or parameter can not be converted to correct type
|
|
104 |
*/
|
|
105 |
boolean getParameterAsBoolean( String name )
|
|
106 |
throws ParameterException;
|
|
107 |
|
|
108 |
/**
|
|
109 |
* Return value of parameter with specified name as a boolean.
|
|
110 |
*
|
|
111 |
* @param name the name
|
|
112 |
* @param defaultValue the defaultValue if specified parameter
|
|
113 |
* does not exist or parameter can not be converted to
|
|
114 |
* the correct type
|
|
115 |
* @return the value
|
|
116 |
*/
|
|
117 |
boolean getParameterAsBoolean( String name, boolean defaultValue ); |
|
118 |
|
|
119 |
/**
|
|
120 |
* Return value of parameter with specified name as a float.
|
|
121 |
*
|
|
122 |
* @param name the name
|
|
123 |
* @return the value
|
|
124 |
* @throws ParameterException if unable to locate parameter
|
|
125 |
* or parameter can not be converted to correct type
|
|
126 |
*/
|
|
127 |
float getParameterAsFloat( String name )
|
|
128 |
throws ParameterException;
|
|
129 |
|
|
130 |
/**
|
|
131 |
* Return value of parameter with specified name as a float.
|
|
132 |
*
|
|
133 |
* @param name the name
|
|
134 |
* @param defaultValue the defaultValue if specified parameter
|
|
135 |
* does not exist or parameter can not be converted to
|
|
136 |
* the correct type
|
|
137 |
* @return the value
|
|
138 |
*/
|
|
139 |
float getParameterAsFloat( String name, float defaultValue ); |
|
140 |
|
|
141 |
/**
|
|
142 |
* Return a Parameters object that represents a
|
|
143 |
* subset of parameters with specified prefix. The child
|
|
144 |
* parameters has a prefix with the separator ('.') appended.
|
|
145 |
* ie. if the prefix was "foo" then the parameter
|
|
146 |
* "foo.baz" would be included in child Parameters object
|
|
147 |
* using the key "baz".
|
|
148 |
*
|
|
149 |
* @param prefix the prefix
|
|
150 |
* @return the parameters object
|
|
151 |
*/
|
|
152 |
Parameters getChildParameters( String prefix ); |
|
153 |
} |
|
154 |
|
|