| BooleanWrapper.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 2.1 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
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 }