1 /*
2 * Copyright 2006-2016 The JGUIraffe Team.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License")
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package net.sf.jguiraffe.transform;
17
18 import java.text.NumberFormat;
19 import java.util.Locale;
20
21 /**
22 * <p>
23 * A base class for number transformers that operate on integer numbers.
24 * </p>
25 * <p>
26 * This base class already implements the creation of the
27 * <code>NumberFormat</code> object used for parsing the entered numbers.
28 * Concrete sub classes specialize on specific integer types like
29 * <code>java.lang.Integer</code> or <code>java.lang.Long</code>.
30 * </p>
31 *
32 * @author Oliver Heger
33 * @version $Id: AbstractIntegerTransformer.java 205 2012-01-29 18:29:57Z oheger $
34 * @param <T> the concrete type of integer numbers this transformer deals with
35 */
36 public abstract class AbstractIntegerTransformer<T extends Number> extends
37 NumberTransformerBase<T>
38 {
39 /**
40 * Creates the format object for parsing user input. This implementation
41 * returns a format for parsing integers.
42 *
43 * @param locale the locale
44 * @return the format object
45 */
46 @Override
47 protected NumberFormat createFormat(Locale locale)
48 {
49 return NumberFormat.getIntegerInstance(locale);
50 }
51 }