Skip to content

Package: PropertyHelper

PropertyHelper

nameinstructionbranchcomplexitylinemethod
toggle(Property)
M: 15 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2017 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Mat Hansen - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emfforms.internal.common;
15:
16: import org.eclipse.emfforms.common.Property;
17:
18: /**
19: * Property Helper class.
20: *
21: * @author Mat Hansen
22: * @since 1.15
23: *
24: */
25: public final class PropertyHelper {
26:
27:         /**
28:          * The constructor.
29:          */
30:         private PropertyHelper() {
31:         }
32:
33:         /**
34:          * Invert the state of a Boolean property.
35:          * Null values will be toggled to true.
36:          *
37:          * @param property the property to toggle
38:          * @return the toggled property
39:          */
40:         public static Property<Boolean> toggle(Property<Boolean> property) {
41:•                property.setValue(!Boolean.valueOf(property.getValue()));
42:                 return property;
43:         }
44:
45: }