Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2004-2008 the original author or authors.
  *
  * 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 org.springframework.binding.format;
Works with a general purpose java.text.DecimalFormat instance returned by calling java.text.NumberFormat.getInstance(java.util.Locale) by default. This instance supports parsing any number type generally and will not perform special type-specific logic such as rounding or truncation.

Author(s):
Keith Donald
See also:
java.text.NumberFormat
java.text.DecimalFormat
	private static Log logger = LogFactory.getLog(DefaultNumberFormatFactory.class);
	private String pattern;

The pattern to use to format number values. If not specified, the default DecimalFormat pattern is used.

Returns:
the date formatting pattern
	public String getPattern() {
		return ;
	}

Sets the pattern for formatting numbers.

Parameters:
pattern the format pattern
See also:
java.text.DecimalFormat
	public void setPattern(String pattern) {
		this. = pattern;
	}
	protected NumberFormat getNumberFormat(Locale locale) {
		NumberFormat format = NumberFormat.getInstance(locale);
		if ( != null) {
			if (format instanceof DecimalFormat) {
else {
				.warn("Unable to apply format pattern '" + 
"'; Returned NumberFormat is not a DecimalFormat");
			}
		}
		return format;
	}
New to GrepCode? Check out our FAQ X