Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /* 
  * Copyright (C) 2012 FoxLabs
  * 
  * 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.foxlabs.validation.converter;
This class provides NumberConverter implementation for the java.lang.Double type.

public final class DoubleConverter extends NumberConverter.DecimalType<Double> {
    
    
DoubleConverter primitive type instance.
    public static final DoubleConverter SIMPLE = new DoubleConverter(.null);
    
    
DoubleConverter object type instance.
    public static final DoubleConverter OBJECT = new DoubleConverter(Double.classnull);
    
    
Double type (can be either primitive or object type).
    private final Class<Doubletype;
    
    
Constructs a new DoubleConverter with the specified type and pattern.

Parameters:
type Double type.
pattern java.text.DecimalFormat pattern or null if context pattern should be used.
Throws:
java.lang.IllegalArgumentException if the specified type is null or the specified pattern is invalid.
    DoubleConverter(Class<DoubletypeString pattern) {
        super(pattern);
        this. = Assert.notNull(type"type");
    }
    
    
Constructs a new DoubleConverter from the specified annotation and type.

Parameters:
annotation Converter annotation.
type Double type.
Throws:
java.lang.IllegalArgumentException if the specified annotation defines invalid pattern.
    DoubleConverter(NumberPattern annotationClass<Doubletype) {
        this(typeannotation.value());
    }
    
    
Returns java.lang.Double type.

Returns:
java.lang.Double type.
    @Override
    public Class<DoublegetType() {
        return ;
    }
    
    
Converts default string representation of double value into java.lang.Double object.

Parameters:
value Default string representation of double value.
Returns:
Decoded java.lang.Double object.
Throws:
java.lang.NumberFormatException if the specified string could not be parsed as a decimal or value is out of range.
    @Override
    protected Double doDecodeDefault(String value) {
        return Double.valueOf(value);
    }
    
New to GrepCode? Check out our FAQ X