Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/presumo/jms/selector/SelectorFalseException.java


1   /**
2    * This file is part of Presumo.
3    *
4    * Presumo is free software; you can redistribute it and/or modify
5    * it under the terms of the GNU General Public License as published by
6    * the Free Software Foundation; either version 2 of the License, or
7    * (at your option) any later version.
8    *
9    * Presumo is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with Presumo; if not, write to the Free Software
16   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17   *
18   *
19   * Copyright 2001 Dan Greff
20   */
21  package com.presumo.jms.selector;
22  
23  /**
24   * JMS defines some conditions that will always render a selector
25   * false.  One example is trying to add two strings.  While the
26   * parser can detect errors in literals at parse time, it can not
27   * tell what type an identifier is until evaluation time.  If an
28   * identifier type is incorrectly used JMS says that the selector
29   * is invalid.  Another example would be referencing an object 
30   * property from anywhere in the sql expression.
31   *
32   * The evaluate methods will throw this exception if they encounter
33   * a situation like the ones above.  This will effectively short-circuit
34   * the evaluation.  If you call evaluate on the node in the expression
35   * tree you must catch this exception.  If it occurs you can assume
36   * the selector is false.  If the selector does not throw an
37   * exception you still have to check the return type to see if
38   * the evaluation was true or false or unknown. (unknown == false).
39   *
40   * @author Dan Greff
41   */
42  public final class SelectorFalseException extends Exception 
43  {
44    //
45    // No reason to have multiple instance of this class so it
46    // is a singleton.
47    //
48    
49    private static SelectorFalseException onlyInstance;
50    
51    static SelectorFalseException getInstance()
52    {
53      if (onlyInstance == null)
54        onlyInstance = new SelectorFalseException();
55      return onlyInstance;
56    }
57  
58    private SelectorFalseException() {}
59  
60  }