| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ObjectModification |
|
| 1.0;1 | ||||
| ObjectModification$1 |
|
| 1.0;1 | ||||
| ObjectModification$2 |
|
| 1.0;1 |
| 1 | package org.apache.ojb.broker.util; | |
| 2 | ||
| 3 | /* Copyright 2002-2005 The Apache Software Foundation | |
| 4 | * | |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 6 | * you may not use this file except in compliance with the License. | |
| 7 | * You may obtain a copy of the License at | |
| 8 | * | |
| 9 | * 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.1 2007-08-24 22:17:36 ewestfal Exp $ | |
| 29 | */ | |
| 30 | public interface ObjectModification extends Serializable | |
| 31 | { | |
| 32 | static final long serialVersionUID = -3208237880606252967L; | |
| 33 | ||
| 34 | /** | |
| 35 | * Default implementation of this interface usable for INSERT. | |
| 36 | */ | |
| 37 | public static final ObjectModification INSERT = new ObjectModification() | |
| 38 | { | |
| 39 | public boolean needsInsert() | |
| 40 | { | |
| 41 | return true; | |
| 42 | } | |
| 43 | ||
| 44 | public boolean needsUpdate() | |
| 45 | { | |
| 46 | return false; | |
| 47 | } | |
| 48 | }; | |
| 49 | ||
| 50 | /** | |
| 51 | * Default implementation of this interface usable for UPDATE. | |
| 52 | */ | |
| 53 | public static final ObjectModification UPDATE = new ObjectModification() | |
| 54 | { | |
| 55 | public boolean needsInsert() | |
| 56 | { | |
| 57 | return false; | |
| 58 | } | |
| 59 | ||
| 60 | public boolean needsUpdate() | |
| 61 | { | |
| 62 | return true; | |
| 63 | } | |
| 64 | }; | |
| 65 | ||
| 66 | /** | |
| 67 | * Returns true if the underlying Object needs an INSERT statement. | |
| 68 | * else Returns false. | |
| 69 | */ | |
| 70 | public boolean needsInsert(); | |
| 71 | ||
| 72 | /** | |
| 73 | * Returns true if the underlying Object needs an UPDATE statement. | |
| 74 | * else Returns false. | |
| 75 | */ | |
| 76 | public boolean needsUpdate(); | |
| 77 | } |