mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
Use diamond operator and remove redundant type arguments (#16249)
Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
parent
c858e05c74
commit
a2868bb0dc
@ -46,10 +46,10 @@ public class PWMRuleTemplate extends RuleTemplate {
|
||||
final List<Trigger> triggers = List.of(ModuleBuilder.createTrigger().withId(triggerId)
|
||||
.withTypeUID(PWMTriggerType.UID).withLabel("PWM Trigger").build());
|
||||
|
||||
final Map<String, String> actionInputs = new HashMap<String, String>();
|
||||
final Map<String, String> actionInputs = new HashMap<>();
|
||||
actionInputs.put(PWMConstants.INPUT, triggerId + "." + PWMConstants.OUTPUT);
|
||||
|
||||
Set<String> tags = new HashSet<String>();
|
||||
Set<String> tags = new HashSet<>();
|
||||
tags.add("PWM");
|
||||
|
||||
return new PWMRuleTemplate(tags, triggers, Collections.emptyList(), Collections.emptyList(),
|
||||
|
@ -33,7 +33,7 @@ import org.osgi.service.component.annotations.Component;
|
||||
@Component
|
||||
@NonNullByDefault
|
||||
public class PWMTemplateProvider implements RuleTemplateProvider {
|
||||
private final Map<String, RuleTemplate> providedRuleTemplates = new HashMap<String, RuleTemplate>();
|
||||
private final Map<String, RuleTemplate> providedRuleTemplates = new HashMap<>();
|
||||
|
||||
public PWMTemplateProvider() {
|
||||
providedRuleTemplates.put(PWMRuleTemplate.UID, PWMRuleTemplate.initialize());
|
||||
|
@ -44,7 +44,7 @@ public abstract class ADMessage {
|
||||
|
||||
/** Utility routine to split an AD message into its component parts */
|
||||
protected static List<String> splitMsg(String msg) {
|
||||
List<String> l = new ArrayList<String>();
|
||||
List<String> l = new ArrayList<>();
|
||||
Matcher regexMatcher = SPLIT_REGEX.matcher(msg);
|
||||
while (regexMatcher.find()) {
|
||||
l.add(regexMatcher.group());
|
||||
|
@ -40,7 +40,7 @@ public class PcapNetworkInterfaceWrapper {
|
||||
/**
|
||||
* Use this Guava function in order to create a {@link PcapNetworkInterfaceWrapper} instance.
|
||||
*/
|
||||
public static final Function<PcapNetworkInterface, PcapNetworkInterfaceWrapper> TRANSFORMER = new Function<PcapNetworkInterface, PcapNetworkInterfaceWrapper>() {
|
||||
public static final Function<PcapNetworkInterface, PcapNetworkInterfaceWrapper> TRANSFORMER = new Function<>() {
|
||||
|
||||
@Override
|
||||
public PcapNetworkInterfaceWrapper apply(PcapNetworkInterface pcapNetworkInterface) {
|
||||
|
@ -60,7 +60,7 @@ public class SmartHomeDevicesDiscovery extends AbstractDiscoveryService {
|
||||
}
|
||||
|
||||
public void activate() {
|
||||
activate(new Hashtable<String, Object>());
|
||||
activate(new Hashtable<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -83,9 +83,9 @@ public class HandlerTemperatureSensor extends HandlerBase {
|
||||
float temperature = value.get("value").getAsFloat();
|
||||
String scale = value.get("scale").getAsString();
|
||||
if ("CELSIUS".equals(scale)) {
|
||||
temperatureValue = new QuantityType<Temperature>(temperature, SIUnits.CELSIUS);
|
||||
temperatureValue = new QuantityType<>(temperature, SIUnits.CELSIUS);
|
||||
} else {
|
||||
temperatureValue = new QuantityType<Temperature>(temperature, ImperialUnits.FAHRENHEIT);
|
||||
temperatureValue = new QuantityType<>(temperature, ImperialUnits.FAHRENHEIT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -101,9 +101,9 @@ public class HandlerThermostatController extends HandlerBase {
|
||||
float temperature = value.get("value").getAsFloat();
|
||||
String scale = value.get("scale").getAsString().toUpperCase();
|
||||
if ("CELSIUS".equals(scale)) {
|
||||
temperatureValue = new QuantityType<Temperature>(temperature, SIUnits.CELSIUS);
|
||||
temperatureValue = new QuantityType<>(temperature, SIUnits.CELSIUS);
|
||||
} else {
|
||||
temperatureValue = new QuantityType<Temperature>(temperature, ImperialUnits.FAHRENHEIT);
|
||||
temperatureValue = new QuantityType<>(temperature, ImperialUnits.FAHRENHEIT);
|
||||
}
|
||||
}
|
||||
updateState(TARGET_SETPOINT.channelId, temperatureValue == null ? UnDefType.UNDEF : temperatureValue);
|
||||
@ -121,9 +121,9 @@ public class HandlerThermostatController extends HandlerBase {
|
||||
float temperature = value.get("value").getAsFloat();
|
||||
String scale = value.get("scale").getAsString().toUpperCase();
|
||||
if ("CELSIUS".equals(scale)) {
|
||||
temperatureValue = new QuantityType<Temperature>(temperature, SIUnits.CELSIUS);
|
||||
temperatureValue = new QuantityType<>(temperature, SIUnits.CELSIUS);
|
||||
} else {
|
||||
temperatureValue = new QuantityType<Temperature>(temperature, ImperialUnits.FAHRENHEIT);
|
||||
temperatureValue = new QuantityType<>(temperature, ImperialUnits.FAHRENHEIT);
|
||||
}
|
||||
}
|
||||
updateState(UPPER_SETPOINT.channelId, temperatureValue == null ? UnDefType.UNDEF : temperatureValue);
|
||||
@ -135,9 +135,9 @@ public class HandlerThermostatController extends HandlerBase {
|
||||
float temperature = value.get("value").getAsFloat();
|
||||
String scale = value.get("scale").getAsString().toUpperCase();
|
||||
if ("CELSIUS".equals(scale)) {
|
||||
temperatureValue = new QuantityType<Temperature>(temperature, SIUnits.CELSIUS);
|
||||
temperatureValue = new QuantityType<>(temperature, SIUnits.CELSIUS);
|
||||
} else {
|
||||
temperatureValue = new QuantityType<Temperature>(temperature, ImperialUnits.FAHRENHEIT);
|
||||
temperatureValue = new QuantityType<>(temperature, ImperialUnits.FAHRENHEIT);
|
||||
}
|
||||
}
|
||||
updateState(LOWER_SETPOINT.channelId, temperatureValue == null ? UnDefType.UNDEF : temperatureValue);
|
||||
|
@ -106,7 +106,7 @@ public class SmartHomeDeviceStateGroupUpdateCalculator {
|
||||
}
|
||||
}
|
||||
// check which groups needs an update
|
||||
Set<Integer> groupsToUpdate = new HashSet<Integer>();
|
||||
Set<Integer> groupsToUpdate = new HashSet<>();
|
||||
for (UpdateGroup group : updateGroups.values()) {
|
||||
long millisecondsSinceLastUpdate = updateTimeStamp.getTime() - group.lastUpdated.getTime();
|
||||
if (syncAllGroups || millisecondsSinceLastUpdate >= group.intervalInSeconds * 1000) {
|
||||
|
@ -49,7 +49,7 @@ public class Group {
|
||||
/**
|
||||
* Set of zones belonging to a group
|
||||
**/
|
||||
private Set<Integer> zones = new LinkedHashSet<Integer>();
|
||||
private Set<Integer> zones = new LinkedHashSet<>();
|
||||
|
||||
@Schema
|
||||
/**
|
||||
|
@ -20,7 +20,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
public class ValidationError {
|
||||
|
||||
@Schema(required = true)
|
||||
private List<String> loc = new ArrayList<String>();
|
||||
private List<String> loc = new ArrayList<>();
|
||||
|
||||
@Schema(required = true)
|
||||
private String msg;
|
||||
|
@ -99,7 +99,7 @@ public class AndroidTVHandler extends BaseThingHandler {
|
||||
|
||||
public void updateCDP(String channelName, Map<String, String> cdpMap) {
|
||||
logger.trace("{} - Updating CDP for {}", this.thingID, channelName);
|
||||
List<CommandOption> commandOptions = new ArrayList<CommandOption>();
|
||||
List<CommandOption> commandOptions = new ArrayList<>();
|
||||
cdpMap.forEach((key, value) -> commandOptions.add(new CommandOption(key, value)));
|
||||
logger.trace("{} - CDP List: {}", this.thingID, commandOptions);
|
||||
commandDescriptionProvider.setCommandOptions(new ChannelUID(getThing().getUID(), channelName), commandOptions);
|
||||
|
@ -346,7 +346,7 @@ public class SunCalc {
|
||||
public static Map<SunPhaseName, Range> sortByValue(Map<SunPhaseName, Range> map) {
|
||||
List<Entry<SunPhaseName, Range>> list = new ArrayList<>(map.entrySet());
|
||||
|
||||
Collections.sort(list, new Comparator<Entry<SunPhaseName, Range>>() {
|
||||
Collections.sort(list, new Comparator<>() {
|
||||
@Override
|
||||
public int compare(Entry<SunPhaseName, Range> p1, Entry<SunPhaseName, Range> p2) {
|
||||
Range p1Range = p1.getValue();
|
||||
|
@ -54,7 +54,7 @@ public class AutomowerBindingConstants {
|
||||
// introduce
|
||||
// this in a future release
|
||||
public static final String LAST_POSITION = GROUP_POSITIONS + "last-position";
|
||||
public static final ArrayList<String> CHANNEL_POSITIONS = new ArrayList<String>(
|
||||
public static final ArrayList<String> CHANNEL_POSITIONS = new ArrayList<>(
|
||||
List.of(GROUP_POSITIONS + "position01", GROUP_POSITIONS + "position02", GROUP_POSITIONS + "position03",
|
||||
GROUP_POSITIONS + "position04", GROUP_POSITIONS + "position05", GROUP_POSITIONS + "position06",
|
||||
GROUP_POSITIONS + "position07", GROUP_POSITIONS + "position08", GROUP_POSITIONS + "position09",
|
||||
|
@ -24,7 +24,7 @@ public class MowerData {
|
||||
private Calendar calendar;
|
||||
private Planner planner;
|
||||
private Metadata metadata;
|
||||
private ArrayList<Position> positions = new ArrayList<Position>();
|
||||
private ArrayList<Position> positions = new ArrayList<>();
|
||||
|
||||
public System getSystem() {
|
||||
return system;
|
||||
|
@ -25,8 +25,6 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import javax.measure.quantity.Dimensionless;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.automower.internal.AutomowerBindingConstants;
|
||||
@ -80,7 +78,7 @@ public class AutomowerHandler extends BaseThingHandler {
|
||||
private final Logger logger = LoggerFactory.getLogger(AutomowerHandler.class);
|
||||
private final TimeZoneProvider timeZoneProvider;
|
||||
|
||||
private AtomicReference<String> automowerId = new AtomicReference<String>(NO_ID);
|
||||
private AtomicReference<String> automowerId = new AtomicReference<>(NO_ID);
|
||||
private long lastQueryTimeMs = 0L;
|
||||
|
||||
private @Nullable ScheduledFuture<?> automowerPollingJob;
|
||||
@ -290,8 +288,8 @@ public class AutomowerHandler extends BaseThingHandler {
|
||||
|
||||
updateState(CHANNEL_STATUS_LAST_UPDATE,
|
||||
new DateTimeType(toZonedDateTime(mower.getAttributes().getMetadata().getStatusTimestamp())));
|
||||
updateState(CHANNEL_STATUS_BATTERY, new QuantityType<Dimensionless>(
|
||||
mower.getAttributes().getBattery().getBatteryPercent(), Units.PERCENT));
|
||||
updateState(CHANNEL_STATUS_BATTERY,
|
||||
new QuantityType<>(mower.getAttributes().getBattery().getBatteryPercent(), Units.PERCENT));
|
||||
|
||||
updateState(CHANNEL_STATUS_ERROR_CODE, new DecimalType(mower.getAttributes().getMower().getErrorCode()));
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class AwattarNonConsecutiveBestPriceResult extends AwattarBestPriceResult
|
||||
public AwattarNonConsecutiveBestPriceResult(int size, ZoneId zoneId) {
|
||||
super();
|
||||
this.zoneId = zoneId;
|
||||
members = new ArrayList<AwattarPrice>();
|
||||
members = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void addMember(AwattarPrice member) {
|
||||
@ -59,7 +59,7 @@ public class AwattarNonConsecutiveBestPriceResult extends AwattarBestPriceResult
|
||||
|
||||
private void sort() {
|
||||
if (!sorted) {
|
||||
members.sort(new Comparator<AwattarPrice>() {
|
||||
members.sort(new Comparator<>() {
|
||||
@Override
|
||||
public int compare(AwattarPrice o1, AwattarPrice o2) {
|
||||
return Long.compare(o1.getStartTimestamp(), o2.getStartTimestamp());
|
||||
|
@ -153,7 +153,7 @@ public class AwattarBestpriceHandler extends BaseThingHandler {
|
||||
|
||||
AwattarBestPriceResult result;
|
||||
if (config.consecutive) {
|
||||
ArrayList<AwattarPrice> range = new ArrayList<AwattarPrice>(config.rangeDuration);
|
||||
ArrayList<AwattarPrice> range = new ArrayList<>(config.rangeDuration);
|
||||
range.addAll(getPriceRange(bridgeHandler, timerange,
|
||||
(o1, o2) -> Long.compare(o1.getStartTimestamp(), o2.getStartTimestamp())));
|
||||
AwattarConsecutiveBestPriceResult res = new AwattarConsecutiveBestPriceResult(
|
||||
|
@ -17,9 +17,6 @@ import static org.openhab.binding.bluetooth.airthings.internal.AirthingsBindingC
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.measure.quantity.Dimensionless;
|
||||
import javax.measure.quantity.Temperature;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.library.types.QuantityType;
|
||||
import org.openhab.core.library.unit.SIUnits;
|
||||
@ -55,15 +52,15 @@ public class AirthingsWaveMiniHandler extends AbstractAirthingsHandler {
|
||||
logger.debug("Parsed data: {}", data);
|
||||
Number humidity = data.get(AirthingsDataParser.HUMIDITY);
|
||||
if (humidity != null) {
|
||||
updateState(CHANNEL_ID_HUMIDITY, new QuantityType<Dimensionless>(humidity, Units.PERCENT));
|
||||
updateState(CHANNEL_ID_HUMIDITY, new QuantityType<>(humidity, Units.PERCENT));
|
||||
}
|
||||
Number temperature = data.get(AirthingsDataParser.TEMPERATURE);
|
||||
if (temperature != null) {
|
||||
updateState(CHANNEL_ID_TEMPERATURE, new QuantityType<Temperature>(temperature, SIUnits.CELSIUS));
|
||||
updateState(CHANNEL_ID_TEMPERATURE, new QuantityType<>(temperature, SIUnits.CELSIUS));
|
||||
}
|
||||
Number tvoc = data.get(AirthingsDataParser.TVOC);
|
||||
if (tvoc != null) {
|
||||
updateState(CHANNEL_ID_TVOC, new QuantityType<Dimensionless>(tvoc, Units.PARTS_PER_BILLION));
|
||||
updateState(CHANNEL_ID_TVOC, new QuantityType<>(tvoc, Units.PARTS_PER_BILLION));
|
||||
}
|
||||
} catch (AirthingsParserException e) {
|
||||
logger.error("Failed to parse data received from Airthings sensor: {}", e.getMessage());
|
||||
|
@ -17,12 +17,7 @@ import static org.openhab.binding.bluetooth.airthings.internal.AirthingsBindingC
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.measure.quantity.Dimensionless;
|
||||
import javax.measure.quantity.Pressure;
|
||||
import javax.measure.quantity.Temperature;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.library.dimension.RadiationSpecificActivity;
|
||||
import org.openhab.core.library.types.QuantityType;
|
||||
import org.openhab.core.library.unit.SIUnits;
|
||||
import org.openhab.core.library.unit.Units;
|
||||
@ -57,33 +52,33 @@ public class AirthingsWavePlusHandler extends AbstractAirthingsHandler {
|
||||
logger.debug("Parsed data: {}", data);
|
||||
Number humidity = data.get(AirthingsDataParser.HUMIDITY);
|
||||
if (humidity != null) {
|
||||
updateState(CHANNEL_ID_HUMIDITY, new QuantityType<Dimensionless>(humidity, Units.PERCENT));
|
||||
updateState(CHANNEL_ID_HUMIDITY, new QuantityType<>(humidity, Units.PERCENT));
|
||||
}
|
||||
Number temperature = data.get(AirthingsDataParser.TEMPERATURE);
|
||||
if (temperature != null) {
|
||||
updateState(CHANNEL_ID_TEMPERATURE, new QuantityType<Temperature>(temperature, SIUnits.CELSIUS));
|
||||
updateState(CHANNEL_ID_TEMPERATURE, new QuantityType<>(temperature, SIUnits.CELSIUS));
|
||||
}
|
||||
Number pressure = data.get(AirthingsDataParser.PRESSURE);
|
||||
if (pressure != null) {
|
||||
updateState(CHANNEL_ID_PRESSURE, new QuantityType<Pressure>(pressure, Units.MILLIBAR));
|
||||
updateState(CHANNEL_ID_PRESSURE, new QuantityType<>(pressure, Units.MILLIBAR));
|
||||
}
|
||||
Number co2 = data.get(AirthingsDataParser.CO2);
|
||||
if (co2 != null) {
|
||||
updateState(CHANNEL_ID_CO2, new QuantityType<Dimensionless>(co2, Units.PARTS_PER_MILLION));
|
||||
updateState(CHANNEL_ID_CO2, new QuantityType<>(co2, Units.PARTS_PER_MILLION));
|
||||
}
|
||||
Number tvoc = data.get(AirthingsDataParser.TVOC);
|
||||
if (tvoc != null) {
|
||||
updateState(CHANNEL_ID_TVOC, new QuantityType<Dimensionless>(tvoc, Units.PARTS_PER_BILLION));
|
||||
updateState(CHANNEL_ID_TVOC, new QuantityType<>(tvoc, Units.PARTS_PER_BILLION));
|
||||
}
|
||||
Number radonShortTermAvg = data.get(AirthingsDataParser.RADON_SHORT_TERM_AVG);
|
||||
if (radonShortTermAvg != null) {
|
||||
updateState(CHANNEL_ID_RADON_ST_AVG, new QuantityType<RadiationSpecificActivity>(radonShortTermAvg,
|
||||
Units.BECQUEREL_PER_CUBIC_METRE));
|
||||
updateState(CHANNEL_ID_RADON_ST_AVG,
|
||||
new QuantityType<>(radonShortTermAvg, Units.BECQUEREL_PER_CUBIC_METRE));
|
||||
}
|
||||
Number radonLongTermAvg = data.get(AirthingsDataParser.RADON_LONG_TERM_AVG);
|
||||
if (radonLongTermAvg != null) {
|
||||
updateState(CHANNEL_ID_RADON_LT_AVG,
|
||||
new QuantityType<RadiationSpecificActivity>(radonLongTermAvg, Units.BECQUEREL_PER_CUBIC_METRE));
|
||||
new QuantityType<>(radonLongTermAvg, Units.BECQUEREL_PER_CUBIC_METRE));
|
||||
}
|
||||
} catch (AirthingsParserException e) {
|
||||
logger.error("Failed to parse data received from Airthings sensor: {}", e.getMessage());
|
||||
|
@ -74,10 +74,10 @@ public class GetIndoorOutoorTemperatures extends BRC1HCommand {
|
||||
}
|
||||
}
|
||||
|
||||
indoorTemperature = new QuantityType<Temperature>(iIndoorTemperature, SIUnits.CELSIUS);
|
||||
indoorTemperature = new QuantityType<>(iIndoorTemperature, SIUnits.CELSIUS);
|
||||
|
||||
if (iOutdoorTemperature != null) {
|
||||
outdoorTemperature = new QuantityType<Temperature>(iOutdoorTemperature, SIUnits.CELSIUS);
|
||||
outdoorTemperature = new QuantityType<>(iOutdoorTemperature, SIUnits.CELSIUS);
|
||||
}
|
||||
|
||||
logger.debug("Indoor Temp: {}", indoorTemperature);
|
||||
|
@ -79,9 +79,9 @@ public class GetOperationHoursCommand extends BRC1HCommand {
|
||||
Integer iIndoorFanHours = (int) (fanHours.getComputedValue(ByteOrder.LITTLE_ENDIAN));
|
||||
Integer iIndoorPowerHours = (int) (powerHours.getComputedValue(ByteOrder.LITTLE_ENDIAN));
|
||||
|
||||
this.indoorOperationHours = new QuantityType<Time>(iIndoorOperationHours, Units.HOUR);
|
||||
this.indoorFanHours = new QuantityType<Time>(iIndoorFanHours, Units.HOUR);
|
||||
this.indoorPowerHours = new QuantityType<Time>(iIndoorPowerHours, Units.HOUR);
|
||||
this.indoorOperationHours = new QuantityType<>(iIndoorOperationHours, Units.HOUR);
|
||||
this.indoorFanHours = new QuantityType<>(iIndoorFanHours, Units.HOUR);
|
||||
this.indoorPowerHours = new QuantityType<>(iIndoorPowerHours, Units.HOUR);
|
||||
|
||||
logger.debug("indoorOperationHours: {}", indoorOperationHours);
|
||||
logger.debug("indoorFanHours: {}", indoorFanHours);
|
||||
|
@ -59,8 +59,8 @@ public class GetSetpointCommand extends BRC1HCommand {
|
||||
Integer iHeatingSetpoint = (int) (heatValue.getComputedValue() / 128.);
|
||||
Integer iCoolingSetpoint = (int) (coolValue.getComputedValue() / 128.);
|
||||
|
||||
this.heatingSetpoint = new QuantityType<Temperature>(iHeatingSetpoint, SIUnits.CELSIUS);
|
||||
this.coolingSetpoint = new QuantityType<Temperature>(iCoolingSetpoint, SIUnits.CELSIUS);
|
||||
this.heatingSetpoint = new QuantityType<>(iHeatingSetpoint, SIUnits.CELSIUS);
|
||||
this.coolingSetpoint = new QuantityType<>(iCoolingSetpoint, SIUnits.CELSIUS);
|
||||
|
||||
logger.debug("heatingSetpoint: {}", heatingSetpoint);
|
||||
logger.debug("coolingSetpoint: {}", coolingSetpoint);
|
||||
|
@ -50,12 +50,12 @@ public class DummyThing implements Thing {
|
||||
|
||||
@Override
|
||||
public List<@NonNull Channel> getChannels() {
|
||||
return new ArrayList<Channel>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<@NonNull Channel> getChannelsOfGroup(String channelGroupId) {
|
||||
return new ArrayList<Channel>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -117,7 +117,7 @@ public class DummyThing implements Thing {
|
||||
|
||||
@Override
|
||||
public Map<@NonNull String, @NonNull String> getProperties() {
|
||||
return new HashMap<String, String>();
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -228,18 +228,18 @@ public enum BluetoothUnit {
|
||||
@Deprecated
|
||||
public static class BUnits {
|
||||
public static final Unit<ArealDensity> KILOGRAM_PER_SQUARE_METER = addUnit(
|
||||
new ProductUnit<ArealDensity>(SIUnits.KILOGRAM.divide(SIUnits.SQUARE_METRE)));
|
||||
new ProductUnit<>(SIUnits.KILOGRAM.divide(SIUnits.SQUARE_METRE)));
|
||||
|
||||
public static final Unit<RadiationDoseAbsorptionRate> GRAY_PER_SECOND = addUnit(
|
||||
new ProductUnit<RadiationDoseAbsorptionRate>(Units.GRAY.divide(Units.SECOND)));
|
||||
new ProductUnit<>(Units.GRAY.divide(Units.SECOND)));
|
||||
|
||||
public static final Unit<Mass> POUND = addUnit(
|
||||
new TransformedUnit<Mass>(SIUnits.KILOGRAM, MultiplyConverter.of(0.45359237)));
|
||||
new TransformedUnit<>(SIUnits.KILOGRAM, MultiplyConverter.of(0.45359237)));
|
||||
|
||||
public static final Unit<Angle> MINUTE_ANGLE = addUnit(new TransformedUnit<Angle>(Units.RADIAN,
|
||||
public static final Unit<Angle> MINUTE_ANGLE = addUnit(new TransformedUnit<>(Units.RADIAN,
|
||||
MultiplyConverter.ofPiExponent(1).concatenate(MultiplyConverter.ofRational(1, 180 * 60))));
|
||||
|
||||
public static final Unit<Angle> SECOND_ANGLE = addUnit(new TransformedUnit<Angle>(Units.RADIAN,
|
||||
public static final Unit<Angle> SECOND_ANGLE = addUnit(new TransformedUnit<>(Units.RADIAN,
|
||||
MultiplyConverter.ofPiExponent(1).concatenate(MultiplyConverter.ofRational(1, 180 * 60 * 60))));
|
||||
|
||||
public static final Unit<Area> HECTARE = addUnit(SIUnits.SQUARE_METRE.multiply(10000.0));
|
||||
@ -248,54 +248,51 @@ public enum BluetoothUnit {
|
||||
public static final Unit<Length> NAUTICAL_MILE = addUnit(SIUnits.METRE.multiply(1852.0));
|
||||
|
||||
public static final Unit<RadiantIntensity> WATT_PER_STERADIAN = addUnit(
|
||||
new ProductUnit<RadiantIntensity>(Units.WATT.divide(Units.STERADIAN)));
|
||||
new ProductUnit<>(Units.WATT.divide(Units.STERADIAN)));
|
||||
|
||||
public static final Unit<Radiance> WATT_PER_STERADIAN_PER_SQUARE_METRE = addUnit(
|
||||
new ProductUnit<Radiance>(WATT_PER_STERADIAN.divide(SIUnits.SQUARE_METRE)));
|
||||
new ProductUnit<>(WATT_PER_STERADIAN.divide(SIUnits.SQUARE_METRE)));
|
||||
|
||||
public static final Unit<Frequency> CYCLES_PER_MINUTE = addUnit(new TransformedUnit<Frequency>(Units.HERTZ,
|
||||
public static final Unit<Frequency> CYCLES_PER_MINUTE = addUnit(new TransformedUnit<>(Units.HERTZ,
|
||||
MultiplyConverter.ofRational(BigInteger.valueOf(60), BigInteger.ONE)));
|
||||
|
||||
public static final Unit<Angle> REVOLUTION = addUnit(new TransformedUnit<Angle>(Units.RADIAN,
|
||||
public static final Unit<Angle> REVOLUTION = addUnit(new TransformedUnit<>(Units.RADIAN,
|
||||
MultiplyConverter.ofPiExponent(1).concatenate(MultiplyConverter.ofRational(2, 1))));
|
||||
public static final Unit<AngularVelocity> REVOLUTION_PER_MINUTE = addUnit(
|
||||
new ProductUnit<AngularVelocity>(REVOLUTION.divide(Units.MINUTE)));
|
||||
new ProductUnit<>(REVOLUTION.divide(Units.MINUTE)));
|
||||
|
||||
public static final Unit<Dimensionless> STEPS = addUnit(Units.ONE.alternate("steps"));
|
||||
public static final Unit<Dimensionless> BEATS = addUnit(Units.ONE.alternate("beats"));
|
||||
public static final Unit<Dimensionless> STROKE = addUnit(Units.ONE.alternate("stroke"));
|
||||
|
||||
public static final Unit<Frequency> STEP_PER_MINUTE = addUnit(
|
||||
new ProductUnit<Frequency>(STEPS.divide(Units.MINUTE)));
|
||||
public static final Unit<Frequency> STEP_PER_MINUTE = addUnit(new ProductUnit<>(STEPS.divide(Units.MINUTE)));
|
||||
|
||||
public static final Unit<Frequency> BEATS_PER_MINUTE = addUnit(
|
||||
new ProductUnit<Frequency>(BEATS.divide(Units.MINUTE)));
|
||||
public static final Unit<Frequency> BEATS_PER_MINUTE = addUnit(new ProductUnit<>(BEATS.divide(Units.MINUTE)));
|
||||
|
||||
public static final Unit<Frequency> STROKE_PER_MINUTE = addUnit(
|
||||
new ProductUnit<Frequency>(STROKE.divide(Units.MINUTE)));
|
||||
public static final Unit<Frequency> STROKE_PER_MINUTE = addUnit(new ProductUnit<>(STROKE.divide(Units.MINUTE)));
|
||||
|
||||
public static final Unit<MassFlowRate> GRAM_PER_SECOND = addUnit(
|
||||
new ProductUnit<MassFlowRate>(SIUnits.GRAM.divide(Units.SECOND)));
|
||||
new ProductUnit<>(SIUnits.GRAM.divide(Units.SECOND)));
|
||||
|
||||
public static final Unit<LuminousEfficacy> LUMEN_PER_WATT = addUnit(
|
||||
new ProductUnit<LuminousEfficacy>(Units.LUMEN.divide(Units.WATT)));
|
||||
new ProductUnit<>(Units.LUMEN.divide(Units.WATT)));
|
||||
|
||||
public static final Unit<LuminousEnergy> LUMEN_SECOND = addUnit(
|
||||
new ProductUnit<LuminousEnergy>(Units.LUMEN.multiply(Units.SECOND)));
|
||||
new ProductUnit<>(Units.LUMEN.multiply(Units.SECOND)));
|
||||
|
||||
public static final Unit<LuminousEnergy> LUMEN_HOUR = addUnit(
|
||||
new ProductUnit<LuminousEnergy>(Units.LUMEN.multiply(Units.HOUR)));
|
||||
new ProductUnit<>(Units.LUMEN.multiply(Units.HOUR)));
|
||||
|
||||
public static final Unit<ElectricCharge> AMPERE_HOUR = addUnit(
|
||||
new ProductUnit<ElectricCharge>(Units.AMPERE.multiply(Units.HOUR)));
|
||||
new ProductUnit<>(Units.AMPERE.multiply(Units.HOUR)));
|
||||
|
||||
public static final Unit<LuminousExposure> LUX_HOUR = addUnit(
|
||||
new ProductUnit<LuminousExposure>(Units.LUX.multiply(Units.HOUR)));
|
||||
new ProductUnit<>(Units.LUX.multiply(Units.HOUR)));
|
||||
|
||||
public static final Unit<Speed> KILOMETRE_PER_MINUTE = addUnit(SIUnits.KILOMETRE_PER_HOUR.multiply(60.0));
|
||||
|
||||
public static final Unit<VolumetricFlowRate> LITRE_PER_SECOND = addUnit(
|
||||
new ProductUnit<VolumetricFlowRate>(Units.LITRE.divide(Units.SECOND)));
|
||||
new ProductUnit<>(Units.LITRE.divide(Units.SECOND)));
|
||||
|
||||
static {
|
||||
SimpleUnitFormat.getInstance().label(GRAY_PER_SECOND, "Gy/s");
|
||||
|
@ -46,7 +46,7 @@ public class GetBatteryCommand extends GetCommand {
|
||||
}
|
||||
if (data != null) {
|
||||
int value = data[0] & 0xFF;
|
||||
resultHandler.complete(new QuantityType<Dimensionless>(value, Units.PERCENT));
|
||||
resultHandler.complete(new QuantityType<>(value, Units.PERCENT));
|
||||
} else {
|
||||
resultHandler.complete(null);
|
||||
}
|
||||
|
@ -86,12 +86,12 @@ public class GetOrSetHumWarningCommand extends GoveeCommand {
|
||||
resultHandler.completeExceptionally(th);
|
||||
}
|
||||
if (data != null) {
|
||||
WarningSettingsDTO<Dimensionless> result = new WarningSettingsDTO<Dimensionless>();
|
||||
WarningSettingsDTO<Dimensionless> result = new WarningSettingsDTO<>();
|
||||
|
||||
ByteBuffer buffer = ByteBuffer.wrap(data).order(ByteOrder.LITTLE_ENDIAN);
|
||||
result.enableAlarm = OnOffType.from(buffer.get() == 1);
|
||||
result.min = new QuantityType<Dimensionless>(buffer.getShort() / 100.0, Units.PERCENT);
|
||||
result.max = new QuantityType<Dimensionless>(buffer.getShort() / 100.0, Units.PERCENT);
|
||||
result.min = new QuantityType<>(buffer.getShort() / 100.0, Units.PERCENT);
|
||||
result.max = new QuantityType<>(buffer.getShort() / 100.0, Units.PERCENT);
|
||||
|
||||
resultHandler.complete(result);
|
||||
} else {
|
||||
|
@ -81,12 +81,12 @@ public class GetOrSetTemWarningCommand extends GoveeCommand {
|
||||
resultHandler.completeExceptionally(th);
|
||||
}
|
||||
if (data != null) {
|
||||
WarningSettingsDTO<Temperature> result = new WarningSettingsDTO<Temperature>();
|
||||
WarningSettingsDTO<Temperature> result = new WarningSettingsDTO<>();
|
||||
|
||||
ByteBuffer buffer = ByteBuffer.wrap(data).order(ByteOrder.LITTLE_ENDIAN);
|
||||
result.enableAlarm = OnOffType.from(buffer.get() == 1);
|
||||
result.min = new QuantityType<Temperature>(buffer.getShort() / 100.0, SIUnits.CELSIUS);
|
||||
result.max = new QuantityType<Temperature>(buffer.getShort() / 100.0, SIUnits.CELSIUS);
|
||||
result.min = new QuantityType<>(buffer.getShort() / 100.0, SIUnits.CELSIUS);
|
||||
result.max = new QuantityType<>(buffer.getShort() / 100.0, SIUnits.CELSIUS);
|
||||
|
||||
resultHandler.complete(result);
|
||||
} else {
|
||||
|
@ -18,7 +18,6 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.library.dimension.Density;
|
||||
import org.openhab.core.library.types.QuantityType;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.slf4j.Logger;
|
||||
@ -57,7 +56,7 @@ public class RadoneyeHandler extends AbstractRadoneyeHandler {
|
||||
Number radon = data.get(RadoneyeDataParser.RADON);
|
||||
logger.debug("Parsed data radon number: {}", radon);
|
||||
if (radon != null) {
|
||||
updateState(CHANNEL_ID_RADON, new QuantityType<Density>(radon, BECQUEREL_PER_CUBIC_METRE));
|
||||
updateState(CHANNEL_ID_RADON, new QuantityType<>(radon, BECQUEREL_PER_CUBIC_METRE));
|
||||
}
|
||||
} catch (RadoneyeParserException e) {
|
||||
logger.error("Failed to parse data received from Radoneye sensor: {}", e.getMessage());
|
||||
|
@ -45,7 +45,7 @@ public class BluetoothScanNotification extends BluetoothNotification {
|
||||
* Key: UUID of the service
|
||||
* Value: Data of the characteristic
|
||||
*/
|
||||
private Map<String, byte[]> serviceData = new HashMap<String, byte[]>();
|
||||
private Map<String, byte[]> serviceData = new HashMap<>();
|
||||
|
||||
/**
|
||||
* The beacon type
|
||||
|
@ -526,7 +526,7 @@ public class BondDeviceHandler extends BaseThingHandler {
|
||||
|
||||
private void updateDevicePropertiesFromBond(BondDevice devInfo, BondDeviceProperties devProperties) {
|
||||
// Update all the thing properties based on the result
|
||||
Map<String, String> thingProperties = new HashMap<String, String>();
|
||||
Map<String, String> thingProperties = new HashMap<>();
|
||||
updateProperty(thingProperties, CONFIG_DEVICE_ID, config.deviceId);
|
||||
logger.trace("Updating device name to {}", devInfo.name);
|
||||
updateProperty(thingProperties, PROPERTIES_DEVICE_NAME, devInfo.name);
|
||||
|
@ -174,7 +174,7 @@ public class BoschAccountHandler extends BaseBridgeHandler implements Authorizat
|
||||
|
||||
public Collection<DevicePropertiesResponse> getDevices() throws IndegoException {
|
||||
Collection<String> serialNumbers = controller.getSerialNumbers();
|
||||
List<DevicePropertiesResponse> devices = new ArrayList<DevicePropertiesResponse>(serialNumbers.size());
|
||||
List<DevicePropertiesResponse> devices = new ArrayList<>(serialNumbers.size());
|
||||
|
||||
for (String serialNumber : serialNumbers) {
|
||||
DevicePropertiesResponse properties = controller.getDeviceProperties(serialNumber);
|
||||
|
@ -16,9 +16,6 @@ import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConst
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.measure.quantity.Energy;
|
||||
import javax.measure.quantity.Power;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.boschshc.internal.exceptions.BoschSHCException;
|
||||
import org.openhab.binding.boschshc.internal.services.powermeter.PowerMeterService;
|
||||
@ -87,9 +84,8 @@ public abstract class AbstractPowerSwitchHandler extends BoschSHCDeviceHandler {
|
||||
* @param state Current state of {@link PowerMeterService}.
|
||||
*/
|
||||
private void updateChannels(PowerMeterServiceState state) {
|
||||
super.updateState(CHANNEL_POWER_CONSUMPTION, new QuantityType<Power>(state.powerConsumption, Units.WATT));
|
||||
super.updateState(CHANNEL_ENERGY_CONSUMPTION,
|
||||
new QuantityType<Energy>(state.energyConsumption, Units.WATT_HOUR));
|
||||
super.updateState(CHANNEL_POWER_CONSUMPTION, new QuantityType<>(state.powerConsumption, Units.WATT));
|
||||
super.updateState(CHANNEL_ENERGY_CONSUMPTION, new QuantityType<>(state.energyConsumption, Units.WATT_HOUR));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,9 +16,6 @@ import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConst
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.measure.quantity.Dimensionless;
|
||||
import javax.measure.quantity.Temperature;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.boschshc.internal.devices.AbstractSmokeDetectorHandler;
|
||||
import org.openhab.binding.boschshc.internal.exceptions.BoschSHCException;
|
||||
@ -55,11 +52,11 @@ public class TwinguardHandler extends AbstractSmokeDetectorHandler {
|
||||
}
|
||||
|
||||
private void updateChannels(AirQualityLevelServiceState state) {
|
||||
updateState(CHANNEL_TEMPERATURE, new QuantityType<Temperature>(state.temperature, SIUnits.CELSIUS));
|
||||
updateState(CHANNEL_TEMPERATURE, new QuantityType<>(state.temperature, SIUnits.CELSIUS));
|
||||
updateState(CHANNEL_TEMPERATURE_RATING, new StringType(state.temperatureRating));
|
||||
updateState(CHANNEL_HUMIDITY, new QuantityType<Dimensionless>(state.humidity, Units.PERCENT));
|
||||
updateState(CHANNEL_HUMIDITY, new QuantityType<>(state.humidity, Units.PERCENT));
|
||||
updateState(CHANNEL_HUMIDITY_RATING, new StringType(state.humidityRating));
|
||||
updateState(CHANNEL_PURITY, new QuantityType<Dimensionless>(state.purity, Units.PARTS_PER_MILLION));
|
||||
updateState(CHANNEL_PURITY, new QuantityType<>(state.purity, Units.PARTS_PER_MILLION));
|
||||
updateState(CHANNEL_PURITY_RATING, new StringType(state.purityRating));
|
||||
updateState(CHANNEL_AIR_DESCRIPTION, new StringType(state.description));
|
||||
updateState(CHANNEL_COMBINED_RATING, new StringType(state.combinedRating));
|
||||
|
@ -134,7 +134,7 @@ public abstract class AbstractPowerSwitchHandlerTest<T extends AbstractPowerSwit
|
||||
getFixture().handleCommand(getChannelUID(BoschSHCBindingConstants.CHANNEL_POWER_CONSUMPTION),
|
||||
RefreshType.REFRESH);
|
||||
verify(getCallback()).stateUpdated(getChannelUID(BoschSHCBindingConstants.CHANNEL_POWER_CONSUMPTION),
|
||||
new QuantityType<Power>(12.34d, Units.WATT));
|
||||
new QuantityType<>(12.34d, Units.WATT));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -142,6 +142,6 @@ public abstract class AbstractPowerSwitchHandlerTest<T extends AbstractPowerSwit
|
||||
getFixture().handleCommand(getChannelUID(BoschSHCBindingConstants.CHANNEL_ENERGY_CONSUMPTION),
|
||||
RefreshType.REFRESH);
|
||||
verify(getCallback()).stateUpdated(getChannelUID(BoschSHCBindingConstants.CHANNEL_ENERGY_CONSUMPTION),
|
||||
new QuantityType<Energy>(56.78d, Units.WATT_HOUR));
|
||||
new QuantityType<>(56.78d, Units.WATT_HOUR));
|
||||
}
|
||||
}
|
||||
|
@ -165,12 +165,12 @@ class LongPollingTest {
|
||||
@Override
|
||||
public ScheduledFuture<?> schedule(@Nullable Runnable command, long delay, @Nullable TimeUnit unit) {
|
||||
// not used in this tests
|
||||
return new NullScheduledFuture<Object>();
|
||||
return new NullScheduledFuture<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <V> ScheduledFuture<V> schedule(@Nullable Callable<V> callable, long delay, @Nullable TimeUnit unit) {
|
||||
return new NullScheduledFuture<V>();
|
||||
return new NullScheduledFuture<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -179,7 +179,7 @@ class LongPollingTest {
|
||||
if (command != null) {
|
||||
command.run();
|
||||
}
|
||||
return new NullScheduledFuture<Object>();
|
||||
return new NullScheduledFuture<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -188,7 +188,7 @@ class LongPollingTest {
|
||||
if (command != null) {
|
||||
command.run();
|
||||
}
|
||||
return new NullScheduledFuture<Object>();
|
||||
return new NullScheduledFuture<>();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ class ClimateControlHandlerTest extends AbstractBoschSHCDeviceHandlerTest<Climat
|
||||
getFixture().processUpdate("TemperatureLevel", jsonObject);
|
||||
verify(getCallback()).stateUpdated(
|
||||
new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_TEMPERATURE),
|
||||
new QuantityType<Temperature>(21.5, SIUnits.CELSIUS));
|
||||
new QuantityType<>(21.5, SIUnits.CELSIUS));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -101,6 +101,6 @@ class ClimateControlHandlerTest extends AbstractBoschSHCDeviceHandlerTest<Climat
|
||||
getFixture().processUpdate("RoomClimateControl", jsonObject);
|
||||
verify(getCallback()).stateUpdated(
|
||||
new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_SETPOINT_TEMPERATURE),
|
||||
new QuantityType<Temperature>(21.5, SIUnits.CELSIUS));
|
||||
new QuantityType<>(21.5, SIUnits.CELSIUS));
|
||||
}
|
||||
}
|
||||
|
@ -19,8 +19,6 @@ import static org.mockito.Mockito.verify;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import javax.measure.quantity.Temperature;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
@ -130,7 +128,7 @@ class ThermostatHandlerTest extends AbstractBatteryPoweredDeviceHandlerTest<Ther
|
||||
getFixture().processUpdate("TemperatureLevel", jsonObject);
|
||||
verify(getCallback()).stateUpdated(
|
||||
new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_TEMPERATURE),
|
||||
new QuantityType<Temperature>(21.5, SIUnits.CELSIUS));
|
||||
new QuantityType<>(21.5, SIUnits.CELSIUS));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -14,9 +14,6 @@ package org.openhab.binding.boschshc.internal.devices.twinguard;
|
||||
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import javax.measure.quantity.Dimensionless;
|
||||
import javax.measure.quantity.Temperature;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.openhab.binding.boschshc.internal.devices.AbstractSmokeDetectorHandlerTest;
|
||||
@ -66,7 +63,7 @@ class TwinguardHandlerTest extends AbstractSmokeDetectorHandlerTest<TwinguardHan
|
||||
|
||||
verify(getCallback()).stateUpdated(
|
||||
new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_TEMPERATURE),
|
||||
new QuantityType<Temperature>(23.77, SIUnits.CELSIUS));
|
||||
new QuantityType<>(23.77, SIUnits.CELSIUS));
|
||||
|
||||
verify(getCallback()).stateUpdated(
|
||||
new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_TEMPERATURE_RATING),
|
||||
@ -74,14 +71,14 @@ class TwinguardHandlerTest extends AbstractSmokeDetectorHandlerTest<TwinguardHan
|
||||
|
||||
verify(getCallback()).stateUpdated(
|
||||
new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_HUMIDITY),
|
||||
new QuantityType<Dimensionless>(32.69, Units.PERCENT));
|
||||
new QuantityType<>(32.69, Units.PERCENT));
|
||||
|
||||
verify(getCallback()).stateUpdated(
|
||||
new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_HUMIDITY_RATING),
|
||||
new StringType("MEDIUM"));
|
||||
|
||||
verify(getCallback()).stateUpdated(new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_PURITY),
|
||||
new QuantityType<Dimensionless>(620, Units.PARTS_PER_MILLION));
|
||||
new QuantityType<>(620, Units.PARTS_PER_MILLION));
|
||||
|
||||
verify(getCallback()).stateUpdated(
|
||||
new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_PURITY_RATING),
|
||||
|
@ -14,9 +14,6 @@ package org.openhab.binding.boschshc.internal.devices.wallthermostat;
|
||||
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import javax.measure.quantity.Dimensionless;
|
||||
import javax.measure.quantity.Temperature;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.openhab.binding.boschshc.internal.devices.AbstractBatteryPoweredDeviceHandlerTest;
|
||||
@ -65,7 +62,7 @@ class WallThermostatHandlerTest extends AbstractBatteryPoweredDeviceHandlerTest<
|
||||
getFixture().processUpdate("TemperatureLevel", jsonObject);
|
||||
verify(getCallback()).stateUpdated(
|
||||
new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_TEMPERATURE),
|
||||
new QuantityType<Temperature>(21.5, SIUnits.CELSIUS));
|
||||
new QuantityType<>(21.5, SIUnits.CELSIUS));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -75,6 +72,6 @@ class WallThermostatHandlerTest extends AbstractBatteryPoweredDeviceHandlerTest<
|
||||
getFixture().processUpdate("HumidityLevel", jsonObject);
|
||||
verify(getCallback()).stateUpdated(
|
||||
new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_HUMIDITY),
|
||||
new QuantityType<Dimensionless>(42.5, Units.PERCENT));
|
||||
new QuantityType<>(42.5, Units.PERCENT));
|
||||
}
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ public class SmartherApi {
|
||||
switch (settings.getMode()) {
|
||||
case AUTOMATIC:
|
||||
// {"function":"heating","mode":"automatic","programs":[{"number":0}]}
|
||||
Map<String, Integer> programMap = new IdentityHashMap<String, Integer>();
|
||||
Map<String, Integer> programMap = new IdentityHashMap<>();
|
||||
programMap.put(ATTR_NUMBER, Integer.valueOf(settings.getProgram()));
|
||||
List<Map<String, Integer>> programsList = new ArrayList<>();
|
||||
programsList.add(programMap);
|
||||
@ -213,7 +213,7 @@ public class SmartherApi {
|
||||
if (newTemperature == null) {
|
||||
throw new SmartherGatewayException("Invalid temperature unit transformation");
|
||||
}
|
||||
Map<String, Object> setPointMap = new IdentityHashMap<String, Object>();
|
||||
Map<String, Object> setPointMap = new IdentityHashMap<>();
|
||||
setPointMap.put(ATTR_VALUE, newTemperature.doubleValue());
|
||||
setPointMap.put(ATTR_UNIT, MeasureUnit.CELSIUS.getValue());
|
||||
rootMap.put(ATTR_SETPOINT, setPointMap);
|
||||
@ -305,7 +305,7 @@ public class SmartherApi {
|
||||
public String subscribePlant(String plantId, String notificationUrl) throws SmartherGatewayException {
|
||||
try {
|
||||
// Prepare request payload
|
||||
Map<String, Object> rootMap = new IdentityHashMap<String, Object>();
|
||||
Map<String, Object> rootMap = new IdentityHashMap<>();
|
||||
rootMap.put(ATTR_ENDPOINT_URL, notificationUrl);
|
||||
final String jsonPayload = ModelUtil.gsonInstance().toJson(rootMap);
|
||||
// Send request to server
|
||||
|
@ -14,9 +14,6 @@ package org.openhab.binding.bticinosmarther.internal.api.dto;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.measure.quantity.Dimensionless;
|
||||
import javax.measure.quantity.Temperature;
|
||||
|
||||
import org.openhab.binding.bticinosmarther.internal.api.dto.Enums.MeasureUnit;
|
||||
import org.openhab.binding.bticinosmarther.internal.api.exception.SmartherIllegalPropertyValueException;
|
||||
import org.openhab.binding.bticinosmarther.internal.util.StringUtil;
|
||||
@ -91,16 +88,15 @@ public class Measure {
|
||||
|
||||
switch (MeasureUnit.fromValue(unit)) {
|
||||
case CELSIUS:
|
||||
state = optValue.<State> map(t -> new QuantityType<Temperature>(new DecimalType(t), SIUnits.CELSIUS))
|
||||
state = optValue.<State> map(t -> new QuantityType<>(new DecimalType(t), SIUnits.CELSIUS))
|
||||
.orElse(UnDefType.UNDEF);
|
||||
break;
|
||||
case FAHRENHEIT:
|
||||
state = optValue
|
||||
.<State> map(t -> new QuantityType<Temperature>(new DecimalType(t), ImperialUnits.FAHRENHEIT))
|
||||
state = optValue.<State> map(t -> new QuantityType<>(new DecimalType(t), ImperialUnits.FAHRENHEIT))
|
||||
.orElse(UnDefType.UNDEF);
|
||||
break;
|
||||
case PERCENTAGE:
|
||||
state = optValue.<State> map(t -> new QuantityType<Dimensionless>(new DecimalType(t), Units.PERCENT))
|
||||
state = optValue.<State> map(t -> new QuantityType<>(new DecimalType(t), Units.PERCENT))
|
||||
.orElse(UnDefType.UNDEF);
|
||||
break;
|
||||
case DIMENSIONLESS:
|
||||
|
@ -156,7 +156,7 @@ public class ThingHandlerPanel extends CaddxBaseThingHandler {
|
||||
communicatorStackPointer = pointer;
|
||||
|
||||
// build map of log message channels to event numbers
|
||||
HashMap<String, String> map = new HashMap<String, String>();
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put(pointer, CaddxBindingConstants.PANEL_LOG_MESSAGE_N_0);
|
||||
bridgeHandler.sendCommand(CaddxMessageContext.COMMAND, CaddxBindingConstants.PANEL_LOG_EVENT_REQUEST, pointer);
|
||||
panelLogMessagesMap = map;
|
||||
@ -194,7 +194,7 @@ public class ThingHandlerPanel extends CaddxBaseThingHandler {
|
||||
}
|
||||
|
||||
if (communicatorStackPointer != null && eventNumberString.equals(communicatorStackPointer)) {
|
||||
HashMap<String, String> map = new HashMap<String, String>();
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
|
||||
int eventNumber = Integer.parseInt(eventNumberString);
|
||||
int eventSize = Integer.parseInt(eventSizeString);
|
||||
|
@ -55,10 +55,10 @@ public class CBusBindingConstants {
|
||||
public static final String CHANNEL_TEMP = "temp";
|
||||
public static final String CHANNEL_VALUE = "value";
|
||||
|
||||
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = new HashSet<ThingTypeUID>(
|
||||
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = new HashSet<>(
|
||||
Arrays.asList(BRIDGE_TYPE_CGATE, BRIDGE_TYPE_NETWORK, THING_TYPE_GROUP, THING_TYPE_LIGHT,
|
||||
THING_TYPE_TEMPERATURE, THING_TYPE_TRIGGER, THING_TYPE_DALI));
|
||||
public static final Set<ThingTypeUID> NETWORK_DISCOVERY_THING_TYPES_UIDS = new HashSet<ThingTypeUID>(
|
||||
public static final Set<ThingTypeUID> NETWORK_DISCOVERY_THING_TYPES_UIDS = new HashSet<>(
|
||||
Arrays.asList(BRIDGE_TYPE_NETWORK));
|
||||
|
||||
public static final String CONFIG_NETWORK_ID = "id";
|
||||
|
@ -100,12 +100,12 @@ public class CBusHandlerFactory extends BaseThingHandlerFactory {
|
||||
private void registerDeviceDiscoveryService(CBusCGateHandler cbusCgateHandler) {
|
||||
CBusNetworkDiscovery discoveryService = new CBusNetworkDiscovery(cbusCgateHandler);
|
||||
cbusCGateHandlerServiceReg = super.bundleContext.registerService(DiscoveryService.class.getName(),
|
||||
discoveryService, new Hashtable<String, Object>());
|
||||
discoveryService, new Hashtable<>());
|
||||
}
|
||||
|
||||
private void registerDeviceDiscoveryService(CBusNetworkHandler cbusNetworkHandler) {
|
||||
CBusGroupDiscovery discoveryService = new CBusGroupDiscovery(cbusNetworkHandler);
|
||||
cbusNetworkHandlerServiceReg = bundleContext.registerService(DiscoveryService.class.getName(), discoveryService,
|
||||
new Hashtable<String, Object>());
|
||||
new Hashtable<>());
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class CBusGroupDiscovery extends AbstractDiscoveryService {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Map<Integer, ThingTypeUID> applications = new HashMap<Integer, ThingTypeUID>();
|
||||
Map<Integer, ThingTypeUID> applications = new HashMap<>();
|
||||
applications.put(CBusBindingConstants.CBUS_APPLICATION_LIGHTING, CBusBindingConstants.THING_TYPE_LIGHT);
|
||||
applications.put(CBusBindingConstants.CBUS_APPLICATION_DALI, CBusBindingConstants.THING_TYPE_DALI);
|
||||
applications.put(CBusBindingConstants.CBUS_APPLICATION_TEMPERATURE,
|
||||
|
@ -51,7 +51,7 @@ public class ComfoAirCommand {
|
||||
|
||||
public ComfoAirCommand(String key, @Nullable Integer requestCmd, @Nullable Integer replyCmd, int[] data,
|
||||
@Nullable Integer dataPosition, @Nullable Integer requestValue) {
|
||||
this.keys = new ArrayList<String>();
|
||||
this.keys = new ArrayList<>();
|
||||
this.keys.add(key);
|
||||
this.requestCmd = requestCmd;
|
||||
this.replyCmd = replyCmd;
|
||||
@ -64,7 +64,7 @@ public class ComfoAirCommand {
|
||||
* Constructor for basic read command
|
||||
*/
|
||||
public ComfoAirCommand(String key) {
|
||||
this.keys = new ArrayList<String>();
|
||||
this.keys = new ArrayList<>();
|
||||
this.keys.add(key);
|
||||
ComfoAirCommandType commandType = ComfoAirCommandType.getCommandTypeByKey(key);
|
||||
if (commandType != null) {
|
||||
|
@ -17,8 +17,6 @@ import static org.openhab.binding.coronastats.internal.CoronaStatsBindingConstan
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.measure.quantity.Dimensionless;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.library.types.QuantityType;
|
||||
import org.openhab.core.library.unit.Units;
|
||||
@ -58,7 +56,7 @@ public class CoronaStatsCases {
|
||||
if (count == -1) {
|
||||
return UnDefType.NULL;
|
||||
} else {
|
||||
return new QuantityType<Dimensionless>(count, Units.ONE);
|
||||
return new QuantityType<>(count, Units.ONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class DaliFrame {
|
||||
|
||||
public byte[] pack() {
|
||||
int remaining = length();
|
||||
List<Byte> bytesList = new ArrayList<Byte>();
|
||||
List<Byte> bytesList = new ArrayList<>();
|
||||
int tmp = this.data;
|
||||
while (remaining > 0) {
|
||||
bytesList.add((byte) (tmp & 0xff));
|
||||
|
@ -428,7 +428,7 @@ public final class EventAttribute<VALUE_TYPE, STATE_TYPE extends State>
|
||||
* Used for derived attributes that can't be set.
|
||||
*/
|
||||
private static <VALUE_TYPE> BiConsumer<Event, VALUE_TYPE> voidSetter() {
|
||||
return new BiConsumer<Event, VALUE_TYPE>() {
|
||||
return new BiConsumer<>() {
|
||||
|
||||
@Override
|
||||
public void accept(Event t, VALUE_TYPE u) {
|
||||
|
@ -57,8 +57,8 @@ public class TimetableStubHttpCallable implements HttpCallable {
|
||||
public TimetableStubHttpCallable(File testdataDir) {
|
||||
this.testdataDir = testdataDir;
|
||||
this.requestedPlanUrls = new ArrayList<>();
|
||||
this.requestedFullChangesUrls = new ArrayList<String>();
|
||||
this.requestedRecentChangesUrls = new ArrayList<String>();
|
||||
this.requestedFullChangesUrls = new ArrayList<>();
|
||||
this.requestedRecentChangesUrls = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void addAvailableUrl(String url) {
|
||||
|
@ -30,7 +30,6 @@ import org.openhab.binding.digitalstrom.internal.lib.listener.TemperatureControl
|
||||
import org.openhab.binding.digitalstrom.internal.lib.manager.StructureManager;
|
||||
import org.openhab.binding.digitalstrom.internal.lib.manager.impl.TemperatureControlManager;
|
||||
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.ApplicationGroup;
|
||||
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.OutputChannelEnum;
|
||||
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.OutputModeEnum;
|
||||
import org.openhab.binding.digitalstrom.internal.providers.DsChannelTypeProvider;
|
||||
import org.openhab.core.config.core.Configuration;
|
||||
@ -282,13 +281,13 @@ public class ZoneTemperatureControlHandler extends BaseThingHandler implements T
|
||||
|| !currentChannelID.contains(DsChannelTypeProvider.TEMPERATURE_CONTROLLED))
|
||||
&& !controlState.equals(ControlStates.EMERGENCY)) {
|
||||
currentChannelID = DsChannelTypeProvider.getOutputChannelTypeID(ApplicationGroup.Color.BLUE,
|
||||
OutputModeEnum.TEMPRETURE_PWM, new ArrayList<OutputChannelEnum>());
|
||||
OutputModeEnum.TEMPRETURE_PWM, new ArrayList<>());
|
||||
loadChannel();
|
||||
currentValue = tempControlStatus.getNominalValue();
|
||||
updateState(currentChannelID, new DecimalType(currentValue.doubleValue()));
|
||||
} else if (!controlMode.equals(ControlModes.PID_CONTROL) && !controlMode.equals(ControlModes.OFF)) {
|
||||
currentChannelID = DsChannelTypeProvider.getOutputChannelTypeID(ApplicationGroup.Color.BLUE,
|
||||
OutputModeEnum.HEATING_PWM, new ArrayList<OutputChannelEnum>());
|
||||
OutputModeEnum.HEATING_PWM, new ArrayList<>());
|
||||
loadChannel();
|
||||
currentValue = tempControlStatus.getControlValue();
|
||||
updateState(currentChannelID, new PercentType(fixPercent(currentValue.intValue())));
|
||||
|
@ -65,7 +65,7 @@ public class EGateHandler extends BaseBridgeHandler {
|
||||
|
||||
public EGateHandler(Bridge thing) {
|
||||
super(thing);
|
||||
registeredBlinds = new HashMap<String, ThingUID>();
|
||||
registeredBlinds = new HashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -317,7 +317,7 @@ public class EGateHandler extends BaseBridgeHandler {
|
||||
|
||||
protected void onData(String input) {
|
||||
// Instruction=2;ID=19;Command=1;Value=0;Priority=0;
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
// split on ;
|
||||
String[] parts = input.split(";");
|
||||
if (parts.length >= 2) {
|
||||
|
@ -16,8 +16,6 @@ import static org.openhab.binding.draytonwiser.internal.DraytonWiserBindingConst
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.measure.quantity.Time;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.draytonwiser.internal.api.DraytonWiserApiException;
|
||||
@ -132,10 +130,10 @@ public class HotWaterHandler extends DraytonWiserThingHandler<HotWaterData> {
|
||||
final Integer overrideTimeout = firstChannel.getOverrideTimeoutUnixTime();
|
||||
|
||||
if (overrideTimeout != null && !"NONE".equalsIgnoreCase(firstChannel.getOverrideType())) {
|
||||
return new QuantityType<Time>(overrideTimeout - (System.currentTimeMillis() / 1000L), Units.SECOND);
|
||||
return new QuantityType<>(overrideTimeout - (System.currentTimeMillis() / 1000L), Units.SECOND);
|
||||
}
|
||||
}
|
||||
return new QuantityType<Time>(0, Units.SECOND);
|
||||
return new QuantityType<>(0, Units.SECOND);
|
||||
}
|
||||
|
||||
static class HotWaterData {
|
||||
|
@ -14,8 +14,6 @@ package org.openhab.binding.draytonwiser.internal.handler;
|
||||
|
||||
import static org.openhab.binding.draytonwiser.internal.DraytonWiserBindingConstants.*;
|
||||
|
||||
import javax.measure.quantity.Time;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.draytonwiser.internal.api.DraytonWiserApiException;
|
||||
@ -167,9 +165,9 @@ public class RoomHandler extends DraytonWiserThingHandler<RoomDTO> {
|
||||
private State getBoostRemainingState() {
|
||||
final Integer overrideTimeout = getData().getOverrideTimeoutUnixTime();
|
||||
if (overrideTimeout != null && !"NONE".equalsIgnoreCase(getData().getOverrideType())) {
|
||||
return new QuantityType<Time>(overrideTimeout - (System.currentTimeMillis() / 1000L), Units.SECOND);
|
||||
return new QuantityType<>(overrideTimeout - (System.currentTimeMillis() / 1000L), Units.SECOND);
|
||||
}
|
||||
return new QuantityType<Time>(0, Units.SECOND);
|
||||
return new QuantityType<>(0, Units.SECOND);
|
||||
}
|
||||
|
||||
private void setBoostDuration(final int durationMinutes) throws DraytonWiserApiException {
|
||||
|
@ -425,7 +425,7 @@ public class P1TelegramParser implements TelegramParser {
|
||||
final String obisIdString = obisId.toString();
|
||||
|
||||
if (!obisIdString.isEmpty()) {
|
||||
cosemObjects.add(new SimpleEntry<String, String>(obisIdString, obisValue.toString()));
|
||||
cosemObjects.add(new SimpleEntry<>(obisIdString, obisValue.toString()));
|
||||
}
|
||||
clearObisData();
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public abstract class AbstractWriteCommand extends AbstractCommand {
|
||||
* @throws ValidationException
|
||||
*/
|
||||
protected String getJsonContent() throws ValidationException {
|
||||
Map<String, String> content = new HashMap<String, String>(1);
|
||||
Map<String, String> content = new HashMap<>(1);
|
||||
content.put(channel.getUID().getIdWithoutGroup(), getCommandValue());
|
||||
|
||||
return gson.toJson(content);
|
||||
|
@ -56,7 +56,7 @@ public class SetDynamicCircuitCurrents extends AbstractWriteCommand {
|
||||
*/
|
||||
@Override
|
||||
protected String getJsonContent() throws ValidationException {
|
||||
Map<String, String> content = new HashMap<String, String>(3);
|
||||
Map<String, String> content = new HashMap<>(3);
|
||||
String rawCommand = getCommandValue();
|
||||
String[] tokens = rawCommand.split(";");
|
||||
if (tokens.length == 3) {
|
||||
|
@ -46,7 +46,7 @@ public class SetMaxCircuitCurrents extends SetCircuitSettings {
|
||||
*/
|
||||
@Override
|
||||
protected String getJsonContent() throws ValidationException {
|
||||
Map<String, String> content = new HashMap<String, String>(3);
|
||||
Map<String, String> content = new HashMap<>(3);
|
||||
String rawCommand = getCommandValue();
|
||||
String[] tokens = rawCommand.split(";");
|
||||
if (tokens.length == 3) {
|
||||
|
@ -46,7 +46,7 @@ public class SetOfflineMaxCircuitCurrents extends SetCircuitSettings {
|
||||
*/
|
||||
@Override
|
||||
protected String getJsonContent() throws ValidationException {
|
||||
Map<String, String> content = new HashMap<String, String>(3);
|
||||
Map<String, String> content = new HashMap<>(3);
|
||||
String rawCommand = getCommandValue();
|
||||
String[] tokens = rawCommand.split(";");
|
||||
if (tokens.length == 3) {
|
||||
|
@ -402,8 +402,8 @@ public class EcobeeBindingConstants {
|
||||
public static final HouseDetailsDTO EMPTY_HOUSEDETAILS = new HouseDetailsDTO();
|
||||
public static final ManagementDTO EMPTY_MANAGEMENT = new ManagementDTO();
|
||||
public static final TechnicianDTO EMPTY_TECHNICIAN = new TechnicianDTO();
|
||||
public static final List<RemoteSensorDTO> EMPTY_SENSORS = Collections.<RemoteSensorDTO> emptyList();
|
||||
public static final List<ThermostatDTO> EMPTY_THERMOSTATS = Collections.<ThermostatDTO> emptyList();
|
||||
public static final List<RemoteSensorDTO> EMPTY_SENSORS = Collections.emptyList();
|
||||
public static final List<ThermostatDTO> EMPTY_THERMOSTATS = Collections.emptyList();
|
||||
|
||||
public static final String ECOBEE_BASE_URL = "https://api.ecobee.com/";
|
||||
public static final String ECOBEE_AUTHORIZE_URL = ECOBEE_BASE_URL + "authorize";
|
||||
|
@ -281,7 +281,7 @@ public class EcobeeActions implements ThingActions {
|
||||
if (coolHoldTemp == null || heatHoldTemp == null) {
|
||||
throw new IllegalArgumentException("hold temperatures cannot be null");
|
||||
}
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("coolHoldTemp", coolHoldTemp);
|
||||
params.put("heatHoldTemp", heatHoldTemp);
|
||||
return setHold(params, null, null, null, null);
|
||||
@ -306,7 +306,7 @@ public class EcobeeActions implements ThingActions {
|
||||
if (holdHours == null) {
|
||||
throw new IllegalArgumentException("number of hold hours is missing");
|
||||
}
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("coolHoldTemp", coolHoldTemp);
|
||||
params.put("heatHoldTemp", heatHoldTemp);
|
||||
return setHold(params, HoldType.HOLD_HOURS.toString(), holdHours, null, null);
|
||||
@ -331,7 +331,7 @@ public class EcobeeActions implements ThingActions {
|
||||
if (holdClimateRef == null || !localHandler.isValidClimateRef(holdClimateRef)) {
|
||||
throw new IllegalArgumentException("hold climate ref is missing or invalid");
|
||||
}
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("holdClimateRef", holdClimateRef);
|
||||
return setHold(params, null, null, null, null);
|
||||
}
|
||||
@ -358,7 +358,7 @@ public class EcobeeActions implements ThingActions {
|
||||
if (holdClimateRef == null || !localHandler.isValidClimateRef(holdClimateRef)) {
|
||||
throw new IllegalArgumentException("hold climate ref is missing or invalid");
|
||||
}
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("holdClimateRef", holdClimateRef);
|
||||
return setHold(params, HoldType.HOLD_HOURS.toString(), holdHours, null, null);
|
||||
}
|
||||
@ -379,7 +379,7 @@ public class EcobeeActions implements ThingActions {
|
||||
@ActionInput(name = "endDateTime", description = "(opt) The end date in thermostat time.") @Nullable Date endDateTime,
|
||||
@ActionInput(name = "holdType", description = "(opt) The hold duration type. Valid values: dateTime, nextTransition, indefinite, holdHours.") @Nullable String holdType,
|
||||
@ActionInput(name = "holdHours", description = "(opt) The number of hours to hold for, used and required if holdType='holdHours'.") @Nullable Number holdHours) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
if (coolHoldTemp != null) {
|
||||
params.put("coolHoldTemp", coolHoldTemp);
|
||||
}
|
||||
|
@ -188,8 +188,7 @@ public class EcobeeAccountBridgeHandler extends BaseBridgeHandler {
|
||||
|
||||
public SelectionDTO getSelection() {
|
||||
SelectionDTO mergedSelection = new SelectionDTO();
|
||||
for (EcobeeThermostatBridgeHandler handler : new ArrayList<EcobeeThermostatBridgeHandler>(
|
||||
thermostatHandlers.values())) {
|
||||
for (EcobeeThermostatBridgeHandler handler : new ArrayList<>(thermostatHandlers.values())) {
|
||||
SelectionDTO selection = handler.getSelection();
|
||||
logger.trace("AccountBridge: Thermostat {} selection: {}", handler.getThing().getUID(), selection);
|
||||
mergedSelection.mergeSelection(selection);
|
||||
|
@ -162,7 +162,7 @@ public class EcoTouchConnector {
|
||||
public Map<String, String> getValues(Set<String> tags) throws Exception {
|
||||
final Integer maxNum = 100;
|
||||
|
||||
Map<String, String> result = new HashMap<String, String>();
|
||||
Map<String, String> result = new HashMap<>();
|
||||
Integer counter = 1;
|
||||
StringBuilder query = new StringBuilder();
|
||||
Iterator<String> iter = tags.iterator();
|
||||
@ -196,7 +196,7 @@ public class EcoTouchConnector {
|
||||
*/
|
||||
private Map<String, String> getValues(String url) throws Exception {
|
||||
trylogin(false);
|
||||
Map<String, String> result = new HashMap<String, String>();
|
||||
Map<String, String> result = new HashMap<>();
|
||||
int loginAttempt = 0;
|
||||
while (loginAttempt < 2) {
|
||||
BufferedReader reader = null;
|
||||
|
@ -72,7 +72,7 @@ public class EcoTouchHandler extends BaseThingHandler {
|
||||
// this type needs special treatment
|
||||
// the following reads: value = value / 2 - 2
|
||||
value = value.divide(new BigDecimal(2), 1, RoundingMode.UNNECESSARY).subtract(new BigDecimal(2));
|
||||
QuantityType<?> quantity = new QuantityType<javax.measure.quantity.Temperature>(value, CELSIUS);
|
||||
QuantityType<?> quantity = new QuantityType<>(value, CELSIUS);
|
||||
updateState(channel, quantity);
|
||||
} else {
|
||||
if (ecoTouchTag.getUnit() != ONE) {
|
||||
@ -191,7 +191,7 @@ public class EcoTouchHandler extends BaseThingHandler {
|
||||
if (localRefreshJob == null || localRefreshJob.isCancelled()) {
|
||||
Runnable runnable = () -> {
|
||||
try {
|
||||
Set<String> tags = new HashSet<String>();
|
||||
Set<String> tags = new HashSet<>();
|
||||
for (EcoTouchTags ecoTouchTag : EcoTouchTags.values()) {
|
||||
String channel = ecoTouchTag.getCommand();
|
||||
boolean linked = isLinked(channel);
|
||||
|
@ -1287,7 +1287,7 @@ public enum EcoTouchTags {
|
||||
* @return first matching EcoTouchTags instance, if available
|
||||
*/
|
||||
public static List<EcoTouchTags> fromTag(String tag) {
|
||||
List<EcoTouchTags> result = new LinkedList<EcoTouchTags>();
|
||||
List<EcoTouchTags> result = new LinkedList<>();
|
||||
for (EcoTouchTags c : EcoTouchTags.values()) {
|
||||
if (c.getTagName().equals(tag)) {
|
||||
result.add(c);
|
||||
|
@ -85,36 +85,31 @@ public class EcovacsBindingConstants {
|
||||
public static final String CMD_SPOT_AREA = "spotArea";
|
||||
public static final String CMD_CUSTOM_AREA = "customArea";
|
||||
|
||||
public static final StateOptionMapping<CleanMode> CLEAN_MODE_MAPPING = StateOptionMapping.<CleanMode> of(
|
||||
new StateOptionEntry<CleanMode>(CleanMode.AUTO, "auto"),
|
||||
new StateOptionEntry<CleanMode>(CleanMode.EDGE, "edge", DeviceCapability.EDGE_CLEANING),
|
||||
new StateOptionEntry<CleanMode>(CleanMode.SPOT, "spot", DeviceCapability.SPOT_CLEANING),
|
||||
new StateOptionEntry<CleanMode>(CleanMode.SPOT_AREA, "spotArea", DeviceCapability.SPOT_AREA_CLEANING),
|
||||
new StateOptionEntry<CleanMode>(CleanMode.CUSTOM_AREA, "customArea", DeviceCapability.CUSTOM_AREA_CLEANING),
|
||||
new StateOptionEntry<CleanMode>(CleanMode.SINGLE_ROOM, "singleRoom", DeviceCapability.SINGLE_ROOM_CLEANING),
|
||||
new StateOptionEntry<CleanMode>(CleanMode.PAUSE, "pause"),
|
||||
new StateOptionEntry<CleanMode>(CleanMode.STOP, "stop"),
|
||||
new StateOptionEntry<CleanMode>(CleanMode.WASHING, "washing"),
|
||||
new StateOptionEntry<CleanMode>(CleanMode.DRYING, "drying"),
|
||||
new StateOptionEntry<CleanMode>(CleanMode.RETURNING, "returning"));
|
||||
public static final StateOptionMapping<CleanMode> CLEAN_MODE_MAPPING = StateOptionMapping.of(
|
||||
new StateOptionEntry<>(CleanMode.AUTO, "auto"),
|
||||
new StateOptionEntry<>(CleanMode.EDGE, "edge", DeviceCapability.EDGE_CLEANING),
|
||||
new StateOptionEntry<>(CleanMode.SPOT, "spot", DeviceCapability.SPOT_CLEANING),
|
||||
new StateOptionEntry<>(CleanMode.SPOT_AREA, "spotArea", DeviceCapability.SPOT_AREA_CLEANING),
|
||||
new StateOptionEntry<>(CleanMode.CUSTOM_AREA, "customArea", DeviceCapability.CUSTOM_AREA_CLEANING),
|
||||
new StateOptionEntry<>(CleanMode.SINGLE_ROOM, "singleRoom", DeviceCapability.SINGLE_ROOM_CLEANING),
|
||||
new StateOptionEntry<>(CleanMode.PAUSE, "pause"), new StateOptionEntry<>(CleanMode.STOP, "stop"),
|
||||
new StateOptionEntry<>(CleanMode.WASHING, "washing"), new StateOptionEntry<>(CleanMode.DRYING, "drying"),
|
||||
new StateOptionEntry<>(CleanMode.RETURNING, "returning"));
|
||||
|
||||
public static final StateOptionMapping<MoppingWaterAmount> WATER_AMOUNT_MAPPING = StateOptionMapping
|
||||
.<MoppingWaterAmount> of(new StateOptionEntry<MoppingWaterAmount>(MoppingWaterAmount.LOW, "low"),
|
||||
new StateOptionEntry<MoppingWaterAmount>(MoppingWaterAmount.MEDIUM, "medium"),
|
||||
new StateOptionEntry<MoppingWaterAmount>(MoppingWaterAmount.HIGH, "high"),
|
||||
new StateOptionEntry<MoppingWaterAmount>(MoppingWaterAmount.VERY_HIGH, "veryhigh"));
|
||||
public static final StateOptionMapping<MoppingWaterAmount> WATER_AMOUNT_MAPPING = StateOptionMapping.of(
|
||||
new StateOptionEntry<>(MoppingWaterAmount.LOW, "low"),
|
||||
new StateOptionEntry<>(MoppingWaterAmount.MEDIUM, "medium"),
|
||||
new StateOptionEntry<>(MoppingWaterAmount.HIGH, "high"),
|
||||
new StateOptionEntry<>(MoppingWaterAmount.VERY_HIGH, "veryhigh"));
|
||||
|
||||
public static final StateOptionMapping<SuctionPower> SUCTION_POWER_MAPPING = StateOptionMapping.<SuctionPower> of(
|
||||
new StateOptionEntry<SuctionPower>(SuctionPower.SILENT, "silent",
|
||||
DeviceCapability.EXTENDED_CLEAN_SPEED_CONTROL),
|
||||
new StateOptionEntry<SuctionPower>(SuctionPower.NORMAL, "normal"),
|
||||
new StateOptionEntry<SuctionPower>(SuctionPower.HIGH, "high"), new StateOptionEntry<SuctionPower>(
|
||||
SuctionPower.HIGHER, "higher", DeviceCapability.EXTENDED_CLEAN_SPEED_CONTROL));
|
||||
public static final StateOptionMapping<SuctionPower> SUCTION_POWER_MAPPING = StateOptionMapping.of(
|
||||
new StateOptionEntry<>(SuctionPower.SILENT, "silent", DeviceCapability.EXTENDED_CLEAN_SPEED_CONTROL),
|
||||
new StateOptionEntry<>(SuctionPower.NORMAL, "normal"), new StateOptionEntry<>(SuctionPower.HIGH, "high"),
|
||||
new StateOptionEntry<>(SuctionPower.HIGHER, "higher", DeviceCapability.EXTENDED_CLEAN_SPEED_CONTROL));
|
||||
|
||||
public static final StateOptionMapping<SoundType> SOUND_TYPE_MAPPING = StateOptionMapping.<SoundType> of(
|
||||
new StateOptionEntry<SoundType>(SoundType.BEEP, "beep"),
|
||||
new StateOptionEntry<SoundType>(SoundType.I_AM_HERE, "iAmHere"),
|
||||
new StateOptionEntry<SoundType>(SoundType.STARTUP, "startup"),
|
||||
new StateOptionEntry<SoundType>(SoundType.SUSPENDED, "suspended"),
|
||||
new StateOptionEntry<SoundType>(SoundType.BATTERY_LOW, "batteryLow"));
|
||||
public static final StateOptionMapping<SoundType> SOUND_TYPE_MAPPING = StateOptionMapping.of(
|
||||
new StateOptionEntry<>(SoundType.BEEP, "beep"), new StateOptionEntry<>(SoundType.I_AM_HERE, "iAmHere"),
|
||||
new StateOptionEntry<>(SoundType.STARTUP, "startup"),
|
||||
new StateOptionEntry<>(SoundType.SUSPENDED, "suspended"),
|
||||
new StateOptionEntry<>(SoundType.BATTERY_LOW, "batteryLow"));
|
||||
}
|
||||
|
@ -17,16 +17,12 @@ import static org.openhab.binding.electroluxair.internal.ElectroluxAirBindingCon
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.measure.quantity.Dimensionless;
|
||||
import javax.measure.quantity.Temperature;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.electroluxair.internal.ElectroluxAirBindingConstants;
|
||||
import org.openhab.binding.electroluxair.internal.ElectroluxAirConfiguration;
|
||||
import org.openhab.binding.electroluxair.internal.api.ElectroluxDeltaAPI;
|
||||
import org.openhab.binding.electroluxair.internal.dto.ElectroluxPureA9DTO;
|
||||
import org.openhab.core.library.dimension.Density;
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
import org.openhab.core.library.types.OpenClosedType;
|
||||
import org.openhab.core.library.types.QuantityType;
|
||||
@ -187,29 +183,23 @@ public class ElectroluxAirHandler extends BaseThingHandler {
|
||||
private State getValue(String channelId, ElectroluxPureA9DTO dto) {
|
||||
switch (channelId) {
|
||||
case CHANNEL_TEMPERATURE:
|
||||
return new QuantityType<Temperature>(dto.getProperties().getReported().getTemp(), SIUnits.CELSIUS);
|
||||
return new QuantityType<>(dto.getProperties().getReported().getTemp(), SIUnits.CELSIUS);
|
||||
case CHANNEL_HUMIDITY:
|
||||
return new QuantityType<Dimensionless>(dto.getProperties().getReported().getHumidity(), Units.PERCENT);
|
||||
return new QuantityType<>(dto.getProperties().getReported().getHumidity(), Units.PERCENT);
|
||||
case CHANNEL_TVOC:
|
||||
return new QuantityType<Density>(dto.getProperties().getReported().getTVOC(),
|
||||
Units.MICROGRAM_PER_CUBICMETRE);
|
||||
return new QuantityType<>(dto.getProperties().getReported().getTVOC(), Units.MICROGRAM_PER_CUBICMETRE);
|
||||
case CHANNEL_PM1:
|
||||
return new QuantityType<Dimensionless>(dto.getProperties().getReported().getPM1(),
|
||||
Units.PARTS_PER_BILLION);
|
||||
return new QuantityType<>(dto.getProperties().getReported().getPM1(), Units.PARTS_PER_BILLION);
|
||||
case CHANNEL_PM25:
|
||||
return new QuantityType<Dimensionless>(dto.getProperties().getReported().getPM25(),
|
||||
Units.PARTS_PER_BILLION);
|
||||
return new QuantityType<>(dto.getProperties().getReported().getPM25(), Units.PARTS_PER_BILLION);
|
||||
case CHANNEL_PM10:
|
||||
return new QuantityType<Dimensionless>(dto.getProperties().getReported().getPM10(),
|
||||
Units.PARTS_PER_BILLION);
|
||||
return new QuantityType<>(dto.getProperties().getReported().getPM10(), Units.PARTS_PER_BILLION);
|
||||
case CHANNEL_CO2:
|
||||
return new QuantityType<Dimensionless>(dto.getProperties().getReported().getCO2(),
|
||||
Units.PARTS_PER_MILLION);
|
||||
return new QuantityType<>(dto.getProperties().getReported().getCO2(), Units.PARTS_PER_MILLION);
|
||||
case CHANNEL_FAN_SPEED:
|
||||
return new StringType(Integer.toString(dto.getProperties().getReported().getFanspeed()));
|
||||
case CHANNEL_FILTER_LIFE:
|
||||
return new QuantityType<Dimensionless>(dto.getProperties().getReported().getFilterLife(),
|
||||
Units.PERCENT);
|
||||
return new QuantityType<>(dto.getProperties().getReported().getFilterLife(), Units.PERCENT);
|
||||
case CHANNEL_IONIZER:
|
||||
return OnOffType.from(dto.getProperties().getReported().isIonizer());
|
||||
case CHANNEL_UI_LIGHT:
|
||||
|
@ -197,7 +197,7 @@ public class TransmitterStick {
|
||||
private final int updateInterval;
|
||||
private final SerialConnection connection;
|
||||
|
||||
private final BlockingQueue<Command> cmdQueue = new DelayQueue<Command>() {
|
||||
private final BlockingQueue<Command> cmdQueue = new DelayQueue<>() {
|
||||
@Override
|
||||
public boolean add(Command e) {
|
||||
if (TransmitterStick.prepareAddition(e, this)) {
|
||||
|
@ -163,7 +163,7 @@ public class CacheManager {
|
||||
* @return spot prices currently available, {@link #NUMBER_OF_HISTORIC_HOURS} back
|
||||
*/
|
||||
public Map<Instant, BigDecimal> getSpotPrices() {
|
||||
return new HashMap<Instant, BigDecimal>(spotPriceMap);
|
||||
return new HashMap<>(spotPriceMap);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -199,7 +199,7 @@ public class CacheManager {
|
||||
if (tariffs == null) {
|
||||
throw new IllegalStateException("Tariffs not initialized");
|
||||
}
|
||||
return new HashMap<Instant, BigDecimal>(tariffs);
|
||||
return new HashMap<>(tariffs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,7 +128,7 @@ public class EnergiDataServiceActions implements ThingActions {
|
||||
|
||||
Set<PriceComponent> priceComponentsSet;
|
||||
try {
|
||||
priceComponentsSet = new HashSet<PriceComponent>(
|
||||
priceComponentsSet = new HashSet<>(
|
||||
Arrays.stream(priceComponents.split(",")).map(PriceComponent::fromString).toList());
|
||||
} catch (IllegalArgumentException e) {
|
||||
logger.warn("{}", e.getMessage());
|
||||
|
@ -69,8 +69,7 @@ public class DatahubPriceConfiguration {
|
||||
*/
|
||||
public Set<ChargeTypeCode> getChargeTypeCodes() {
|
||||
return chargeTypeCodes.isBlank() ? new HashSet<>()
|
||||
: new HashSet<ChargeTypeCode>(
|
||||
Arrays.stream(chargeTypeCodes.split(",")).map(ChargeTypeCode::new).toList());
|
||||
: new HashSet<>(Arrays.stream(chargeTypeCodes.split(",")).map(ChargeTypeCode::new).toList());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,7 +78,7 @@ public class DatahubPriceConfiguration {
|
||||
* @return Set of notes.
|
||||
*/
|
||||
public Set<String> getNotes() {
|
||||
return notes.isBlank() ? new HashSet<>() : new HashSet<String>(Arrays.asList(notes.split(",")));
|
||||
return notes.isBlank() ? new HashSet<>() : new HashSet<>(Arrays.asList(notes.split(",")));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -416,8 +416,9 @@ public enum EEPType {
|
||||
// UniversalCommand(RORG._4BS, 0x3f, 0x7f, false, A5_3F_7F_Universal.class, THING_TYPE_UNIVERSALACTUATOR,
|
||||
// CHANNEL_GENERIC_ROLLERSHUTTER, CHANNEL_GENERIC_LIGHT_SWITCHING, CHANNEL_GENERIC_DIMMER, CHANNEL_TEACHINCMD),
|
||||
EltakoFSB(RORG._4BS, 0x3f, 0x7f, false, false, "EltakoFSB", 0, A5_3F_7F_EltakoFSB.class, THING_TYPE_ROLLERSHUTTER,
|
||||
0, new Hashtable<String, Configuration>() {
|
||||
0, new Hashtable<>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
{
|
||||
put(CHANNEL_ROLLERSHUTTER, new Configuration());
|
||||
put(CHANNEL_TEACHINCMD, new Configuration() {
|
||||
@ -429,8 +430,9 @@ public enum EEPType {
|
||||
}),
|
||||
|
||||
EltakoFRM(RORG._4BS, 0x3f, 0x7f, false, false, "EltakoFRM", 0, A5_3F_7F_EltakoFRM.class, THING_TYPE_ROLLERSHUTTER,
|
||||
0, new Hashtable<String, Configuration>() {
|
||||
0, new Hashtable<>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
{
|
||||
put(CHANNEL_ROLLERSHUTTER, new Configuration());
|
||||
put(CHANNEL_TEACHINCMD, new Configuration() {
|
||||
|
@ -53,25 +53,24 @@ import org.openhab.core.util.HexUtils;
|
||||
@NonNullByDefault
|
||||
public class GenericEEP extends EEP {
|
||||
|
||||
final List<Class<? extends State>> supportedStates = Collections
|
||||
.unmodifiableList(new LinkedList<Class<? extends State>>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
final List<Class<? extends State>> supportedStates = Collections.unmodifiableList(new LinkedList<>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
{
|
||||
add(DateTimeType.class);
|
||||
add(DecimalType.class);
|
||||
add(HSBType.class);
|
||||
add(OnOffType.class);
|
||||
add(OpenClosedType.class);
|
||||
add(PercentType.class);
|
||||
add(PlayPauseType.class);
|
||||
add(PointType.class);
|
||||
add(RewindFastforwardType.class);
|
||||
add(StringListType.class);
|
||||
add(StringType.class);
|
||||
add(UpDownType.class);
|
||||
}
|
||||
});
|
||||
{
|
||||
add(DateTimeType.class);
|
||||
add(DecimalType.class);
|
||||
add(HSBType.class);
|
||||
add(OnOffType.class);
|
||||
add(OpenClosedType.class);
|
||||
add(PercentType.class);
|
||||
add(PlayPauseType.class);
|
||||
add(PointType.class);
|
||||
add(RewindFastforwardType.class);
|
||||
add(StringListType.class);
|
||||
add(StringType.class);
|
||||
add(UpDownType.class);
|
||||
}
|
||||
});
|
||||
|
||||
public GenericEEP() {
|
||||
super();
|
||||
|
@ -12,8 +12,6 @@
|
||||
*/
|
||||
package org.openhab.binding.evohome.internal.handler;
|
||||
|
||||
import javax.measure.quantity.Temperature;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.evohome.internal.EvohomeBindingConstants;
|
||||
@ -69,11 +67,11 @@ public class EvohomeHeatingZoneHandler extends BaseEvohomeHandler {
|
||||
updateEvohomeThingStatus(ThingStatus.ONLINE);
|
||||
|
||||
updateState(EvohomeBindingConstants.ZONE_TEMPERATURE_CHANNEL,
|
||||
new QuantityType<Temperature>(zoneStatus.getTemperature().getTemperature(), SIUnits.CELSIUS));
|
||||
new QuantityType<>(zoneStatus.getTemperature().getTemperature(), SIUnits.CELSIUS));
|
||||
updateState(EvohomeBindingConstants.ZONE_SET_POINT_STATUS_CHANNEL,
|
||||
new StringType(zoneStatus.getHeatSetpoint().getSetpointMode()));
|
||||
updateState(EvohomeBindingConstants.ZONE_SET_POINT_CHANNEL, new QuantityType<Temperature>(
|
||||
zoneStatus.getHeatSetpoint().getTargetTemperature(), SIUnits.CELSIUS));
|
||||
updateState(EvohomeBindingConstants.ZONE_SET_POINT_CHANNEL,
|
||||
new QuantityType<>(zoneStatus.getHeatSetpoint().getTargetTemperature(), SIUnits.CELSIUS));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class FlicButtonBindingConstants {
|
||||
public static final int BUTTON_OFFLINE_GRACE_PERIOD_SECONDS = 60;
|
||||
|
||||
public static final Map<String, String> FLIC_OPENHAB_TRIGGER_EVENT_MAP = Collections
|
||||
.unmodifiableMap(new HashMap<String, String>() {
|
||||
.unmodifiableMap(new HashMap<>() {
|
||||
{
|
||||
put("ButtonSingleClick", CommonTriggerEvents.SHORT_PRESSED);
|
||||
put("ButtonDoubleClick", CommonTriggerEvents.DOUBLE_PRESSED);
|
||||
|
@ -86,7 +86,7 @@ public class FlicButtonHandlerFactory extends BaseThingHandlerFactory {
|
||||
private synchronized void registerDiscoveryService(FlicButtonDiscoveryService discoveryService,
|
||||
ThingUID bridgeUID) {
|
||||
this.discoveryServiceRegs.put(bridgeUID, getBundleContext().registerService(DiscoveryService.class.getName(),
|
||||
discoveryService, new Hashtable<String, Object>()));
|
||||
discoveryService, new Hashtable<>()));
|
||||
}
|
||||
|
||||
private synchronized void unregisterDiscoveryService(ThingUID bridgeUID) {
|
||||
|
@ -75,7 +75,7 @@ public class FMIResponse {
|
||||
Entry<Location, Map<String, List<Long>>> locationEntry) {
|
||||
Location location = locationEntry.getKey();
|
||||
Map<String, List<Long>> timestampsByParameter = locationEntry.getValue();
|
||||
out.put(location, new HashMap<String, Data>(timestampsByParameter.size()));
|
||||
out.put(location, new HashMap<>(timestampsByParameter.size()));
|
||||
timestampsByParameter.entrySet().stream().forEach(parameterEntry -> {
|
||||
collectValuesForParameter(out, location, parameterEntry);
|
||||
});
|
||||
|
@ -90,7 +90,7 @@ public class AbstractFMIResponseParsingTest {
|
||||
}
|
||||
|
||||
protected static Matcher<Data> deeplyEqualTo(long start, int intervalMinutes, String... values) {
|
||||
return new TypeSafeMatcher<Data>() {
|
||||
return new TypeSafeMatcher<>() {
|
||||
|
||||
private TimestampMatcher timestampMatcher = new TimestampMatcher(start, intervalMinutes, values.length);
|
||||
private ValuesMatcher valuesMatcher = new ValuesMatcher(values);
|
||||
|
@ -80,8 +80,8 @@ public class S3Actions {
|
||||
}
|
||||
|
||||
public List<String> listBucket(String prefix) throws APIException, AuthException {
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
Map<String, String> params = new HashMap<>();
|
||||
return listObjectsV2(prefix, headers, params);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public abstract class AWS4SignerBase {
|
||||
}
|
||||
|
||||
protected static String getCanonicalizeHeaderNames(Map<String, String> headers) {
|
||||
List<String> sortedHeaders = new ArrayList<String>();
|
||||
List<String> sortedHeaders = new ArrayList<>();
|
||||
sortedHeaders.addAll(headers.keySet());
|
||||
Collections.sort(sortedHeaders, String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
@ -89,7 +89,7 @@ public abstract class AWS4SignerBase {
|
||||
return "";
|
||||
}
|
||||
|
||||
List<String> sortedHeaders = new ArrayList<String>();
|
||||
List<String> sortedHeaders = new ArrayList<>();
|
||||
sortedHeaders.addAll(headers.keySet());
|
||||
Collections.sort(sortedHeaders, String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
@ -129,7 +129,7 @@ public abstract class AWS4SignerBase {
|
||||
return "";
|
||||
}
|
||||
|
||||
SortedMap<String, String> sorted = new TreeMap<String, String>();
|
||||
SortedMap<String, String> sorted = new TreeMap<>();
|
||||
Iterator<Map.Entry<String, String>> pairs = parameters.entrySet().iterator();
|
||||
|
||||
while (pairs.hasNext()) {
|
||||
|
@ -46,7 +46,7 @@ public class StrictEnumTypeAdapterFactory implements TypeAdapterFactory {
|
||||
}
|
||||
|
||||
private <T> TypeAdapter<T> newStrictEnumAdapter(TypeAdapter<T> delegateAdapter) {
|
||||
return new TypeAdapter<T>() {
|
||||
return new TypeAdapter<>() {
|
||||
@Override
|
||||
public void write(JsonWriter out, @Nullable T value) throws IOException {
|
||||
delegateAdapter.write(out, value);
|
||||
|
@ -167,7 +167,7 @@ public class HomeManager extends RestManager {
|
||||
}
|
||||
|
||||
public <T> boolean putCommand(int nodeId, int stateSignalId, T value) throws FreeboxException {
|
||||
put(new EndpointValue<T>(value), ENDPOINTS_PATH, String.valueOf(nodeId), String.valueOf(stateSignalId));
|
||||
put(new EndpointValue<>(value), ENDPOINTS_PATH, String.valueOf(nodeId), String.valueOf(stateSignalId));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -42,9 +42,10 @@ import org.osgi.service.component.annotations.Component;
|
||||
@NonNullByDefault
|
||||
public class FroniusHandlerFactory extends BaseThingHandlerFactory {
|
||||
|
||||
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = new HashSet<ThingTypeUID>() {
|
||||
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = new HashSet<>() {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
{
|
||||
add(THING_TYPE_INVERTER);
|
||||
add(THING_TYPE_BRIDGE);
|
||||
|
@ -80,7 +80,7 @@ public class GeneracMobileLinkAccountHandler extends BaseBridgeHandler {
|
||||
.create();
|
||||
private HttpClient httpClient;
|
||||
private GeneracMobileLinkDiscoveryService discoveryService;
|
||||
private Map<String, Apparatus> apparatusesCache = new HashMap<String, Apparatus>();
|
||||
private Map<String, Apparatus> apparatusesCache = new HashMap<>();
|
||||
private int refreshIntervalSeconds = 60;
|
||||
private boolean loggedIn;
|
||||
|
||||
|
@ -16,10 +16,6 @@ import static org.openhab.binding.generacmobilelink.internal.GeneracMobileLinkBi
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.measure.quantity.Dimensionless;
|
||||
import javax.measure.quantity.ElectricPotential;
|
||||
import javax.measure.quantity.Time;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.generacmobilelink.internal.dto.Apparatus;
|
||||
@ -95,7 +91,7 @@ public class GeneracMobileLinkGeneratorHandler extends BaseThingHandler {
|
||||
updateState(CHANNEL_CONNECTION_TIME, new DateTimeType(apparatusDetail.connectionTimestamp));
|
||||
Arrays.stream(apparatusDetail.properties).filter(p -> p.type == 70).findFirst().ifPresent(p -> {
|
||||
try {
|
||||
updateState(CHANNEL_RUN_HOURS, new QuantityType<Time>(Integer.parseInt(p.value), Units.HOUR));
|
||||
updateState(CHANNEL_RUN_HOURS, new QuantityType<>(Integer.parseInt(p.value), Units.HOUR));
|
||||
} catch (NumberFormatException e) {
|
||||
logger.debug("Could not parse runHours {}", p.value);
|
||||
updateState(CHANNEL_RUN_HOURS, UnDefType.UNDEF);
|
||||
@ -103,8 +99,7 @@ public class GeneracMobileLinkGeneratorHandler extends BaseThingHandler {
|
||||
});
|
||||
Arrays.stream(apparatusDetail.properties).filter(p -> p.type == 69).findFirst().ifPresent(p -> {
|
||||
try {
|
||||
updateState(CHANNEL_BATTERY_VOLTAGE,
|
||||
new QuantityType<ElectricPotential>(Float.parseFloat(p.value), Units.VOLT));
|
||||
updateState(CHANNEL_BATTERY_VOLTAGE, new QuantityType<>(Float.parseFloat(p.value), Units.VOLT));
|
||||
} catch (NumberFormatException e) {
|
||||
logger.debug("Could not parse batteryVoltage {}", p.value);
|
||||
updateState(CHANNEL_BATTERY_VOLTAGE, UnDefType.UNDEF);
|
||||
@ -112,7 +107,7 @@ public class GeneracMobileLinkGeneratorHandler extends BaseThingHandler {
|
||||
});
|
||||
Arrays.stream(apparatusDetail.properties).filter(p -> p.type == 31).findFirst().ifPresent(p -> {
|
||||
try {
|
||||
updateState(CHANNEL_HOURS_OF_PROTECTION, new QuantityType<Time>(Float.parseFloat(p.value), Units.HOUR));
|
||||
updateState(CHANNEL_HOURS_OF_PROTECTION, new QuantityType<>(Float.parseFloat(p.value), Units.HOUR));
|
||||
} catch (NumberFormatException e) {
|
||||
logger.debug("Could not parse hoursOfProtection {}", p.value);
|
||||
updateState(CHANNEL_HOURS_OF_PROTECTION, UnDefType.UNDEF);
|
||||
@ -121,7 +116,7 @@ public class GeneracMobileLinkGeneratorHandler extends BaseThingHandler {
|
||||
apparatus.properties.stream().filter(p -> p.type == 3).findFirst().ifPresent(p -> {
|
||||
try {
|
||||
if (p.value.signalStrength != null) {
|
||||
updateState(CHANNEL_SIGNAL_STRENGH, new QuantityType<Dimensionless>(
|
||||
updateState(CHANNEL_SIGNAL_STRENGH, new QuantityType<>(
|
||||
Integer.parseInt(p.value.signalStrength.replace("%", "")), Units.PERCENT));
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
|
@ -131,7 +131,7 @@ public class GroheOndusSenseGuardHandler<T, M> extends GroheOndusBaseHandler<App
|
||||
private QuantityType<Volume> sumWaterConsumption(Data dataPoint) {
|
||||
Double waterConsumption = dataPoint.getWithdrawals().stream()
|
||||
.mapToDouble(withdrawal -> withdrawal.getWaterconsumption()).sum();
|
||||
return new QuantityType<Volume>(waterConsumption, Units.LITRE);
|
||||
return new QuantityType<>(waterConsumption, Units.LITRE);
|
||||
}
|
||||
|
||||
private Measurement getLastMeasurement(Data dataPoint) {
|
||||
|
@ -398,7 +398,7 @@ public class GroupePSAHandler extends BaseThingHandler {
|
||||
|
||||
protected <T extends Quantity<T>> void updateState(String channelID, @Nullable BigDecimal number, Unit<T> unit) {
|
||||
if (number != null) {
|
||||
updateState(channelID, new QuantityType<T>(number, unit));
|
||||
updateState(channelID, new QuantityType<>(number, unit));
|
||||
} else {
|
||||
updateState(channelID, UnDefType.UNDEF);
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public class HaasSohnpelletstoveHandler extends BaseThingHandler {
|
||||
|
||||
private boolean automaticRefreshing = false;
|
||||
|
||||
private Map<String, Boolean> linkedChannels = new HashMap<String, Boolean>();
|
||||
private Map<String, Boolean> linkedChannels = new HashMap<>();
|
||||
|
||||
public HaasSohnpelletstoveHandler(Thing thing) {
|
||||
super(thing);
|
||||
@ -251,7 +251,7 @@ public class HaasSohnpelletstoveHandler extends BaseThingHandler {
|
||||
if (data != null) {
|
||||
switch (channelId) {
|
||||
case CHANNELISTEMP:
|
||||
state = new QuantityType<Temperature>(Double.valueOf(data.getisTemp()), SIUnits.CELSIUS);
|
||||
state = new QuantityType<>(Double.valueOf(data.getisTemp()), SIUnits.CELSIUS);
|
||||
update(state, channelId);
|
||||
break;
|
||||
case CHANNELMODE:
|
||||
@ -265,7 +265,7 @@ public class HaasSohnpelletstoveHandler extends BaseThingHandler {
|
||||
update(OnOffType.from(data.getEcoMode()), channelId);
|
||||
break;
|
||||
case CHANNELSPTEMP:
|
||||
state = new QuantityType<Temperature>(Double.valueOf(data.getspTemp()), SIUnits.CELSIUS);
|
||||
state = new QuantityType<>(Double.valueOf(data.getspTemp()), SIUnits.CELSIUS);
|
||||
update(state, channelId);
|
||||
break;
|
||||
case CHANNELCLEANINGIN:
|
||||
|
@ -174,7 +174,7 @@ public class HDPowerViewHubHandler extends BaseBridgeHandler {
|
||||
|
||||
private void initializeChannels() {
|
||||
// Rebuild dynamic channels and synchronize with cache.
|
||||
updateThing(editThing().withChannels(new ArrayList<Channel>()).build());
|
||||
updateThing(editThing().withChannels(new ArrayList<>()).build());
|
||||
sceneCache.clear();
|
||||
sceneCollectionCache.clear();
|
||||
scheduledEventCache.clear();
|
||||
@ -465,7 +465,7 @@ public class HDPowerViewHubHandler extends BaseBridgeHandler {
|
||||
}
|
||||
|
||||
logger.debug("Updating all scene channels, changes detected");
|
||||
sceneCache = new CopyOnWriteArrayList<Scene>(scenes);
|
||||
sceneCache = new CopyOnWriteArrayList<>(scenes);
|
||||
|
||||
List<Channel> allChannels = new ArrayList<>(getThing().getChannels());
|
||||
allChannels.removeIf(c -> HDPowerViewBindingConstants.CHANNEL_GROUP_SCENES.equals(c.getUID().getGroupId()));
|
||||
@ -504,7 +504,7 @@ public class HDPowerViewHubHandler extends BaseBridgeHandler {
|
||||
}
|
||||
|
||||
logger.debug("Updating all scene group channels, changes detected");
|
||||
sceneCollectionCache = new CopyOnWriteArrayList<SceneCollection>(sceneCollections);
|
||||
sceneCollectionCache = new CopyOnWriteArrayList<>(sceneCollections);
|
||||
|
||||
List<Channel> allChannels = new ArrayList<>(getThing().getChannels());
|
||||
allChannels
|
||||
@ -543,7 +543,7 @@ public class HDPowerViewHubHandler extends BaseBridgeHandler {
|
||||
}
|
||||
|
||||
logger.debug("Updating all automation channels, changes detected");
|
||||
scheduledEventCache = new CopyOnWriteArrayList<ScheduledEvent>(scheduledEvents);
|
||||
scheduledEventCache = new CopyOnWriteArrayList<>(scheduledEvents);
|
||||
|
||||
List<Channel> allChannels = new ArrayList<>(getThing().getChannels());
|
||||
allChannels
|
||||
|
@ -190,7 +190,7 @@ public class Generation3DtoTest {
|
||||
ThingTypeUID thingTypeUID = new ThingTypeUID("hdpowerview:shade");
|
||||
ThingUID thingUID = new ThingUID(thingTypeUID, "test");
|
||||
|
||||
List<Channel> channels = new ArrayList<Channel>();
|
||||
List<Channel> channels = new ArrayList<>();
|
||||
for (String channelId : Set.of(CHANNEL_SHADE_POSITION, CHANNEL_SHADE_SECONDARY_POSITION, CHANNEL_SHADE_VANE,
|
||||
CHANNEL_SHADE_BATTERY_LEVEL, CHANNEL_SHADE_LOW_BATTERY, CHANNEL_SHADE_SIGNAL_STRENGTH)) {
|
||||
ChannelUID channelUID = new ChannelUID(thingUID, channelId);
|
||||
@ -247,7 +247,7 @@ public class Generation3DtoTest {
|
||||
ThingTypeUID thingTypeUID = new ThingTypeUID("hdpowerview:shade");
|
||||
ThingUID thingUID = new ThingUID(thingTypeUID, "test");
|
||||
|
||||
List<Channel> channels = new ArrayList<Channel>();
|
||||
List<Channel> channels = new ArrayList<>();
|
||||
for (String channelId : Set.of(CHANNEL_SHADE_POSITION, CHANNEL_SHADE_SECONDARY_POSITION, CHANNEL_SHADE_VANE,
|
||||
CHANNEL_SHADE_BATTERY_LEVEL, CHANNEL_SHADE_LOW_BATTERY, CHANNEL_SHADE_SIGNAL_STRENGTH)) {
|
||||
ChannelUID channelUID = new ChannelUID(thingUID, channelId);
|
||||
|
@ -56,7 +56,7 @@ public class HeliosVentilationBindingConstants {
|
||||
*
|
||||
*/
|
||||
private static Map<Byte, HeliosVentilationDataPoint> readChannelProperties() {
|
||||
HashMap<Byte, HeliosVentilationDataPoint> result = new HashMap<Byte, HeliosVentilationDataPoint>();
|
||||
HashMap<Byte, HeliosVentilationDataPoint> result = new HashMap<>();
|
||||
|
||||
URL resource = Thread.currentThread().getContextClassLoader().getResource(DATAPOINT_FILE);
|
||||
Properties properties = new Properties();
|
||||
|
@ -66,7 +66,7 @@ public class HeliosVentilationHandler extends BaseThingHandler implements Serial
|
||||
/**
|
||||
* store received data for read-modify-write operations on bitlevel
|
||||
*/
|
||||
private final Map<Byte, Byte> memory = new HashMap<Byte, Byte>();
|
||||
private final Map<Byte, Byte> memory = new HashMap<>();
|
||||
|
||||
private final SerialPortManager serialPortManager;
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class BinRpcNetworkService implements Runnable {
|
||||
serverSocket.setReuseAddress(true);
|
||||
serverSocket.bind(new InetSocketAddress(config.getBinCallbackPort()));
|
||||
|
||||
this.rpcResponseHandler = new RpcResponseHandler<byte[]>(listener) {
|
||||
this.rpcResponseHandler = new RpcResponseHandler<>(listener) {
|
||||
|
||||
@Override
|
||||
protected byte[] getEmptyStringResult() {
|
||||
|
@ -51,7 +51,7 @@ public class XmlRpcServer implements RpcServer {
|
||||
|
||||
public XmlRpcServer(RpcEventListener listener, HomematicConfig config) {
|
||||
this.config = config;
|
||||
this.rpcResponseHander = new RpcResponseHandler<String>(listener) {
|
||||
this.rpcResponseHander = new RpcResponseHandler<>(listener) {
|
||||
|
||||
@Override
|
||||
protected String getEmptyStringResult() {
|
||||
|
@ -67,7 +67,7 @@ public class RpcClientMockImpl extends RpcClient<String> {
|
||||
|
||||
@Override
|
||||
protected RpcRequest<String> createRpcRequest(String methodName) {
|
||||
return new RpcRequest<String>() {
|
||||
return new RpcRequest<>() {
|
||||
|
||||
@Override
|
||||
public void addArg(Object arg) {
|
||||
|
@ -86,7 +86,7 @@ public class Scene {
|
||||
*/
|
||||
public List<String> getLightIds() {
|
||||
List<String> lightIds = this.lightIds;
|
||||
return lightIds != null ? lightIds : new ArrayList<String>();
|
||||
return lightIds != null ? lightIds : new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -122,7 +122,7 @@ public class Clip2Bridge implements Closeable {
|
||||
* <li>onHeaders() HTTP unauthorized codes</li>
|
||||
*/
|
||||
private abstract class BaseStreamListenerAdapter<T> extends Stream.Listener.Adapter {
|
||||
protected final CompletableFuture<T> completable = new CompletableFuture<T>();
|
||||
protected final CompletableFuture<T> completable = new CompletableFuture<>();
|
||||
private String contentType = "UNDEFINED";
|
||||
private int status;
|
||||
|
||||
|
@ -22,9 +22,9 @@ import java.util.List;
|
||||
*/
|
||||
public class LocalScheduleResponse extends Response {
|
||||
|
||||
public List<Running> running = new LinkedList<Running>();
|
||||
public List<Running> running = new LinkedList<>();
|
||||
|
||||
public List<Relay> relays = new LinkedList<Relay>();
|
||||
public List<Relay> relays = new LinkedList<>();
|
||||
|
||||
public String name;
|
||||
|
||||
|
@ -30,7 +30,7 @@ public class StatusScheduleResponse extends LocalScheduleResponse {
|
||||
|
||||
public Integer nextpoll;
|
||||
|
||||
public List<Sensor> sensors = new LinkedList<Sensor>();
|
||||
public List<Sensor> sensors = new LinkedList<>();
|
||||
|
||||
public String message;
|
||||
|
||||
@ -52,7 +52,7 @@ public class StatusScheduleResponse extends LocalScheduleResponse {
|
||||
|
||||
public String lastContact;
|
||||
|
||||
public List<Forecast> forecast = new LinkedList<Forecast>();
|
||||
public List<Forecast> forecast = new LinkedList<>();
|
||||
|
||||
public String status;
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class HydrawiseAccountHandler extends BaseBridgeHandler implements Access
|
||||
private static final String CLIENT_ID = "hydrawise_app";
|
||||
private static final String SCOPE = "all";
|
||||
private final List<HydrawiseControllerListener> controllerListeners = Collections
|
||||
.synchronizedList(new ArrayList<HydrawiseControllerListener>());
|
||||
.synchronizedList(new ArrayList<>());
|
||||
private final HttpClient httpClient;
|
||||
private final OAuthFactory oAuthFactory;
|
||||
private @Nullable OAuthClientService oAuthService;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user