KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cayenne > Validating


1 /*****************************************************************
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  ****************************************************************/

19 package org.apache.cayenne;
20
21 import org.apache.cayenne.validation.ValidationResult;
22
23 /**
24  * Defines a number of callback methods that allow an object to be validated before safe.
25  * Entity class can implement this interface and its methods will be called automatically.
26  *
27  * @since 3.0
28  * @author Andrus Adamchik
29  */

30 public interface Validating {
31
32     /**
33      * Performs property validation of the NEW object, appending any validation failures
34      * to the provided validationResult object. This method is invoked by ObjectContext
35      * before committing a NEW object to the database.
36      */

37     public void validateForInsert(ValidationResult validationResult);
38
39     /**
40      * Performs property validation of the MODIFIED object, appending any validation
41      * failures to the provided validationResult object. This method is invoked by
42      * ObjectContext before committing a MODIFIED object to the database.
43      */

44     public void validateForUpdate(ValidationResult validationResult);
45
46     /**
47      * Performs property validation of the DELETED object, appending any validation
48      * failures to the provided validationResult object. This method is invoked by
49      * ObjectContext before committing a DELETED object to the database.
50      */

51     public void validateForDelete(ValidationResult validationResult);
52 }
53
Popular Tags