1 /* *************************************************************************** 2 * Copyright (c) 2012 Brabenetz Harald, Austria. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 *****************************************************************************/ 17 18 package org.settings4j; 19 20 import java.util.List; 21 22 /** 23 * Interface to show on which position a Connector should be added with {@link List#add(int, Object)}. 24 * <p> 25 * <h3>Default Implementations</h3> <br /> 26 * The easiest way to get an instance of a ConnectorPosition implementation is to use the Factory Methods from 27 * {@link ConnectorPositions}: <br /> 28 * 29 * <pre> 30 * // get the ConnectorPosition instance for the postion after the last 31 * // {@link org.settings4j.connector.SystemPropertyConnector} 32 * ConnectorPositions.afterLast(SystemPropertyConnector.class); 33 * </pre> 34 * 35 * @author brabenetz 36 */ 37 public interface ConnectorPosition { 38 39 /** 40 * the position value it the position cannot be determined. 41 */ 42 int UNKNOWN_POSITION = -1; 43 44 /** 45 * @param connectors the existing list of connectors. 46 * @return the position where the new Connector should be added. 47 */ 48 int getPosition(List<Connector> connectors); 49 }