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.myfaces.extensions.validator.core.storage; 20 21 import org.apache.myfaces.extensions.validator.internal.UsageInformation; 22 import static org.apache.myfaces.extensions.validator.internal.UsageCategory.API; 23 24 /** 25 * Storage managers are responsible to create and reset specific storage implementations depending on the scope. 26 * A manager can be responsible for multiple (named) storages. 27 * 28 * @param <T> Type of Storage that is maintained by the storageManager. 29 * 30 * @since x.x.3 31 */ 32 @UsageInformation(API) 33 public interface StorageManager<T> 34 { 35 /** 36 * Creates and scope or retrieve a previously created instance, of the storage for the given key. 37 * 38 * @param key The key for a storage that needs to be created 39 * @return The storage associated with the key or null if the key is unknown to the storageManager. 40 */ 41 T create(String key); 42 43 /** 44 * Resets the storage linked to the given key. 45 * If the storage isn't created yet or the key is unknown 46 * for the storageManager, nothing is performed and no exception is thrown. 47 * 48 * @param key The key for a storage that needs to be resetted 49 */ 50 void reset(String key); 51 }