Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbvosburgh2010-03-26 14:18:07 +0000
committerbvosburgh2010-03-26 14:18:07 +0000
commit9878f49a6d1588ed70277904f2e98ccd2fdbcd71 (patch)
treedcbff3511101afe9f5d33320231ee908498c67ad /jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal
parentff6d0e48df2d2502b31c1e2964426433fd293b8e (diff)
downloadwebtools.dali-9878f49a6d1588ed70277904f2e98ccd2fdbcd71.tar.gz
webtools.dali-9878f49a6d1588ed70277904f2e98ccd2fdbcd71.tar.xz
webtools.dali-9878f49a6d1588ed70277904f2e98ccd2fdbcd71.zip
[289664] fix handling of missing platform or connection
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal')
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/NotBooleanTransformer.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/NotBooleanTransformer.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/NotBooleanTransformer.java
new file mode 100644
index 0000000000..998f22a674
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/NotBooleanTransformer.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.utility.internal;
+
+/**
+ * A <code>NotBooleanTransformer</code> will transform a
+ * {@link Boolean} to its NOT value:<ul>
+ * <li>If the original {@link Boolean} is {@link Boolean#TRUE},
+ * the transformer will return {@link Boolean#FALSE}.
+ * <li>If the original {@link Boolean} is {@link Boolean#FALSE},
+ * the transformer will return {@link Boolean#TRUE}.
+ * <li>If the original {@link Boolean} is <code>null</code>,
+ * the transformer will return <code>null</code>.
+ * </ul>
+ */
+public class NotBooleanTransformer
+ implements BidiTransformer<Boolean, Boolean>
+{
+ public static final BidiTransformer<Boolean, Boolean> INSTANCE = new NotBooleanTransformer();
+
+ public static BidiTransformer<Boolean, Boolean> instance() {
+ return INSTANCE;
+ }
+
+ // ensure single instance
+ private NotBooleanTransformer() {
+ super();
+ }
+
+ public Boolean transform(Boolean b) {
+ return (b == null) ? null : BooleanTools.not(b);
+ }
+
+ public Boolean reverseTransform(Boolean b) {
+ return (b == null) ? null : BooleanTools.not(b);
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+
+ private static final long serialVersionUID = 1L;
+ private Object readResolve() {
+ // replace this object with the singleton
+ return INSTANCE;
+ }
+
+}

Back to the top