01: package org.apache.ojb.broker.util;
02:
03: /* Copyright 2002-2005 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: import java.io.Serializable;
19:
20: /**
21: *
22: * The Interface ObjectModification represents information about
23: * modifications of persistence capable objects.
24: * Allows clients of the PersistenceBroker (e.g. a TransactionServer)
25: * to interact with the Broker in order to generate optimized SQL Statements.
26: *
27: * @author Thomas Mahler
28: * @version $Id: ObjectModification.java,v 1.6.2.2 2005/12/21 22:27:47 tomdz Exp $
29: */
30: public interface ObjectModification extends Serializable {
31: static final long serialVersionUID = -3208237880606252967L;
32:
33: /**
34: * Default implementation of this interface usable for INSERT.
35: */
36: public static final ObjectModification INSERT = new ObjectModification() {
37: public boolean needsInsert() {
38: return true;
39: }
40:
41: public boolean needsUpdate() {
42: return false;
43: }
44: };
45:
46: /**
47: * Default implementation of this interface usable for UPDATE.
48: */
49: public static final ObjectModification UPDATE = new ObjectModification() {
50: public boolean needsInsert() {
51: return false;
52: }
53:
54: public boolean needsUpdate() {
55: return true;
56: }
57: };
58:
59: /**
60: * Returns true if the underlying Object needs an INSERT statement.
61: * else Returns false.
62: */
63: public boolean needsInsert();
64:
65: /**
66: * Returns true if the underlying Object needs an UPDATE statement.
67: * else Returns false.
68: */
69: public boolean needsUpdate();
70: }
|