public final class ConnectorPositions extends Object
Settings4jInstance.addConnector(Connector, ConnectorPosition)
.
-------------------------------------- Connector myConnector = ... if (Settings4j.getSettings().getConnector(myConnector.getName()) == null) { Settings4j.getSettings().addConnector(myConnector, ConnectorPositions.firstValid(// ConnectorPositions.afterLast(SystemPropertyConnector.class), ConnectorPositions.atFirst() // fallback if no SystemPropertyConnector exists. ) ); } --------------------------------------It is even more readable with static import:
-------------------------------------- import static org.settings4j.ConnectorPositions.*; .. Connector myConnector = ... if (Settings4j.getSettings().getConnector(myConnector.getName()) == null) { Settings4j.getSettings().addConnector(myConnector, // firstValid(afterLast(SystemPropertyConnector.class), atFirst()) ); } --------------------------------------
Modifier and Type | Method and Description |
---|---|
static ConnectorPosition |
after(String connectorName) |
static ConnectorPosition |
afterFirst(Class<? extends Connector> connectorClass) |
static ConnectorPosition |
afterLast(Class<? extends Connector> connectorClass) |
static ConnectorPosition |
atFirst() |
static ConnectorPosition |
atLast() |
static ConnectorPosition |
before(String connectorName) |
static ConnectorPosition |
beforeFirst(Class<? extends Connector> connectorClass) |
static ConnectorPosition |
beforeLast(Class<? extends Connector> connectorClass) |
static ConnectorPosition |
firstValid(ConnectorPosition... connectorPosition) |
public static ConnectorPosition before(String connectorName)
connectorName
- The Connector.getName()
to search for.ConnectorPositionBeforeName
public static ConnectorPosition beforeFirst(Class<? extends Connector> connectorClass)
connectorClass
- the connector class to search in the given connectors list.ConnectorPositionBeforeFirstClass
public static ConnectorPosition beforeLast(Class<? extends Connector> connectorClass)
connectorClass
- the connector class to search in the given connectors list.ConnectorPositionBeforeLastClass
public static ConnectorPosition after(String connectorName)
connectorName
- The Connector.getName()
to search for.ConnectorPositionAfterName
public static ConnectorPosition afterFirst(Class<? extends Connector> connectorClass)
connectorClass
- the connector class to search in the given connectors list.ConnectorPositionAfterFirstClass
public static ConnectorPosition afterLast(Class<? extends Connector> connectorClass)
connectorClass
- the connector class to search in the given connectors list.ConnectorPositionAfterLastClass
public static ConnectorPosition atFirst()
ConnectorPositionAtFirst
which always returns an valid position.public static ConnectorPosition atLast()
ConnectorPositionAtLast
which always returns an valid position.public static ConnectorPosition firstValid(ConnectorPosition... connectorPosition)
connectorPosition
- the ConnectorPosition
s to search for a valid position.Copyright © 2008–2014. All rights reserved.