1 /*
2 * Copyright 2006-2016 The JGUIraffe Team.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License")
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package net.sf.jguiraffe.gui.forms.bind;
17
18 import net.sf.jguiraffe.gui.forms.BindingStrategy;
19
20 /**
21 * <p>
22 * A dummy implementation of the {@code BindingStrategy} interface.
23 * </p>
24 * <p>
25 * This strategy can be used when no specific (functional) {@code
26 * BindingStrategy} implementation is available or is needed (for instance as an
27 * application of the <em>null object</em> pattern). All methods are implemented
28 * as dummies that do not provide any specific functionality - refer to the
29 * documentation of the single methods for more details.
30 * </p>
31 * <p>
32 * It is not possible to create instances of this class. Instead the static
33 * {@code INSTANCE} field can be used. This instance can be shared between
34 * multiple threads.
35 * </p>
36 *
37 * @author Oliver Heger
38 * @version $Id: DummyBindingStrategy.java 205 2012-01-29 18:29:57Z oheger $
39 */
40 public final class DummyBindingStrategy implements BindingStrategy
41 {
42 /**
43 * Constant for the shared instance of this class that can be used.
44 */
45 public static final DummyBindingStrategy INSTANCE = new DummyBindingStrategy();
46
47 /**
48 * Private constructor so no instances can be created.
49 */
50 private DummyBindingStrategy()
51 {
52 }
53
54 /**
55 * Reads a property from the given model object. This is just a dummy
56 * implementation that returns always <b>null</b>.
57 *
58 * @param model the model object
59 * @param propertyName the name of the property
60 * @return the value of this property
61 */
62 public Object readProperty(Object model, String propertyName)
63 {
64 return null;
65 }
66
67 /**
68 * Writes a property of the given model object. This is just a dummy
69 * implementation. No property is actually written.
70 *
71 * @param model the model object
72 * @param propertyName the name of the property
73 * @param value the value of the property
74 */
75 public void writeProperty(Object model, String propertyName, Object value)
76 {
77 }
78 }