com.intellij.openapi.components.PersistentStateComponent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core-api Show documentation
Show all versions of core-api Show documentation
A packaging of the IntelliJ Community Edition core-api library.
This is release number 1 of trunk branch 142.
The newest version!
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.openapi.components;
import com.intellij.util.xmlb.XmlSerializer;
import org.jetbrains.annotations.Nullable;
/**
* Every component which would like to persist its state across IDEA restarts
* should implement this interface.
*
* See JetBrains WIKI
* for detailed description.
*/
public interface PersistentStateComponent {
/**
* @return a component state. All properties and public fields are serialized. Only values, which differ
* from default (i.e. the value of newly instantiated class) are serialized. null
value indicates
* that no state should be stored
* @see XmlSerializer
*/
@Nullable
T getState();
/**
* This method is called when new component state is loaded. A component should expect this method
* to be called at any moment of its lifecycle. The method can and will be called several times, if
* config files were externally changed while IDEA running.
* @param state loaded component state
* @see com.intellij.util.xmlb.XmlSerializerUtil#copyBean(Object, Object)
*/
void loadState(T state);
}