View Javadoc

1   /*
2   Copyright (C) 2000 - 2007 Grid Systems, S.A.
3   
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU General Public License, version 2, as
6   published by the Free Software Foundation.
7   
8   This program is distributed in the hope that it will be useful,
9   but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12  
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  */
17  
18  /*
19   * Project: KernelConfigurator
20   * Created on 04-mar-2004
21   *
22   * Copyright (c)2003 Grid Systems
23   */
24  package com.gridsystems.config.modules.jvm;
25  
26  import com.gridsystems.config.tools.ErrorSupport;
27  import com.gridsystems.config.tools.PatternVerifier;
28  
29  /**
30   * Verifies the correctness of a memory size value.
31   *
32   * @author <a href="mailto:rruiz@gridsystems.com">Rodrigo Ruiz Aguayo</a>
33   * @version 1.0
34   */
35  public class MemSizeVerifier extends PatternVerifier {
36  
37    /**
38     * Creates an instance of this verifier.
39     *
40     * @param support The ErrorSupport instance
41     * @param id      The error identifier
42     */
43    public MemSizeVerifier(ErrorSupport support, String id) {
44      super(support, id, "^[1-9][0-9]*");
45    }
46  
47  
48    /**
49     * Creates an instance of this verifier.
50     *
51     * @param support The ErrorSupport instance
52     * @param id      The error identifier
53     * @param canBeEmpty Say us if this field can be empty.
54     */
55    public MemSizeVerifier(ErrorSupport support, String id, boolean canBeEmpty) {
56      super(support, id, canBeEmpty ? "^\\d*$" : "^[1-9][0-9]*");
57    }
58  }