1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  package org.kuali.rice.core.api.criteria;
17  
18  import org.apache.commons.lang.StringUtils;
19  import org.kuali.rice.core.api.CoreConstants;
20  import org.w3c.dom.Element;
21  
22  import javax.xml.bind.annotation.XmlAccessType;
23  import javax.xml.bind.annotation.XmlAccessorType;
24  import javax.xml.bind.annotation.XmlAnyElement;
25  import javax.xml.bind.annotation.XmlAttribute;
26  import javax.xml.bind.annotation.XmlRootElement;
27  import javax.xml.bind.annotation.XmlType;
28  import java.util.Collection;
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  @XmlRootElement(name = NullPredicate.Constants.ROOT_ELEMENT_NAME)
40  @XmlAccessorType(XmlAccessType.NONE)
41  @XmlType(name = NullPredicate.Constants.TYPE_NAME, propOrder = {
42      CoreConstants.CommonElements.FUTURE_ELEMENTS
43  })
44  public final class NullPredicate extends AbstractPredicate implements PropertyPathPredicate {
45  	
46  	private static final long serialVersionUID = 2397296074921454859L;
47  	
48  	@XmlAttribute(name = CriteriaSupportUtils.PropertyConstants.PROPERTY_PATH)
49  	private final String propertyPath;
50  
51      @SuppressWarnings("unused")
52      @XmlAnyElement
53      private final Collection<Element> _futureElements = null;
54  
55  	
56  
57  
58      @SuppressWarnings("unused")
59      private NullPredicate() {
60          this.propertyPath = null;
61      }
62      
63      
64  
65  
66  
67  
68  
69  
70      NullPredicate(String propertyPath) {
71      	if (StringUtils.isBlank(propertyPath)) {
72  			throw new IllegalArgumentException("Property path cannot be null or blank.");
73  		}
74  		this.propertyPath = propertyPath;
75      }
76  
77      @Override
78      public String getPropertyPath() {
79      	return propertyPath;
80      }
81          
82  	
83  
84  
85      static class Constants {
86          final static String ROOT_ELEMENT_NAME = "null";
87          final static String TYPE_NAME = "NullType";
88      }
89  
90      @Override
91      public String toString() {
92          return new StringBuilder(CriteriaSupportUtils.findDynName(this.getClass().getSimpleName()))
93                  .append("(").append(this.getPropertyPath()).append(")").toString();
94      }
95  }