use of javax.annotation.Nonnull in project neo4j by neo4j.
the class HttpConnectorValidator method getSettingFor.
@Override
@Nonnull
protected Optional<Setting<Object>> getSettingFor(@Nonnull String settingName, @Nonnull Map<String, String> params) {
// owns has already verified that 'type' is correct and that this split is possible
String[] parts = settingName.split("\\.");
final String name = parts[2];
final String subsetting = parts[3];
final boolean encrypted = encryptionSetting(name).apply(params::get).equals(Encryption.TLS);
BaseSetting setting;
switch(subsetting) {
case "enabled":
setting = setting(settingName, BOOLEAN, "false");
setting.setDescription("Enable this connector.");
break;
case "type":
setting = setting(settingName, options(Connector.ConnectorType.class), NO_DEFAULT);
setting.setDeprecated(true);
setting.setDescription("Connector type. This setting is deprecated and its value will instead be " + "inferred from the name of the connector.");
break;
case "encryption":
setting = encryptionSetting(name);
setting.setDescription("Enable TLS for this connector.");
break;
case "address":
setting = listenAddress(settingName, defaultPort(name, params));
setting.setDeprecated(true);
setting.setReplacement("dbms.connector." + name + ".listen_address");
setting.setDescription("Address the connector should bind to. Deprecated and replaced by " + setting.replacement().get() + ".");
break;
case "listen_address":
setting = listenAddress(settingName, defaultPort(name, params));
setting.setDescription("Address the connector should bind to.");
break;
case "advertised_address":
setting = advertisedAddress(settingName, listenAddress(settingName, defaultPort(name, params)));
setting.setDescription("Advertised address for this connector.");
break;
default:
return Optional.empty();
}
// If not deprecated for other reasons
if (isDeprecatedConnectorName(name) && !setting.deprecated()) {
setting.setDeprecated(true);
setting.setReplacement(format("%s.%s.%s.%s", parts[0], parts[1], encrypted ? "https" : "http", subsetting));
}
return Optional.of(setting);
}
use of javax.annotation.Nonnull in project neo4j by neo4j.
the class HaConfigurationValidator method validate.
@Override
@Nonnull
public Map<String, String> validate(@Nonnull Collection<SettingValidator> settingValidators, @Nonnull Map<String, String> rawConfig, @Nonnull Log log, boolean parsingFile) throws InvalidSettingException {
// Make sure mode is HA
Mode mode = ClusterSettings.mode.apply(rawConfig::get);
if (!mode.equals(Mode.HA) && !mode.equals(Mode.ARBITER)) {
// Nothing to validate
return rawConfig;
}
validateServerId(rawConfig::get);
validateInitialHosts(rawConfig::get);
return rawConfig;
}
use of javax.annotation.Nonnull in project Realistic-Terrain-Generation by Team-RTG.
the class WorldTypeRTG method getChunkGenerator.
@Override
@Nonnull
public IChunkGenerator getChunkGenerator(@Nonnull World world, String generatorOptions) {
if (DimensionManagerRTG.isValidDimension(world.provider.getDimension())) {
//if (chunkProvider == null) {
chunkProvider = new ChunkProviderRTG(world, world.getSeed());
RTG.instance.runOnNextServerCloseOnly(clearProvider(chunkProvider));
// inform the event manager about the ChunkEvent.Load event
RTG.eventMgr.setDimensionChunkLoadEvent(world.provider.getDimension(), chunkProvider.delayedDecorator);
RTG.instance.runOnNextServerCloseOnly(chunkProvider.clearOnServerClose());
Logger.debug("WorldTypeRTG#getChunkGenerator() returning ChunkProviderRTG");
return chunkProvider;
//}
// return a "fake" provider that won't decorate for Streams
//ChunkProviderRTG result = new ChunkProviderRTG(world, world.getSeed());
//result.isFakeGenerator();
//return result;
// no server close because it's not supposed to decorate
//return chunkProvider;
} else {
Logger.debug("Invalid dimension. Serving up ChunkProviderOverworld instead of ChunkProviderRTG.");
return new ChunkProviderOverworld(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions);
}
}
use of javax.annotation.Nonnull in project Realistic-Terrain-Generation by Team-RTG.
the class WorldTypeRTG method getBiomeProvider.
@Override
@Nonnull
public BiomeProvider getBiomeProvider(@Nonnull World world) {
if (DimensionManagerRTG.isValidDimension(world.provider.getDimension())) {
if (biomeProvider == null) {
biomeProvider = new BiomeProviderRTG(world, this);
RTG.instance.runOnNextServerCloseOnly(clearProvider(biomeProvider));
}
Logger.debug("WorldTypeRTG#getBiomeProvider() returning BiomeProviderRTG");
return biomeProvider;
} else {
Logger.debug("WorldTypeRTG#getBiomeProvider() returning vanilla BiomeProvider");
return new BiomeProvider(world.getWorldInfo());
}
}
use of javax.annotation.Nonnull in project Railcraft by Railcraft.
the class ItemHandlerInventoryManipulator method removeItem.
@Nonnull
@Override
protected List<ItemStack> removeItem(Predicate<ItemStack> filter, int maxAmount, boolean doRemove) {
int amountNeeded = maxAmount;
List<ItemStack> outputList = new ArrayList<ItemStack>();
for (IInvSlot slot : this) {
if (amountNeeded <= 0)
break;
ItemStack stack = slot.getStack();
if (!isEmpty(stack) && slot.canTakeStackFromSlot(stack) && filter.test(stack)) {
ItemStack removed = inv.extractItem(slot.getIndex(), amountNeeded, !doRemove);
if (!isEmpty(removed)) {
amountNeeded -= removed.stackSize;
outputList.add(removed);
}
}
}
return outputList;
}
Aggregations