| BooleanWrapper.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * The contents of this file are subject to the terms of the Liferay Enterprise
5 * Subscription License ("License"). You may not use this file except in
6 * compliance with the License. You can obtain a copy of the License by
7 * contacting Liferay, Inc. See the License for the specific language governing
8 * permissions and limitations under the License, including but not limited to
9 * distribution rights of the Software.
10 *
11 *
12 *
13 */
14
15 package com.liferay.portal.kernel.util;
16
17 /**
18 * <a href="BooleanWrapper.java.html"><b><i>View Source</i></b></a>
19 *
20 * @author Brian Wing Shun Chan
21 */
22 public class BooleanWrapper
23 extends PrimitiveWrapper implements Comparable<BooleanWrapper> {
24
25 public static final Class<?> TYPE = Boolean.TYPE;
26
27 public BooleanWrapper() {
28 this(false);
29 }
30
31 public BooleanWrapper(boolean value) {
32 _value = value;
33 }
34
35 public int compareTo(BooleanWrapper booleanWrapper) {
36 if (booleanWrapper == null) {
37 return 1;
38 }
39
40 if (getValue() && !booleanWrapper.getValue()) {
41 return 1;
42 }
43 else if (!getValue() && booleanWrapper.getValue()) {
44 return -1;
45 }
46 else {
47 return 0;
48 }
49 }
50
51 public boolean getValue() {
52 return _value;
53 }
54
55 public void setValue(boolean value) {
56 _value = value;
57 }
58
59 private boolean _value;
60
61 }