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