001/*
002 * Persist.java July 2006
003 *
004 * Copyright (C) 2006, Niall Gallagher <niallg@users.sf.net>
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 
015 * implied. See the License for the specific language governing 
016 * permissions and limitations under the License.
017 */
018
019package org.simpleframework.xml.core;
020
021import java.lang.annotation.RetentionPolicy;
022import java.lang.annotation.Retention;
023
024/**
025 * The <code>Persist</code> annotation is used to mark a method that
026 * requires a callback from the persister before serialization of
027 * an object begins. If a method is marked with this annotation then
028 * it will be invoked so that it can prepare the object for the
029 * serialization process.
030 * <p>
031 * The persist method can be used to perform any preparation needed
032 * before serialization. For example, should the object be a list
033 * or table of sorts the persist method can be used to grab a lock
034 * for the internal data structure. Such a scheme will ensure that
035 * the object is serialized in a known state. The persist method
036 * must be a no argument public method or a method that takes a 
037 * single <code>Map</code> argument, it may throw an exception to 
038 * terminate the serialization process if required.
039 * 
040 * @author Niall Gallagher
041 * 
042 * @see org.simpleframework.xml.core.Complete
043 */
044@Retention(RetentionPolicy.RUNTIME)
045public @interface Persist {
046}