KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > internal > databinding > validation > StringToLongValidator


1 /*******************************************************************************
2  * Copyright (c) 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  ******************************************************************************/

11
12 package org.eclipse.core.internal.databinding.validation;
13
14 import org.eclipse.core.internal.databinding.conversion.StringToNumberParser;
15
16 /**
17  * Validates that a string is of the appropriate format and is in the range of
18  * an long.
19  *
20  * @since 1.0
21  */

22 public class StringToLongValidator extends AbstractStringToNumberValidator {
23     private static final Long JavaDoc MIN = new Long JavaDoc(Long.MIN_VALUE);
24     private static final Long JavaDoc MAX = new Long JavaDoc(Long.MAX_VALUE);
25
26     /**
27      * @param converter
28      */

29     public StringToLongValidator(NumberFormatConverter converter) {
30         super(converter, MIN, MAX);
31     }
32
33     /* (non-Javadoc)
34      * @see org.eclipse.core.internal.databinding.validation.AbstractStringToNumberValidator#inRange(java.lang.Number)
35      */

36     protected boolean isInRange(Number JavaDoc number) {
37         return StringToNumberParser.inLongRange(number);
38     }
39 }
40
Popular Tags