1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.beanutils.locale.converters;
18
19 import java.util.Locale;
20
21
22 /**
23 * <p>Standard {@link org.apache.commons.beanutils.locale.LocaleConverter}
24 * implementation that converts an incoming
25 * locale-sensitive String into a <code>java.lang.Long</code> object,
26 * optionally using a default value or throwing a
27 * {@link org.apache.commons.beanutils.ConversionException}
28 * if a conversion error occurs.</p>
29 *
30 * @author Yauheny Mikulski
31 */
32
33 public class LongLocaleConverter extends DecimalLocaleConverter {
34
35
36
37
38 /**
39 * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter}
40 * that will throw a {@link org.apache.commons.beanutils.ConversionException}
41 * if a conversion error occurs. The locale is the default locale for
42 * this instance of the Java Virtual Machine and an unlocalized pattern is used
43 * for the convertion.
44 *
45 */
46 public LongLocaleConverter() {
47
48 this(false);
49 }
50
51 /**
52 * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter}
53 * that will throw a {@link org.apache.commons.beanutils.ConversionException}
54 * if a conversion error occurs. The locale is the default locale for
55 * this instance of the Java Virtual Machine.
56 *
57 * @param locPattern Indicate whether the pattern is localized or not
58 */
59 public LongLocaleConverter(boolean locPattern) {
60
61 this(Locale.getDefault(), locPattern);
62 }
63
64 /**
65 * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter}
66 * that will throw a {@link org.apache.commons.beanutils.ConversionException}
67 * if a conversion error occurs. An unlocalized pattern is used for the convertion.
68 *
69 * @param locale The locale
70 */
71 public LongLocaleConverter(Locale locale) {
72
73 this(locale, false);
74 }
75
76 /**
77 * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter}
78 * that will throw a {@link org.apache.commons.beanutils.ConversionException}
79 * if a conversion error occurs.
80 *
81 * @param locale The locale
82 * @param locPattern Indicate whether the pattern is localized or not
83 */
84 public LongLocaleConverter(Locale locale, boolean locPattern) {
85
86 this(locale, (String) null, locPattern);
87 }
88
89 /**
90 * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter}
91 * that will throw a {@link org.apache.commons.beanutils.ConversionException}
92 * if a conversion error occurs. An unlocalized pattern is used for the convertion.
93 *
94 * @param locale The locale
95 * @param pattern The convertion pattern
96 */
97 public LongLocaleConverter(Locale locale, String pattern) {
98
99 this(locale, pattern, false);
100 }
101
102 /**
103 * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter}
104 * that will throw a {@link org.apache.commons.beanutils.ConversionException}
105 * if a conversion error occurs.
106 *
107 * @param locale The locale
108 * @param pattern The convertion pattern
109 * @param locPattern Indicate whether the pattern is localized or not
110 */
111 public LongLocaleConverter(Locale locale, String pattern, boolean locPattern) {
112
113 super(locale, pattern, locPattern);
114 }
115
116 /**
117 * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter}
118 * that will return the specified default value
119 * if a conversion error occurs. The locale is the default locale for
120 * this instance of the Java Virtual Machine and an unlocalized pattern is used
121 * for the convertion.
122 *
123 * @param defaultValue The default value to be returned
124 */
125 public LongLocaleConverter(Object defaultValue) {
126
127 this(defaultValue, false);
128 }
129
130 /**
131 * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter}
132 * that will return the specified default value
133 * if a conversion error occurs. The locale is the default locale for
134 * this instance of the Java Virtual Machine.
135 *
136 * @param defaultValue The default value to be returned
137 * @param locPattern Indicate whether the pattern is localized or not
138 */
139 public LongLocaleConverter(Object defaultValue, boolean locPattern) {
140
141 this(defaultValue, Locale.getDefault(), locPattern);
142 }
143
144 /**
145 * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter}
146 * that will return the specified default value
147 * if a conversion error occurs. An unlocalized pattern is used for the convertion.
148 *
149 * @param defaultValue The default value to be returned
150 * @param locale The locale
151 */
152 public LongLocaleConverter(Object defaultValue, Locale locale) {
153
154 this(defaultValue, locale, false);
155 }
156
157 /**
158 * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter}
159 * that will return the specified default value
160 * if a conversion error occurs.
161 *
162 * @param defaultValue The default value to be returned
163 * @param locale The locale
164 * @param locPattern Indicate whether the pattern is localized or not
165 */
166 public LongLocaleConverter(Object defaultValue, Locale locale, boolean locPattern) {
167
168 this(defaultValue, locale, null, locPattern);
169 }
170
171 /**
172 * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter}
173 * that will return the specified default value
174 * if a conversion error occurs. An unlocalized pattern is used for the convertion.
175 *
176 * @param defaultValue The default value to be returned
177 * @param locale The locale
178 * @param pattern The convertion pattern
179 */
180 public LongLocaleConverter(Object defaultValue, Locale locale, String pattern) {
181
182 this(defaultValue, locale, pattern, false);
183 }
184
185 /**
186 * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter}
187 * that will return the specified default value
188 * if a conversion error occurs.
189 *
190 * @param defaultValue The default value to be returned
191 * @param locale The locale
192 * @param pattern The convertion pattern
193 * @param locPattern Indicate whether the pattern is localized or not
194 */
195 public LongLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean locPattern) {
196
197 super(defaultValue, locale, pattern, locPattern);
198 }
199 }