01: /**
02: * $Id: BeanTestNotTag.java,v 1.2 2002/06/01 22:16:15 sorensen Exp $
03: * Copyright 2002 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.wireless.taglibs.base;
14:
15: import java.beans.*;
16: import javax.servlet.jsp.*;
17:
18: /**
19: * BeanTestNotTag - test a bean property
20: *
21: * Evaluates the body if the property is false; else skips the body.
22: * This is the opposite of BeanTestTag.
23: *
24: * A bean property is evaluated as follows:
25: * - if the property value is null then return false
26: * - if the value is a boolean then return the boolean value
27: * - if the value is some other object then compare it to the specified value
28: *
29: * Attributes:
30: *
31: * property
32: * name of the bean property to test
33: * value
34: * value of the bean property to test; optional
35: * id
36: * object value of the bean property to test; optional
37: * name
38: * name to use to find the bean on the page context
39: *
40: * @author Robert O'Brien
41: * @version 1.0
42: * @see BeanSetTag
43: * @see BeanSupport
44: */
45: public class BeanTestNotTag extends BeanTestTag {
46:
47: /**
48: * Evaluate a bean property; invert the BeanTest evaluation
49: *
50: * @param prop the bean property value to test
51: * @param test the test value to compare against
52: * @return true if the two values are considered equivalent
53: */
54: public boolean evaluate(Object prop, Object test) {
55: return !super.evaluate(prop, test);
56: }
57: }
|