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.Integer type.

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

Parameters:
type Integer 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.
    IntegerConverter(Class<IntegertypeString pattern) {
        super(pattern);
        this. = Assert.notNull(type"type");
    }
    
    
Constructs a new IntegerConverter from the specified annotation and type.

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

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

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