View Javadoc

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 floating point 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 float types like
29   * <code>java.lang.Float</code> or <code>java.lang.Double</code>.
30   * </p>
31   *
32   * @author Oliver Heger
33   * @version $Id: AbstractDecimalTransformer.java 205 2012-01-29 18:29:57Z oheger $
34   * @param <T> the data type handled by this transformer class
35   */
36  public abstract class AbstractDecimalTransformer<T extends Number> extends
37          NumberTransformerBase<T>
38  {
39      /**
40       * Returns a format object suitable for parsing doubles.
41       *
42       * @param locale the locale
43       * @return the format object
44       */
45      @Override
46      protected NumberFormat createFormat(Locale locale)
47      {
48          return NumberFormat.getInstance(locale);
49      }
50  }