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(),
@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());
/** 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());
/**
* 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) {
}
public void activate() {
- activate(new Hashtable<String, Object>());
+ activate(new Hashtable<>());
}
@Override
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);
}
}
}
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);
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);
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);
}
}
// 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) {
/**
* Set of zones belonging to a group
**/
- private Set<Integer> zones = new LinkedHashSet<Integer>();
+ private Set<Integer> zones = new LinkedHashSet<>();
@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;
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);
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();
// 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",
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;
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;
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;
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()));
public AwattarNonConsecutiveBestPriceResult(int size, ZoneId zoneId) {
super();
this.zoneId = zoneId;
- members = new ArrayList<AwattarPrice>();
+ members = new ArrayList<>();
}
public void addMember(AwattarPrice member) {
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());
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(
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;
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());
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;
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());
}
}
- 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);
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);
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);
@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
@Override
public Map<@NonNull String, @NonNull String> getProperties() {
- return new HashMap<String, String>();
+ return new HashMap<>();
}
@Override
@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));
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");
}
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);
}
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 {
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 {
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;
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());
* 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
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);
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);
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;
* @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));
}
/**
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;
}
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));
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
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));
}
}
@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
if (command != null) {
command.run();
}
- return new NullScheduledFuture<Object>();
+ return new NullScheduledFuture<>();
}
@Override
if (command != null) {
command.run();
}
- return new NullScheduledFuture<Object>();
+ return new NullScheduledFuture<>();
}
}
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
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));
}
}
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;
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
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;
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),
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),
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;
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
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));
}
}
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);
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);
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
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;
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:
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;
}
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);
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";
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<>());
}
}
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,
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;
* 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) {
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;
if (count == -1) {
return UnDefType.NULL;
} else {
- return new QuantityType<Dimensionless>(count, Units.ONE);
+ return new QuantityType<>(count, Units.ONE);
}
}
}
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));
* 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) {
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) {
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;
|| !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())));
public EGateHandler(Bridge thing) {
super(thing);
- registeredBlinds = new HashMap<String, ThingUID>();
+ registeredBlinds = new HashMap<>();
}
@Override
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) {
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;
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 {
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;
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 {
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();
}
* @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);
*/
@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) {
*/
@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) {
*/
@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) {
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";
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);
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);
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);
}
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);
}
@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);
}
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);
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();
*/
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;
// 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) {
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);
* @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);
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"));
}
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;
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:
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)) {
* @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);
}
/**
if (tariffs == null) {
throw new IllegalStateException("Tariffs not initialized");
}
- return new HashMap<Instant, BigDecimal>(tariffs);
+ return new HashMap<>(tariffs);
}
/**
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());
*/
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());
}
/**
* @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(",")));
}
/**
// 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() {
}),
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() {
@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;
-
- {
- 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);
- }
- });
+ 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);
+ }
+ });
public GenericEEP() {
super();
*/
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;
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));
}
}
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);
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) {
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);
});
}
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);
}
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);
}
}
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);
return "";
}
- List<String> sortedHeaders = new ArrayList<String>();
+ List<String> sortedHeaders = new ArrayList<>();
sortedHeaders.addAll(headers.keySet());
Collections.sort(sortedHeaders, String.CASE_INSENSITIVE_ORDER);
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()) {
}
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);
}
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;
}
}
@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);
.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;
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;
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);
});
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);
});
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);
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) {
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) {
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);
}
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);
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:
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:
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();
}
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()));
}
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
}
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
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);
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);
*
*/
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();
/**
* 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;
serverSocket.setReuseAddress(true);
serverSocket.bind(new InetSocketAddress(config.getBinCallbackPort()));
- this.rpcResponseHandler = new RpcResponseHandler<byte[]>(listener) {
+ this.rpcResponseHandler = new RpcResponseHandler<>(listener) {
@Override
protected byte[] getEmptyStringResult() {
public XmlRpcServer(RpcEventListener listener, HomematicConfig config) {
this.config = config;
- this.rpcResponseHander = new RpcResponseHandler<String>(listener) {
+ this.rpcResponseHander = new RpcResponseHandler<>(listener) {
@Override
protected String getEmptyStringResult() {
@Override
protected RpcRequest<String> createRpcRequest(String methodName) {
- return new RpcRequest<String>() {
+ return new RpcRequest<>() {
@Override
public void addArg(Object arg) {
*/
public List<String> getLightIds() {
List<String> lightIds = this.lightIds;
- return lightIds != null ? lightIds : new ArrayList<String>();
+ return lightIds != null ? lightIds : new ArrayList<>();
}
/**
* <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;
*/
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;
public Integer nextpoll;
- public List<Sensor> sensors = new LinkedList<Sensor>();
+ public List<Sensor> sensors = new LinkedList<>();
public String message;
public String lastContact;
- public List<Forecast> forecast = new LinkedList<Forecast>();
+ public List<Forecast> forecast = new LinkedList<>();
public String status;
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;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
-import javax.measure.quantity.Speed;
-import javax.measure.quantity.Temperature;
import javax.measure.quantity.Volume;
import org.eclipse.jdt.annotation.NonNullByDefault;
}
private void updateZones(List<Zone> zones) {
- AtomicReference<Boolean> anyRunning = new AtomicReference<Boolean>(false);
- AtomicReference<Boolean> anySuspended = new AtomicReference<Boolean>(false);
+ AtomicReference<Boolean> anyRunning = new AtomicReference<>(false);
+ AtomicReference<Boolean> anySuspended = new AtomicReference<>(false);
for (Zone zone : zones) {
// there are 12 relays per expander, expanders will have a zoneNumber like:
// 10 for expander 0, relay 10 = zone10
private void updateTemperature(UnitValue temperature, String group, String channel) {
logger.debug("TEMP {} {} {} {}", group, channel, temperature.unit, temperature.value);
- updateGroupState(group, channel, new QuantityType<Temperature>(temperature.value,
+ updateGroupState(group, channel, new QuantityType<>(temperature.value,
"\\u00b0F".equals(temperature.unit) ? ImperialUnits.FAHRENHEIT : SIUnits.CELSIUS));
}
private void updateWindspeed(UnitValue wind, String group, String channel) {
- updateGroupState(group, channel, new QuantityType<Speed>(wind.value,
+ updateGroupState(group, channel, new QuantityType<>(wind.value,
"mph".equals(wind.unit) ? ImperialUnits.MILES_PER_HOUR : SIUnits.KILOMETRE_PER_HOUR));
}
@Override
public @Nullable Event getNextEvent(Instant instant) {
- final Collection<VEventWPeriod> candidates = new ArrayList<VEventWPeriod>();
- final Collection<VEvent> negativeEvents = new ArrayList<VEvent>();
- final Collection<VEvent> positiveEvents = new ArrayList<VEvent>();
+ final Collection<VEventWPeriod> candidates = new ArrayList<>();
+ final Collection<VEvent> negativeEvents = new ArrayList<>();
+ final Collection<VEvent> positiveEvents = new ArrayList<>();
classifyEvents(positiveEvents, negativeEvents);
for (final VEvent currentEvent : positiveEvents) {
final DateIterator startDates = this.getRecurredEventDateIterator(currentEvent);
* @return A VEventWPeriod describing the event or null if there is none.
*/
private @Nullable VEventWPeriod getCurrentComponentWPeriod(Instant instant) {
- final List<VEvent> negativeEvents = new ArrayList<VEvent>();
- final List<VEvent> positiveEvents = new ArrayList<VEvent>();
+ final List<VEvent> negativeEvents = new ArrayList<>();
+ final List<VEvent> positiveEvents = new ArrayList<>();
classifyEvents(positiveEvents, negativeEvents);
VEventWPeriod earliestEndingEvent = null;
*/
@NonNullByDefault
public class Event implements Comparable<Event> {
- public final List<CommandTag> commandTags = new ArrayList<CommandTag>();
+ public final List<CommandTag> commandTags = new ArrayList<>();
public final Instant end;
public final Instant start;
public final String title;
File jsonStorageFile = new File(System.getProperty("user.home"), "openhab.json");
logger.info(jsonStorageFile.toString());
- JsonStorage<String> stateStorage = new JsonStorage<String>(jsonStorageFile, TestICloud.class.getClassLoader(),
- 0, 1000, 1000, List.of());
+ JsonStorage<String> stateStorage = new JsonStorage<>(jsonStorageFile, TestICloud.class.getClassLoader(), 0,
+ 1000, 1000, List.of());
ICloudService service = new ICloudService(iCloudTestEmail, iCloudTestPassword, stateStorage);
service.authenticate(false);
@Override
public List<ChannelBuilder> createChannelBuilders(ChannelGroupUID channelGroupUID,
ChannelGroupTypeUID channelGroupTypeUID) {
- return new ArrayList<ChannelBuilder>(); // dummy implementation, probably won't work.
+ return new ArrayList<>(); // dummy implementation, probably won't work.
}
@Override
private String toGroupString(List<Byte> group) {
List<Byte> sorted = new ArrayList<>(group);
- Collections.sort(sorted, new Comparator<Byte>() {
+ Collections.sort(sorted, new Comparator<>() {
@Override
public int compare(Byte b1, Byte b2) {
int i1 = b1 & 0xFF;
private boolean hasModemDBEntry = false;
private DeviceStatus status = DeviceStatus.INITIALIZED;
private Map<Integer, GroupMessageStateMachine> groupState = new HashMap<>();
- private Map<String, Object> deviceConfigMap = new HashMap<String, Object>();
+ private Map<String, Object> deviceConfigMap = new HashMap<>();
/**
* Constructor
public String toString() {
String s = (direction == Direction.TO_MODEM) ? "OUT:" : "IN:";
// need to first sort the fields by offset
- Comparator<Field> cmp = new Comparator<Field>() {
+ Comparator<Field> cmp = new Comparator<>() {
@Override
public int compare(Field f1, Field f2) {
return f1.getOffset() - f2.getOffset();
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
-import javax.measure.quantity.Temperature;
-
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.intesis.internal.IntesisDynamicStateDescriptionProvider;
value = "0";
}
updateState(CHANNEL_TYPE_TARGETTEMP,
- new QuantityType<Temperature>(Double.valueOf(value) / 10.0d, SIUnits.CELSIUS));
+ new QuantityType<>(Double.valueOf(value) / 10.0d, SIUnits.CELSIUS));
break;
case "AMBTEMP":
if (Double.valueOf(value).isNaN()) {
value = "0";
}
updateState(CHANNEL_TYPE_AMBIENTTEMP,
- new QuantityType<Temperature>(Double.valueOf(value) / 10.0d, SIUnits.CELSIUS));
+ new QuantityType<>(Double.valueOf(value) / 10.0d, SIUnits.CELSIUS));
break;
case "MODE":
updateState(CHANNEL_TYPE_MODE, new StringType(value));
// If a camera does not need to poll a request as often as snapshots, it can be
// added here. Binding steps through the list.
public ArrayList<String> getLowPriorityRequests() {
- return new ArrayList<String>(1);
+ return new ArrayList<>(1);
}
}
// If a camera does not need to poll a request as often as snapshots, it can be
// added here. Binding steps through the list.
public ArrayList<String> getLowPriorityRequests() {
- return new ArrayList<String>(1);
+ return new ArrayList<>(1);
}
}
private @Nullable Process process = null;
private String ffmpegCommand = "";
private FFmpegFormat format;
- private List<String> commandArrayList = new ArrayList<String>();
+ private List<String> commandArrayList = new ArrayList<>();
private IpCameraFfmpegThread ipCameraFfmpegThread = new IpCameraFfmpegThread();
private int keepAlive = 8;
private String password;
// If a camera does not need to poll a request as often as snapshots, it can be
// added here. Binding steps through the list and sends 1 every 8 seconds.
public ArrayList<String> getLowPriorityRequests() {
- return new ArrayList<String>(0);
+ return new ArrayList<>(0);
}
}
// If a camera does not need to poll a request as often as snapshots, it can be
// added here. Binding steps through the list.
public ArrayList<String> getLowPriorityRequests() {
- ArrayList<String> lowPriorityRequests = new ArrayList<String>(7);
+ ArrayList<String> lowPriorityRequests = new ArrayList<>(7);
lowPriorityRequests.add("/param.cgi?cmd=getaudioalarmattr");
lowPriorityRequests.add("/cgi-bin/hi3510/param.cgi?cmd=getmdattr");
if (ipCameraHandler.newInstarApi) {// old API cameras get a error 404 response to this
public static final String REOLINK_THING = "reolink";
public static final ThingTypeUID THING_TYPE_REOLINK = new ThingTypeUID(BINDING_ID, REOLINK_THING);
- public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = new HashSet<ThingTypeUID>(
+ public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = new HashSet<>(
Arrays.asList(THING_TYPE_ONVIF, THING_TYPE_GENERIC, THING_TYPE_AMCREST, THING_TYPE_DAHUA, THING_TYPE_INSTAR,
THING_TYPE_FOSCAM, THING_TYPE_DOORBIRD, THING_TYPE_HIKVISION, THING_TYPE_REOLINK));
- public static final Set<ThingTypeUID> GROUP_SUPPORTED_THING_TYPES = new HashSet<ThingTypeUID>(
- Arrays.asList(THING_TYPE_GROUP));
+ public static final Set<ThingTypeUID> GROUP_SUPPORTED_THING_TYPES = new HashSet<>(Arrays.asList(THING_TYPE_GROUP));
// List of all Thing Config items
public static final String CONFIG_IPADDRESS = "ipAddress";
private final HttpService httpService;
public GroupConfig groupConfig;
private BigDecimal pollTimeInSeconds = new BigDecimal(2);
- public ArrayList<IpCameraHandler> cameraOrder = new ArrayList<IpCameraHandler>(2);
+ public ArrayList<IpCameraHandler> cameraOrder = new ArrayList<>(2);
private final ScheduledExecutorService pollCameraGroup = Executors.newSingleThreadScheduledExecutor();
private @Nullable ScheduledFuture<?> pollCameraGroupJob = null;
private @Nullable GroupServlet servlet;
private String mp4Filename = "ipcamera";
private int mp4RecordTime;
private int gifRecordTime = 5;
- private LinkedList<byte[]> fifoSnapshotBuffer = new LinkedList<byte[]>();
+ private LinkedList<byte[]> fifoSnapshotBuffer = new LinkedList<>();
private int snapCount;
private boolean updateImageChannel = false;
private byte lowPriorityCounter = 0;
private IpCameraDiscoveryService ipCameraDiscoveryService;
private final Logger logger = LoggerFactory.getLogger(OnvifDiscovery.class);
private final NetworkAddressService networkAddressService;
- public ArrayList<DatagramPacket> listOfReplys = new ArrayList<DatagramPacket>(10);
+ public ArrayList<DatagramPacket> listOfReplys = new ArrayList<>(10);
public OnvifDiscovery(NetworkAddressService networkAddressService,
IpCameraDiscoveryService ipCameraDiscoveryService) {
*/
@NonNullByDefault
public class OpenStreams {
- private List<StreamOutput> openStreams = Collections.synchronizedList(new ArrayList<StreamOutput>());
+ private List<StreamOutput> openStreams = Collections.synchronizedList(new ArrayList<>());
public String boundary = "thisMjpegStream";
public synchronized void addStream(StreamOutput stream) {
private final String boundary;
private String contentType;
private final ServletOutputStream output;
- private BlockingQueue<byte[]> fifo = new ArrayBlockingQueue<byte[]>(50);
+ private BlockingQueue<byte[]> fifo = new ArrayBlockingQueue<>(50);
private boolean connected = false;
public boolean isSnapshotBased = false;
private final HttpClient httpClient;
private final IpObserverUpdateReceiver ipObserverUpdateReceiver;
private final Logger logger = LoggerFactory.getLogger(IpObserverHandler.class);
- private Map<String, ChannelHandler> channelHandlers = new HashMap<String, ChannelHandler>();
+ private Map<String, ChannelHandler> channelHandlers = new HashMap<>();
private @Nullable ScheduledFuture<?> pollingFuture = null;
private IpObserverConfiguration config = new IpObserverConfiguration();
private String idPass = "";
private Channel channel;
private String previousValue = "";
private Unit<?> unit;
- private final ArrayList<Class<? extends State>> acceptedDataTypes = new ArrayList<Class<? extends State>>();
+ private final ArrayList<Class<? extends State>> acceptedDataTypes = new ArrayList<>();
ChannelHandler(IpObserverHandler handler, Channel channel, Class<? extends State> acceptable, Unit<?> unit) {
super();
pmapId = mapId;
this.userPmapvId = userPmapvId;
- regions = new ArrayList<Region>();
+ regions = new ArrayList<>();
for (int i = 0; (i < pregions.length) && (i < types.length); i++) {
regions.add(new Region(pregions[i], types[i]));
}
public static final byte[] CONNECTION_HEADER = new byte[4];
private static final Logger LOGGER = LoggerFactory.getLogger(KnxNetFrame.class);
- private ArrayList<SetDatapointValueMessage> valueMessages = new ArrayList<SetDatapointValueMessage>();
+ private ArrayList<SetDatapointValueMessage> valueMessages = new ArrayList<>();
private byte mainService;
private byte subService = SubServiceType.SET_DATAPOINT_VALUE_REQUEST;
private int startDataPoint;
}
public KnxNetFrame() {
- this.valueMessages = new ArrayList<SetDatapointValueMessage>();
+ this.valueMessages = new ArrayList<>();
}
/**
}
private ArrayList<byte[]> getPackages(byte[] data) {
- ArrayList<byte[]> result = new ArrayList<byte[]>();
+ ArrayList<byte[]> result = new ArrayList<>();
if (data.length >= 0) {
ByteBuffer list = ByteBuffer.allocate(data.length);
list.put(data);
@Override
public ReadingPublisher<Ec3kReading> createPublisher() {
- ReadingPublisher<Ec3kReading> publisher = new ReadingPublisher<Ec3kReading>() {
+ ReadingPublisher<Ec3kReading> publisher = new ReadingPublisher<>() {
@Override
public void publish(Ec3kReading reading) {
if (reading != null && getThing().getStatus() == ThingStatus.ONLINE) {
BufferedSensorConfig cfg = getConfigAs(BufferedSensorConfig.class);
if (cfg.bufferSize > 1 && cfg.updateInterval > 0) {
- publisher = new RollingAveragePublisher<Ec3kReading>(cfg.bufferSize, cfg.updateInterval, publisher,
- scheduler) {
+ publisher = new RollingAveragePublisher<>(cfg.bufferSize, cfg.updateInterval, publisher, scheduler) {
@Override
public RollingReadingAverage<Ec3kReading> createRollingReadingAverage(int bufferSize) {
return new Ec3kRollingReadingAverage(bufferSize);
@Override
public ReadingPublisher<LaCrosseTemperatureReading> createPublisher() {
- return new ReadingPublisher<LaCrosseTemperatureReading>() {
+ return new ReadingPublisher<>() {
private final Map<Integer, ReadingPublisher<LaCrosseTemperatureReading>> channelPublishers = new HashMap<>();
@Override
}
public ReadingPublisher<LaCrosseTemperatureReading> createPublisherForChannel(int channelNo) {
- ReadingPublisher<LaCrosseTemperatureReading> publisher = new ReadingPublisher<LaCrosseTemperatureReading>() {
+ ReadingPublisher<LaCrosseTemperatureReading> publisher = new ReadingPublisher<>() {
@Override
public void publish(LaCrosseTemperatureReading reading) {
if (reading != null && getThing().getStatus() == ThingStatus.ONLINE) {
LaCrosseTemperatureSensorConfig cfg = getConfigAs(LaCrosseTemperatureSensorConfig.class);
if (cfg.bufferSize > 1 && cfg.updateInterval > 0) {
- publisher = new RollingAveragePublisher<LaCrosseTemperatureReading>(cfg.bufferSize, cfg.updateInterval,
- publisher, scheduler) {
+ publisher = new RollingAveragePublisher<>(cfg.bufferSize, cfg.updateInterval, publisher, scheduler) {
@Override
public RollingReadingAverage<LaCrosseTemperatureReading> createRollingReadingAverage(int bufferSize) {
return new LaCrosseRollingReadingAverage(bufferSize);
@Override
public ReadingPublisher<LgwReading> createPublisher() {
- return new ReadingPublisher<LgwReading>() {
+ return new ReadingPublisher<>() {
@Override
public void publish(LgwReading reading) {
if (reading != null && getThing().getStatus() == ThingStatus.ONLINE) {
@Override
public ReadingPublisher<Tx22Reading> createPublisher() {
- return new ReadingPublisher<Tx22Reading>() {
+ return new ReadingPublisher<>() {
@Override
public void publish(Tx22Reading reading) {
if (reading != null && getThing().getStatus() == ThingStatus.ONLINE) {
@Override
public ReadingPublisher<Pca301Reading> createPublisher() {
- return new ReadingPublisher<Pca301Reading>() {
+ return new ReadingPublisher<>() {
@Override
public void publish(Pca301Reading reading) {
if (reading != null) {
@Override
public ReadingPublisher<RevoltReading> createPublisher() {
- return new ReadingPublisher<RevoltReading>() {
+ return new ReadingPublisher<>() {
@Override
public void publish(RevoltReading reading) {
if (reading != null && getThing().getStatus() == ThingStatus.ONLINE) {
// make a list of all allowed metatdata channels,
// used to filter out what we don't want from the component
- public static final Set<String> METADATA_CHANNELS = new HashSet<String>(
- Arrays.asList(DETAIL_TITLE, DETAIL_ALBUM_TITLE, DETAIL_COVER_URL, DETAIL_HIRES_COVER_URL, DETAIL_RATING,
- DETAIL_YEAR, DETAIL_RUNNING_TIME, DETAIL_ACTORS, DETAIL_ARTIST, DETAIL_DIRECTORS, DETAIL_GENRES,
- DETAIL_RATING_REASON, DETAIL_SYNOPSIS, DETAIL_REVIEW, DETAIL_COLOR_DESCRIPTION, DETAIL_COUNTRY,
- DETAIL_ASPECT_RATIO, DETAIL_DISC_LOCATION));
+ public static final Set<String> METADATA_CHANNELS = new HashSet<>(Arrays.asList(DETAIL_TITLE, DETAIL_ALBUM_TITLE,
+ DETAIL_COVER_URL, DETAIL_HIRES_COVER_URL, DETAIL_RATING, DETAIL_YEAR, DETAIL_RUNNING_TIME, DETAIL_ACTORS,
+ DETAIL_ARTIST, DETAIL_DIRECTORS, DETAIL_GENRES, DETAIL_RATING_REASON, DETAIL_SYNOPSIS, DETAIL_REVIEW,
+ DETAIL_COLOR_DESCRIPTION, DETAIL_COUNTRY, DETAIL_ASPECT_RATIO, DETAIL_DISC_LOCATION));
public static final String STANDBY_MSG = "Device is in standby";
public static final String PROPERTY_COMPONENT_TYPE = "Component Type";
private static final String STRATO_S = "Strato S";
private static final String DISC_VAULT = "Disc Vault";
- private static final Set<String> ALLOWED_DEVICES = new HashSet<String>(
+ private static final Set<String> ALLOWED_DEVICES = new HashSet<>(
Arrays.asList(PLAYER, CINEMA_ONE, ALTO, STRATO, STRATO_S, DISC_VAULT));
@Nullable
*/
private boolean scanning;
- private Set<String> foundIPs = new HashSet<String>();
+ private Set<String> foundIPs = new HashSet<>();
@Activate
public KaleidescapeDiscoveryService() {
private final Logger logger = LoggerFactory.getLogger(KaleidescapeHandler.class);
private final SerialPortManager serialPortManager;
- private final Map<String, String> cache = new HashMap<String, String>();
+ private final Map<String, String> cache = new HashMap<>();
protected final HttpClient httpClient;
protected final Unit<Time> apiSecondUnit = Units.SECOND;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import javax.measure.quantity.Time;
-
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jetty.client.api.ContentResponse;
import org.openhab.binding.kaleidescape.internal.KaleidescapeBindingConstants;
handler.updateChannel(TITLE_NUM, new DecimalType(Integer.parseInt(matcher.group(3))));
handler.updateChannel(TITLE_LENGTH,
- new QuantityType<Time>(Integer.parseInt(matcher.group(4)), handler.apiSecondUnit));
+ new QuantityType<>(Integer.parseInt(matcher.group(4)), handler.apiSecondUnit));
handler.updateChannel(TITLE_LOC,
- new QuantityType<Time>(Integer.parseInt(matcher.group(5)), handler.apiSecondUnit));
+ new QuantityType<>(Integer.parseInt(matcher.group(5)), handler.apiSecondUnit));
handler.updateChannel(CHAPTER_NUM, new DecimalType(Integer.parseInt(matcher.group(6))));
handler.updateChannel(CHAPTER_LENGTH,
- new QuantityType<Time>(Integer.parseInt(matcher.group(7)), handler.apiSecondUnit));
+ new QuantityType<>(Integer.parseInt(matcher.group(7)), handler.apiSecondUnit));
handler.updateChannel(CHAPTER_LOC,
- new QuantityType<Time>(Integer.parseInt(matcher.group(8)), handler.apiSecondUnit));
+ new QuantityType<>(Integer.parseInt(matcher.group(8)), handler.apiSecondUnit));
} else {
logger.debug("PLAY_STATUS - no match on message: {}", message);
}
handler.updateChannel(MUSIC_PLAY_SPEED, new StringType(matcher.group(2)));
handler.updateChannel(MUSIC_TRACK_LENGTH,
- new QuantityType<Time>(Integer.parseInt(matcher.group(3)), handler.apiSecondUnit));
+ new QuantityType<>(Integer.parseInt(matcher.group(3)), handler.apiSecondUnit));
handler.updateChannel(MUSIC_TRACK_POSITION,
- new QuantityType<Time>(Integer.parseInt(matcher.group(4)), handler.apiSecondUnit));
+ new QuantityType<>(Integer.parseInt(matcher.group(4)), handler.apiSecondUnit));
handler.updateChannel(MUSIC_TRACK_PROGRESS,
new DecimalType(BigDecimal.valueOf(Math.round(Double.parseDouble(matcher.group(5))))));
}
// special case for running time to create a QuantityType<Time>
} else if (DETAIL_RUNNING_TIME.equals(metaType)) {
- handler.updateDetailChannel(DETAIL_RUNNING_TIME, new QuantityType<Time>(
+ handler.updateDetailChannel(DETAIL_RUNNING_TIME, new QuantityType<>(
Integer.parseInt(value) * handler.metaRuntimeMultiple, handler.apiSecondUnit));
// everything else just send it as a string
} else {
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
-import javax.measure.quantity.Dimensionless;
-import javax.measure.quantity.ElectricCurrent;
-import javax.measure.quantity.ElectricPotential;
-import javax.measure.quantity.Energy;
-import javax.measure.quantity.Power;
-import javax.measure.quantity.Time;
-
import org.openhab.binding.keba.internal.KebaBindingConstants.KebaSeries;
import org.openhab.binding.keba.internal.KebaBindingConstants.KebaType;
import org.openhab.core.cache.ExpiringCacheMap;
case "Curr HW": {
int state = entry.getValue().getAsInt();
maxSystemCurrent = state;
- State newState = new QuantityType<ElectricCurrent>(state / 1000.0, Units.AMPERE);
+ State newState = new QuantityType<>(state / 1000.0, Units.AMPERE);
updateState(CHANNEL_MAX_SYSTEM_CURRENT, newState);
if (maxSystemCurrent != 0) {
if (maxSystemCurrent < maxPresetCurrent) {
transceiver.send("curr " + maxSystemCurrent, this);
updateState(CHANNEL_MAX_PRESET_CURRENT,
- new QuantityType<ElectricCurrent>(maxSystemCurrent / 1000.0, Units.AMPERE));
- updateState(CHANNEL_MAX_PRESET_CURRENT_RANGE, new QuantityType<Dimensionless>(
+ new QuantityType<>(maxSystemCurrent / 1000.0, Units.AMPERE));
+ updateState(CHANNEL_MAX_PRESET_CURRENT_RANGE, new QuantityType<>(
(maxSystemCurrent - 6000) * 100 / (maxSystemCurrent - 6000), Units.PERCENT));
}
} else {
case "Curr user": {
int state = entry.getValue().getAsInt();
maxPresetCurrent = state;
- State newState = new QuantityType<ElectricCurrent>(state / 1000.0, Units.AMPERE);
+ State newState = new QuantityType<>(state / 1000.0, Units.AMPERE);
updateState(CHANNEL_MAX_PRESET_CURRENT, newState);
if (maxSystemCurrent != 0) {
- updateState(CHANNEL_MAX_PRESET_CURRENT_RANGE, new QuantityType<Dimensionless>(
+ updateState(CHANNEL_MAX_PRESET_CURRENT_RANGE, new QuantityType<>(
Math.min(100, (state - 6000) * 100 / (maxSystemCurrent - 6000)), Units.PERCENT));
}
break;
}
case "Curr FS": {
int state = entry.getValue().getAsInt();
- State newState = new QuantityType<ElectricCurrent>(state / 1000.0, Units.AMPERE);
+ State newState = new QuantityType<>(state / 1000.0, Units.AMPERE);
updateState(CHANNEL_FAILSAFE_CURRENT, newState);
break;
}
case "Max curr": {
int state = entry.getValue().getAsInt();
maxPresetCurrent = state;
- State newState = new QuantityType<ElectricCurrent>(state / 1000.0, Units.AMPERE);
+ State newState = new QuantityType<>(state / 1000.0, Units.AMPERE);
updateState(CHANNEL_PILOT_CURRENT, newState);
break;
}
case "Max curr %": {
int state = entry.getValue().getAsInt();
- State newState = new QuantityType<Dimensionless>(state / 10.0, Units.PERCENT);
+ State newState = new QuantityType<>(state / 10.0, Units.PERCENT);
updateState(CHANNEL_PILOT_PWM, newState);
break;
}
}
case "Sec": {
long state = entry.getValue().getAsLong();
- State newState = new QuantityType<Time>(state, Units.SECOND);
+ State newState = new QuantityType<>(state, Units.SECOND);
updateState(CHANNEL_UPTIME, newState);
break;
}
case "U1": {
int state = entry.getValue().getAsInt();
- State newState = new QuantityType<ElectricPotential>(state, Units.VOLT);
+ State newState = new QuantityType<>(state, Units.VOLT);
updateState(CHANNEL_U1, newState);
break;
}
case "U2": {
int state = entry.getValue().getAsInt();
- State newState = new QuantityType<ElectricPotential>(state, Units.VOLT);
+ State newState = new QuantityType<>(state, Units.VOLT);
updateState(CHANNEL_U2, newState);
break;
}
case "U3": {
int state = entry.getValue().getAsInt();
- State newState = new QuantityType<ElectricPotential>(state, Units.VOLT);
+ State newState = new QuantityType<>(state, Units.VOLT);
updateState(CHANNEL_U3, newState);
break;
}
case "I1": {
int state = entry.getValue().getAsInt();
- State newState = new QuantityType<ElectricCurrent>(state / 1000.0, Units.AMPERE);
+ State newState = new QuantityType<>(state / 1000.0, Units.AMPERE);
updateState(CHANNEL_I1, newState);
break;
}
case "I2": {
int state = entry.getValue().getAsInt();
- State newState = new QuantityType<ElectricCurrent>(state / 1000.0, Units.AMPERE);
+ State newState = new QuantityType<>(state / 1000.0, Units.AMPERE);
updateState(CHANNEL_I2, newState);
break;
}
case "I3": {
int state = entry.getValue().getAsInt();
- State newState = new QuantityType<ElectricCurrent>(state / 1000.0, Units.AMPERE);
+ State newState = new QuantityType<>(state / 1000.0, Units.AMPERE);
updateState(CHANNEL_I3, newState);
break;
}
case "P": {
long state = entry.getValue().getAsLong();
- State newState = new QuantityType<Power>(state / 1000.0, Units.WATT);
+ State newState = new QuantityType<>(state / 1000.0, Units.WATT);
updateState(CHANNEL_POWER, newState);
break;
}
case "PF": {
int state = entry.getValue().getAsInt();
- State newState = new QuantityType<Dimensionless>(state / 10.0, Units.PERCENT);
+ State newState = new QuantityType<>(state / 10.0, Units.PERCENT);
updateState(CHANNEL_POWER_FACTOR, newState);
break;
}
case "E pres": {
long state = entry.getValue().getAsLong();
- State newState = new QuantityType<Energy>(state / 10.0, Units.WATT_HOUR);
+ State newState = new QuantityType<>(state / 10.0, Units.WATT_HOUR);
updateState(CHANNEL_SESSION_CONSUMPTION, newState);
break;
}
case "E total": {
long state = entry.getValue().getAsLong();
- State newState = new QuantityType<Energy>(state / 10.0, Units.WATT_HOUR);
+ State newState = new QuantityType<>(state / 10.0, Units.WATT_HOUR);
updateState(CHANNEL_TOTAL_CONSUMPTION, newState);
break;
}
}
case "Setenergy": {
int state = entry.getValue().getAsInt();
- State newState = new QuantityType<Energy>(state / 10.0, Units.WATT_HOUR);
+ State newState = new QuantityType<>(state / 10.0, Units.WATT_HOUR);
updateState(CHANNEL_SETENERGY, newState);
break;
}
logger.trace("Checking for cEMI support");
try (FT12Connection serialConnection = new FT12Connection(serialPort)) {
- final CompletableFuture<byte[]> frameListener = new CompletableFuture<byte[]>();
+ final CompletableFuture<byte[]> frameListener = new CompletableFuture<>();
serialConnection.addConnectionListener(frameReceived -> {
final byte[] content = frameReceived.getFrameBytes();
if ((content.length > 0) && (content[0] == peiIdentifyCon)) {
public class DepartureResult {
@SerializedName(value = "departureList")
- public List<Departure> departures = new ArrayList<Departure>();
+ public List<Departure> departures = new ArrayList<>();
@Override
public String toString() {
*/
public Cache() {
this.updateInterval = KVVBindingConstants.CACHE_DEFAULT_UPDATEINTERVAL;
- this.cache = new HashMap<String, CacheLine>();
+ this.cache = new HashMap<>();
}
/*
logger.warn("maxTrains is '0', not creating any channels");
}
- final List<Channel> channels = new ArrayList<Channel>();
+ final List<Channel> channels = new ArrayList<>();
for (int i = 0; i < bridgeHandler.getBridgeConfig().maxTrains; i++) {
ChannelUID c = new ChannelUID(this.thing.getUID(), "train" + i + "-name");
channels.add(ChannelBuilder.create(c, "String").withType(nameType).build());
Invocation.Builder builder = resourceTarget.request(mediaType);
- MultivaluedMap<String, Object> newHeaders = new MultivaluedHashMap<String, Object>();
+ MultivaluedMap<String, Object> newHeaders = new MultivaluedHashMap<>();
for (Map.Entry<String, List<Object>> entry : request.getHeaders().entrySet()) {
if (HttpHeaders.AUTHORIZATION.equals(entry.getKey())) {
private static final String ENTITY_LOGGER_PROPERTY = LoggingFilter.class.getName() + ".entityLogger";
private static final String LOGGING_ID_PROPERTY = LoggingFilter.class.getName() + ".id";
- private static final Comparator<Map.Entry<String, List<String>>> COMPARATOR = new Comparator<Map.Entry<String, List<String>>>() {
+ private static final Comparator<Map.Entry<String, List<String>>> COMPARATOR = new Comparator<>() {
@Override
public int compare(final Map.Entry<String, List<String>> o1, final Map.Entry<String, List<String>> o2) {
}
private Set<Map.Entry<String, List<String>>> getSortedHeaders(final Set<Map.Entry<String, List<String>>> headers) {
- final TreeSet<Map.Entry<String, List<String>>> sortedHeaders = new TreeSet<Map.Entry<String, List<String>>>(
+ final TreeSet<Map.Entry<String, List<String>>> sortedHeaders = new TreeSet<>(
COMPARATOR);
sortedHeaders.addAll(headers);
return sortedHeaders;
return (name == null) ? UTF8 : Charset.forName(name);
}
-}
\ No newline at end of file
+}
*/
public class Icons {
private IconsMetadata meta;
- private List<Icon> data = new ArrayList<Icon>();
+ private List<Icon> data = new ArrayList<>();
public IconsMetadata getMeta() {
return meta;
private TypeAdapter<C> customizeMyClassAdapter(@Nullable Gson gson, TypeToken<C> type) {
final TypeAdapter<C> delegate = gson.getDelegateAdapter(this, type);
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
- return new TypeAdapter<C>() {
+ return new TypeAdapter<>() {
@Override
public void write(JsonWriter out, @Nullable C value) throws IOException {
JsonElement tree = delegate.toJsonTree(value);
public final class RuntimeTypeAdapterFactory<T> implements TypeAdapterFactory {
private final Class<?> baseType;
private final String typeFieldName;
- private final Map<String, Class<?>> labelToSubtype = new LinkedHashMap<String, Class<?>>();
- private final Map<Class<?>, String> subtypeToLabel = new LinkedHashMap<Class<?>, String>();
+ private final Map<String, Class<?>> labelToSubtype = new LinkedHashMap<>();
+ private final Map<Class<?>, String> subtypeToLabel = new LinkedHashMap<>();
private RuntimeTypeAdapterFactory(Class<?> baseType, String typeFieldName) {
if (typeFieldName == null || baseType == null) {
* typeFieldName} as the type field name. Type field names are case sensitive.
*/
public static <T> RuntimeTypeAdapterFactory<T> of(Class<T> baseType, String typeFieldName) {
- return new RuntimeTypeAdapterFactory<T>(baseType, typeFieldName);
+ return new RuntimeTypeAdapterFactory<>(baseType, typeFieldName);
}
/**
* the type field name.
*/
public static <T> RuntimeTypeAdapterFactory<T> of(Class<T> baseType) {
- return new RuntimeTypeAdapterFactory<T>(baseType, "type");
+ return new RuntimeTypeAdapterFactory<>(baseType, "type");
}
/**
return null;
}
- final Map<String, TypeAdapter<?>> labelToDelegate = new LinkedHashMap<String, TypeAdapter<?>>();
- final Map<Class<?>, TypeAdapter<?>> subtypeToDelegate = new LinkedHashMap<Class<?>, TypeAdapter<?>>();
+ final Map<String, TypeAdapter<?>> labelToDelegate = new LinkedHashMap<>();
+ final Map<Class<?>, TypeAdapter<?>> subtypeToDelegate = new LinkedHashMap<>();
for (Map.Entry<String, Class<?>> entry : labelToSubtype.entrySet()) {
TypeAdapter<?> delegate = gson.getDelegateAdapter(this, TypeToken.get(entry.getValue()));
labelToDelegate.put(entry.getKey(), delegate);
RuntimeTypeAdapterFactory.JSON_ELEMENT.write(writer, element);
}
- private static final TypeAdapter<JsonElement> JSON_ELEMENT = new TypeAdapter<JsonElement>() {
+ private static final TypeAdapter<JsonElement> JSON_ELEMENT = new TypeAdapter<>() {
@Override
public @Nullable JsonElement read(@Nullable JsonReader in) throws IOException {
switch (in.peek()) {
* @author Gregory Moyer - Initial contribution
*/
public class Failure {
- private List<Error> errors = new ArrayList<Error>();
+ private List<Error> errors = new ArrayList<>();
public List<Error> getErrors() {
return errors;
@SuppressWarnings("serial")
public void testSerialize() throws Exception {
// @formatter:off
- Action action = new Action().withParameters(new TreeMap<String, Parameter>(){{put("enabled", new BooleanParameter());
+ Action action = new Action().withParameters(new TreeMap<>(){{put("enabled", new BooleanParameter());
put("time", new StringParameter());}});
// @formatter:on
assertEquals(readJson("action.json"), gson.toJson(action));
Application app = new Application().withPackageName("com.lametric.radio").withVendor("LaMetric")
.withVersion("1.0.10").withVersionCode("22")
// @formatter:off
- .withWidgets(new TreeMap<String, Widget>(){{put("589ed1b3fcdaa5180bf4848e55ba8061", new Widget());}})
- .withActions(new TreeMap<String, Action>(){{put("radio.next", new Action());
+ .withWidgets(new TreeMap<>(){{put("589ed1b3fcdaa5180bf4848e55ba8061", new Widget());}})
+ .withActions(new TreeMap<>(){{put("radio.next", new Action());
put("radio.play", new Action());
put("radio.prev", new Action());
put("radio.stop", new Action());}});
public void testSerialize() throws Exception {
UpdateAction action = new UpdateAction().withId("countdown.configure")
// @formatter:off
- .withParameters(new TreeMap<String, Parameter>(){{put("duration", new IntegerParameter().withValue(30));}});
+ .withParameters(new TreeMap<>(){{put("duration", new IntegerParameter().withValue(30));}});
// @formatter:on
assertEquals(readJson("update-action.json"), gson.toJson(action));
}
@SuppressWarnings("serial")
public void testSerialize() throws Exception {
Widget widget = new Widget().withPackageName("com.lametric.radio").withIndex(Integer.valueOf(-1))
- .withSettings(new HashMap<String, JsonPrimitive>() {
+ .withSettings(new HashMap<>() {
{
put("_title", new JsonPrimitive("Radio"));
}
private final ResponseListener<T> defaultResponseListener = createResponseListener();
protected <Y> ResponseListener<Y> createResponseListener() {
- return new ResponseListener<Y>() {
+ return new ResponseListener<>() {
@Override
public void onError(String error) {
public void onDeviceReady(String channelId, LGWebOSHandler handler) {
super.onDeviceReady(channelId, handler);
- handler.getSocket().getAppList(new ResponseListener<List<AppInfo>>() {
+ handler.getSocket().getAppList(new ResponseListener<>() {
@Override
public void onError(String error) {
}
private ResponseListener<AppInfo> createResponseListener(String channelId, LGWebOSHandler handler) {
- return new ResponseListener<AppInfo>() {
+ return new ResponseListener<>() {
@Override
public void onError(@Nullable String error) {
@Override
public void onDeviceReady(String channelId, LGWebOSHandler handler) {
super.onDeviceReady(channelId, handler);
- handler.getSocket().getChannelList(new ResponseListener<List<ChannelInfo>>() {
+ handler.getSocket().getChannelList(new ResponseListener<>() {
@Override
public void onError(@Nullable String error) {
logger.warn("error requesting channel list: {}.", error);
}
private ResponseListener<ChannelInfo> createResponseListener(String channelId, LGWebOSHandler handler) {
- return new ResponseListener<ChannelInfo>() {
+ return new ResponseListener<>() {
@Override
public void onError(@Nullable String error) {
}
private ResponseListener<Boolean> createResponseListener(String channelId, LGWebOSHandler handler) {
- return new ResponseListener<Boolean>() {
+ return new ResponseListener<>() {
@Override
public void onError(@Nullable String error) {
}
private ResponseListener<Float> createResponseListener(String channelUID, LGWebOSHandler handler) {
- return new ResponseListener<Float>() {
+ return new ResponseListener<>() {
@Override
public void onError(@Nullable String error) {
}
private ResponseListener<TextInputStatusInfo> createTextInputStatusListener() {
- return new ResponseListener<TextInputStatusInfo>() {
+ return new ResponseListener<>() {
@Override
public void onError(@Nullable String error) {
}
private <O> ResponseListener<O> createResponseListener() {
- return new ResponseListener<O>() {
+ return new ResponseListener<>() {
@Override
public void onError(@Nullable String error) {
// it is irrelevant which service is queried. Only need to send some packets over the wire
- keepAliveJob = scheduler
- .scheduleWithFixedDelay(() -> getSocket().getRunningApp(new ResponseListener<AppInfo>() {
-
- @Override
- public void onSuccess(AppInfo responseObject) {
- // ignore - actual response is not relevant here
- }
-
- @Override
- public void onError(String message) {
- // ignore
- }
- }), keepAliveInterval, keepAliveInterval, TimeUnit.MILLISECONDS);
+ keepAliveJob = scheduler.scheduleWithFixedDelay(() -> getSocket().getRunningApp(new ResponseListener<>() {
+
+ @Override
+ public void onSuccess(AppInfo responseObject) {
+ // ignore - actual response is not relevant here
+ }
+
+ @Override
+ public void onError(String message) {
+ // ignore
+ }
+ }), keepAliveInterval, keepAliveInterval, TimeUnit.MILLISECONDS);
}
}
payload.addProperty("replace", 0);
}
- ResponseListener<JsonObject> responseListener = new ResponseListener<JsonObject>() {
+ ResponseListener<JsonObject> responseListener = new ResponseListener<>() {
@Override
public void onSuccess(JsonObject response) {
payload.addProperty("pairingType", "PROMPT"); // PIN, COMBINED
payload.add("manifest", manifest);
packet.add("payload", payload);
- ResponseListener<JsonObject> dummyListener = new ResponseListener<JsonObject>() {
+ ResponseListener<JsonObject> dummyListener = new ResponseListener<>() {
@Override
public void onSuccess(@Nullable JsonObject payload) {
public void powerOff(ResponseListener<CommandConfirmation> listener) {
String uri = "ssap://system/turnOff";
- ResponseListener<CommandConfirmation> interceptor = new ResponseListener<CommandConfirmation>() {
+ ResponseListener<CommandConfirmation> interceptor = new ResponseListener<>() {
@Override
public void onSuccess(CommandConfirmation confirmation) {
}
public ServiceSubscription<AppInfo> subscribeRunningApp(ResponseListener<AppInfo> listener) {
- ResponseListener<AppInfo> interceptor = new ResponseListener<AppInfo>() {
+ ResponseListener<AppInfo> interceptor = new ResponseListener<>() {
@Override
public void onSuccess(AppInfo appInfo) {
String uri = "ssap://com.webos.service.networkinput/getPointerInputSocket";
- ResponseListener<JsonObject> listener = new ResponseListener<JsonObject>() {
+ ResponseListener<JsonObject> listener = new ResponseListener<>() {
@Override
public void onSuccess(@Nullable JsonObject jsonObj) {
/*
* JSON deserialization routine, called during parsing configuration by the GSON library
*/
- public static final JsonDeserializer<LxControl> DESERIALIZER = new JsonDeserializer<LxControl>() {
+ public static final JsonDeserializer<LxControl> DESERIALIZER = new JsonDeserializer<>() {
@Override
public LxControl deserialize(JsonElement json, Type type, JsonDeserializationContext context)
throws JsonParseException {
private final String uuid;
private final String uuidOriginal;
- public static final JsonDeserializer<LxUuid> DESERIALIZER = new JsonDeserializer<LxUuid>() {
+ public static final JsonDeserializer<LxUuid> DESERIALIZER = new JsonDeserializer<>() {
@Override
public LxUuid deserialize(JsonElement json, Type type, JsonDeserializationContext context)
throws JsonParseException {
}
public List<DeviceNode> getDeviceNodes() {
- return deviceNodes != null ? deviceNodes : Collections.<DeviceNode> emptyList();
+ return deviceNodes != null ? deviceNodes : Collections.emptyList();
}
public List<Output> getOutputs() {
- return outputs != null ? outputs : Collections.<Output> emptyList();
+ return outputs != null ? outputs : Collections.emptyList();
}
public List<Area> getAreas() {
- return areas != null ? areas : Collections.<Area> emptyList();
+ return areas != null ? areas : Collections.emptyList();
}
}
}
public List<Component> getComponents() {
- return components != null ? components : Collections.<Component> emptyList();
+ return components != null ? components : Collections.emptyList();
}
}
}
public List<Device> getDevices() {
- return devices != null ? devices : Collections.<Device> emptyList();
+ return devices != null ? devices : Collections.emptyList();
}
}
}
public List<Area> getAreas() {
- return areas != null ? areas : Collections.<Area> emptyList();
+ return areas != null ? areas : Collections.emptyList();
}
public List<Timeclock> getTimeclocks() {
- return timeclocks != null ? timeclocks : Collections.<Timeclock> emptyList();
+ return timeclocks != null ? timeclocks : Collections.emptyList();
}
public List<GreenMode> getGreenModes() {
- return greenmodes != null ? greenmodes : Collections.<GreenMode> emptyList();
+ return greenmodes != null ? greenmodes : Collections.emptyList();
}
}
this.charBuffer.clear();
this.charBuffer.put(leftover);
- return lines == null ? Collections.<String> emptyList() : Arrays.asList(lines);
+ return lines == null ? Collections.emptyList() : Arrays.asList(lines);
}
}
private <T extends AbstractMessageBody> List<T> parseBodyMultiple(JsonObject messageBody, String memberName,
Class<T> type) {
- List<T> objList = new LinkedList<T>();
+ List<T> objList = new LinkedList<>();
try {
if (messageBody.has(memberName)) {
JsonArray jsonArray = messageBody.get(memberName).getAsJsonArray();
}
public static Map<String, Object> getProperties(Integer[] heatpumpValues) {
- Map<String, Object> properties = new HashMap<String, Object>();
+ Map<String, Object> properties = new HashMap<>();
String heatpumpType = HeatpumpType.fromCode(heatpumpValues[78]).getName();
public void registerDevice(String udn, String deviceId, String ipAddress, MagentaTVHandler handler) {
logger.trace("Register new device, UDN={}, deviceId={}, ipAddress={}", udn, deviceId, ipAddress);
- addNewDevice(udn, deviceId, ipAddress, "", new TreeMap<String, String>(), handler);
+ addNewDevice(udn, deviceId, ipAddress, "", new TreeMap<>(), handler);
}
private void addNewDevice(String udn, String deviceId, String ipAddress, String macAddress,
*/
public static class OauthCredentials {
public String epghttpsurl = "";
- public ArrayList<OauthKeyValue> sam3Para = new ArrayList<OauthKeyValue>();
+ public ArrayList<OauthKeyValue> sam3Para = new ArrayList<>();
}
public static class OauthCredentialsInstanceCreator implements InstanceCreator<OauthCredentials> {
}
public void updateThingProperties() {
- Map<String, String> properties = new HashMap<String, String>();
+ Map<String, String> properties = new HashMap<>();
properties.put(PROPERTY_FRIENDLYNAME, config.getFriendlyName());
properties.put(PROPERTY_MODEL_NUMBER, config.getModel());
properties.put(PROPERTY_DESC_URL, config.getDescriptionUrl());
"TURNAROUND", "HOMEEMERGENCY", "TOILETFLUSH", "DORSALPOSITION", "ABDOMINALPOSITION", "LYINGLEFT",
"LYINGRIGHT", "LYINGHALFLEFT", "LYINGHALFRIGHT", "MOVEMENT", "PRESENCE", "NUMBERPERSONS",
"BRIGHTNESSZONE" };
- private static ArrayList<String> sensorEventDefinition = new ArrayList<String>(
- Arrays.asList(EVENT_DEFINITION_ARRAY));
+ private static ArrayList<String> sensorEventDefinition = new ArrayList<>(Arrays.asList(EVENT_DEFINITION_ARRAY));
public static ArrayList<String> getSensorEventDefinition() {
return sensorEventDefinition;
import java.time.Instant;
import java.time.ZonedDateTime;
-import javax.measure.quantity.Temperature;
-
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.meater.internal.MeaterConfiguration;
Cook cook = meaterProbe.cook;
switch (channelId) {
case CHANNEL_INTERNAL_TEMPERATURE:
- return new QuantityType<Temperature>(meaterProbe.temperature.internal, SIUnits.CELSIUS);
+ return new QuantityType<>(meaterProbe.temperature.internal, SIUnits.CELSIUS);
case CHANNEL_AMBIENT_TEMPERATURE:
- return new QuantityType<Temperature>(meaterProbe.temperature.ambient, SIUnits.CELSIUS);
+ return new QuantityType<>(meaterProbe.temperature.ambient, SIUnits.CELSIUS);
case CHANNEL_COOK_TARGET_TEMPERATURE:
if (cook != null) {
- return new QuantityType<Temperature>(cook.temperature.target, SIUnits.CELSIUS);
+ return new QuantityType<>(cook.temperature.target, SIUnits.CELSIUS);
}
break;
case CHANNEL_COOK_PEAK_TEMPERATURE:
if (cook != null) {
- return new QuantityType<Temperature>(cook.temperature.peak, SIUnits.CELSIUS);
+ return new QuantityType<>(cook.temperature.peak, SIUnits.CELSIUS);
}
break;
case CHANNEL_COOK_ELAPSED_TIME:
private static final String INITIALIZE_COMMAND = "Initialze";
private final Logger logger = LoggerFactory.getLogger(VehicleHandler.class);
- private final Map<String, Long> timeHash = new HashMap<String, Long>();
+ private final Map<String, Long> timeHash = new HashMap<>();
private final MercedesMeCommandOptionProvider mmcop;
private final MercedesMeStateOptionProvider mmsop;
private final TimeZoneProvider timeZoneProvider;
}
}
} else if ("clear-cache".equals(channelUID.getIdWithoutGroup()) && command.equals(OnOffType.ON)) {
- List<String> removals = new ArrayList<String>();
+ List<String> removals = new ArrayList<>();
imageStorage.get().getKeys().forEach(entry -> {
if (entry.contains("_" + config.get().vin)) {
removals.add(entry);
return;
}
// add config parameters
- MultiMap<String> parameterMap = new MultiMap<String>();
+ MultiMap<String> parameterMap = new MultiMap<>();
parameterMap.add("background", Boolean.toString(config.get().background));
parameterMap.add("night", Boolean.toString(config.get().night));
parameterMap.add("cropped", Boolean.toString(config.get().cropped));
}
private void setImageOtions() {
- List<String> entries = new ArrayList<String>();
+ List<String> entries = new ArrayList<>();
if (imageStorage.get().containsKey(EXT_IMG_RES + config.get().vin)) {
String resources = imageStorage.get().get(EXT_IMG_RES + config.get().vin);
JSONObject jo = new JSONObject(resources);
});
}
Collections.sort(entries);
- List<CommandOption> commandOptions = new ArrayList<CommandOption>();
- List<StateOption> stateOptions = new ArrayList<StateOption>();
+ List<CommandOption> commandOptions = new ArrayList<>();
+ List<StateOption> stateOptions = new ArrayList<>();
entries.forEach(entry -> {
CommandOption co = new CommandOption(entry, null);
commandOptions.add(co);
@NonNullByDefault
public class CallbackServer {
private static final Logger LOGGER = LoggerFactory.getLogger(CallbackServer.class);
- private static final Map<Integer, OAuthClientService> AUTH_MAP = new HashMap<Integer, OAuthClientService>();
- private static final Map<Integer, CallbackServer> SERVER_MAP = new HashMap<Integer, CallbackServer>();
+ private static final Map<Integer, OAuthClientService> AUTH_MAP = new HashMap<>();
+ private static final Map<Integer, CallbackServer> SERVER_MAP = new HashMap<>();
private static final AccessTokenResponse INVALID_ACCESS_TOKEN = new AccessTokenResponse();
private final OAuthFactory oAuthFactory;
@NonNullByDefault
public class Utils {
private static final Logger LOGGER = LoggerFactory.getLogger(Utils.class);
- private static final List<Integer> PORTS = new ArrayList<Integer>();
+ private static final List<Integer> PORTS = new ArrayList<>();
private static int port = 8090;
/**
private static final Logger LOGGER = LoggerFactory.getLogger(Mapper.class);
public static final ChannelStateMap INVALID_MAP = new ChannelStateMap(EMPTY, EMPTY, UnDefType.UNDEF, -1);
- public static final Map<String, String[]> CHANNELS = new HashMap<String, String[]>();
+ public static final Map<String, String[]> CHANNELS = new HashMap<>();
public static final String TIMESTAMP = "timestamp";
public static final String VALUE = "value";
@Test
public void testConfig() {
Optional<VehicleConfiguration> config = Optional.of(new VehicleConfiguration());
- MultiMap<String> parameterMap = new MultiMap<String>();
+ MultiMap<String> parameterMap = new MultiMap<>();
parameterMap.add("background", Boolean.toString(config.get().background));
parameterMap.add("night", Boolean.toString(config.get().night));
parameterMap.add("cropped", Boolean.toString(config.get().cropped));
config.get().background = true;
config.get().format = "png";
config.get().cropped = true;
- parameterMap = new MultiMap<String>();
+ parameterMap = new MultiMap<>();
parameterMap.add("background", Boolean.toString(config.get().background));
parameterMap.add("night", Boolean.toString(config.get().night));
parameterMap.add("cropped", Boolean.toString(config.get().cropped));
@Test
void testOdoMapper() throws Exception {
- List<String> expectedResults = new ArrayList<String>();
+ List<String> expectedResults = new ArrayList<>();
expectedResults.add("range:mileage 4131 km");
String content = Files.readString(Path.of("src/test/resources/odo.json"));
JSONArray ja = new JSONArray(content);
@Test
void testEVMapper() throws IOException {
- List<String> expectedResults = new ArrayList<String>();
+ List<String> expectedResults = new ArrayList<>();
expectedResults.add("range:range-electric 325 km");
expectedResults.add("range:soc 78 %");
String content = Files.readString(Path.of("src/test/resources/evstatus.json"));
@Test
void testFuelMapper() throws IOException {
- List<String> expectedResults = new ArrayList<String>();
+ List<String> expectedResults = new ArrayList<>();
expectedResults.add("range:range-fuel 1292 km");
expectedResults.add("range:fuel-level 90 %");
String content = Files.readString(Path.of("src/test/resources/fuel.json"));
@Test
void testLockMapper() throws IOException {
- List<String> expectedResults = new ArrayList<String>();
+ List<String> expectedResults = new ArrayList<>();
expectedResults.add("lock:doors 0");
expectedResults.add("lock:deck-lid ON");
expectedResults.add("lock:flap ON");
@Test
void testStatusMapper() throws IOException {
- List<String> expectedResults = new ArrayList<String>();
+ List<String> expectedResults = new ArrayList<>();
expectedResults.add("doors:deck-lid CLOSED");
expectedResults.add("doors:driver-front CLOSED");
expectedResults.add("doors:passenger-front CLOSED");
@Test
void testEQALightsMapper() throws IOException {
// real life example
- List<String> expectedResults = new ArrayList<String>();
+ List<String> expectedResults = new ArrayList<>();
expectedResults.add("doors:passenger-front OPEN");
expectedResults.add("windows:driver-front 1");
expectedResults.add("windows:driver-rear 1");
@Test
void testMissingTimestamp() throws IOException {
- List<String> expectedResults = new ArrayList<String>();
+ List<String> expectedResults = new ArrayList<>();
expectedResults.add("range:mileage 4131 km");
String content = Files.readString(Path.of("src/test/resources/invalid-timestamp.json"));
JSONArray ja = new JSONArray(content);
private static final int SLIDING_SECONDS = 300;
private static final int MAX_FLUCTUATION_SECONDS = 180;
- private final Deque<Item> cache = new ConcurrentLinkedDeque<Item>();
+ private final Deque<Item> cache = new ConcurrentLinkedDeque<>();
private class Item {
public Instant start;
devices = mock(DeviceCollection.class);
when(getDevices().getDeviceIdentifiers())
- .thenReturn(new HashSet<String>(Arrays.asList(FIRST_DEVICE_IDENTIFIER, SECOND_DEVICE_IDENTIFIER)));
+ .thenReturn(new HashSet<>(Arrays.asList(FIRST_DEVICE_IDENTIFIER, SECOND_DEVICE_IDENTIFIER)));
when(getDevices().getDevice(FIRST_DEVICE_IDENTIFIER)).thenReturn(getFirstDevice());
when(getDevices().getDevice(SECOND_DEVICE_IDENTIFIER)).thenReturn(getSecondDevice());
}
Device deviceWithUnknownIdentifier = mockDevice(UNKNOWN_DEVICE_IDENTIFIER);
DeviceCollection devicesWithUnknownDevice = mock(DeviceCollection.class);
when(devicesWithUnknownDevice.getDeviceIdentifiers())
- .thenReturn(new HashSet<String>(Arrays.asList(UNKNOWN_DEVICE_IDENTIFIER)));
+ .thenReturn(new HashSet<>(Arrays.asList(UNKNOWN_DEVICE_IDENTIFIER)));
when(devicesWithUnknownDevice.getDevice(UNKNOWN_DEVICE_IDENTIFIER)).thenReturn(deviceWithUnknownIdentifier);
DeviceStateDispatcher dispatcher = new DeviceStateDispatcher();
Device deviceWithUnknownIdentifier = mockDevice(UNKNOWN_DEVICE_IDENTIFIER);
DeviceCollection devicesWithUnknownDevice = mock(DeviceCollection.class);
when(devicesWithUnknownDevice.getDeviceIdentifiers())
- .thenReturn(new HashSet<String>(Arrays.asList(UNKNOWN_DEVICE_IDENTIFIER)));
+ .thenReturn(new HashSet<>(Arrays.asList(UNKNOWN_DEVICE_IDENTIFIER)));
when(devicesWithUnknownDevice.getDevice(UNKNOWN_DEVICE_IDENTIFIER)).thenReturn(deviceWithUnknownIdentifier);
DeviceCollection emptyDevices = mock(DeviceCollection.class);
- when(emptyDevices.getDeviceIdentifiers()).thenReturn(new HashSet<String>());
+ when(emptyDevices.getDeviceIdentifiers()).thenReturn(new HashSet<>());
DeviceStateDispatcher dispatcher = new DeviceStateDispatcher();
dispatcher.dispatchDeviceStateUpdates(devicesWithUnknownDevice);
when(requestMock.param(anyString(), anyString())).thenReturn(requestMock);
when(requestMock.content(any())).thenAnswer(i -> {
StringContentProvider provider = i.getArgument(0);
- List<Byte> rawData = new ArrayList<Byte>();
+ List<Byte> rawData = new ArrayList<>();
provider.forEach(b -> {
b.rewind();
while (b.hasRemaining()) {
public void testCanControlLightReturnsFalseWhenNoLightOptionIsAvailable() {
// given:
Actions actions = mock(Actions.class);
- when(actions.getLight()).thenReturn(new LinkedList<Light>());
+ when(actions.getLight()).thenReturn(new LinkedList<>());
ActionsState actionState = new ActionsState(DEVICE_IDENTIFIER, actions);
assertEquals(false, remoteEnable.getSmartGrid().get());
assertEquals(Light.ENABLE, state.getLight());
- assertEquals(new ArrayList<Object>(), state.getElapsedTime().get());
+ assertEquals(new ArrayList<>(), state.getElapsedTime().get());
SpinningSpeed spinningSpeed = state.getSpinningSpeed().get();
assertEquals(Integer.valueOf(1200), spinningSpeed.getValueRaw().get());
assertEquals(false, remoteEnable.getSmartGrid().get());
assertEquals(Light.NOT_SUPPORTED, state.getLight());
- assertEquals(new ArrayList<Object>(), state.getElapsedTime().get());
+ assertEquals(new ArrayList<>(), state.getElapsedTime().get());
DryingStep dryingStep = state.getDryingStep().get();
assertFalse(dryingStep.getValueRaw().isPresent());
private ConcurrentHashMap<@NonNull String, @NonNull HomeListDTO> homeLists = new ConcurrentHashMap<>();
private static final Gson GSON = new GsonBuilder().serializeNulls().create();
- private ExpiringCache<Boolean> logonCache = new ExpiringCache<Boolean>(CACHE_EXPIRY, () -> {
+ private ExpiringCache<Boolean> logonCache = new ExpiringCache<>(CACHE_EXPIRY, () -> {
return logon();
});
- private ExpiringCache<String> refreshDeviceList = new ExpiringCache<String>(CACHE_EXPIRY, () -> {
+ private ExpiringCache<String> refreshDeviceList = new ExpiringCache<>(CACHE_EXPIRY, () -> {
if (deviceListState == CloudListState.FAILED && !isConnected()) {
return ("Could not connect to Xiaomi cloud");
}
return "done";// deviceList;
});
- private ExpiringCache<String> refreshHomeList = new ExpiringCache<String>(CACHE_EXPIRY, () -> {
+ private ExpiringCache<String> refreshHomeList = new ExpiringCache<>(CACHE_EXPIRY, () -> {
if (homeListState == CloudListState.FAILED && !isConnected()) {
return ("Could not connect to Xiaomi cloud");
}
if (signedNonce == null || signedNonce.length() == 0) {
throw new MiIoCryptoException("key is not nullable");
}
- List<String> exps = new ArrayList<String>();
+ List<String> exps = new ArrayList<>();
if (requestUrl != null) {
URI uri = URI.create(requestUrl);
exps.add(nonce);
if (params != null && !params.isEmpty()) {
- final TreeMap<String, String> sortedParams = new TreeMap<String, String>(params);
+ final TreeMap<String, String> sortedParams = new TreeMap<>(params);
Set<Map.Entry<String, String>> entries = sortedParams.entrySet();
for (Map.Entry<String, String> entry : entries) {
exps.add(String.format("%s=%s", entry.getKey(), entry.getValue()));
public String getMapUrl(String vacuumMap, String country) throws MiCloudException {
String url = getApiUrl(country) + "/home/getmapfileurl";
- Map<String, String> map = new HashMap<String, String>();
+ Map<String, String> map = new HashMap<>();
map.put("data", "{\"obj_name\":\"" + vacuumMap + "\"}");
String mapResponse = request(url, map);
logger.trace("Response: {}", mapResponse);
}
public String request(String urlPart, String country, String params) throws MiCloudException {
- Map<String, String> map = new HashMap<String, String>();
+ Map<String, String> map = new HashMap<>();
map.put("data", params);
return request(urlPart, country, map);
}
}
return null;
});
- map = new ExpiringCache<String>(CACHE_EXPIRY, () -> {
+ map = new ExpiringCache<>(CACHE_EXPIRY, () -> {
try {
int ret = sendCommand(MiIoCommand.GET_MAP);
if (ret != 0) {
*/
private void drawMap(Graphics2D g2d, float scale) {
Stroke stroke = new BasicStroke(1.1f * scale);
- Set<Integer> roomIds = new HashSet<Integer>();
+ Set<Integer> roomIds = new HashSet<>();
g2d.setStroke(stroke);
for (int y = 0; y < rmfp.getImgHeight() - 1; y++) {
for (int x = 0; x < rmfp.getImgWidth() + 1; x++) {
case PATH:
case GOTO_PATH:
case GOTO_PREDICTED_PATH:
- ArrayList<float[]> path = new ArrayList<float[]>();
- Map<String, Integer> detail = new HashMap<String, Integer>();
+ ArrayList<float[]> path = new ArrayList<>();
+ Map<String, Integer> detail = new HashMap<>();
int pairs = getUInt32LE(header, 0x04) / 4;
detail.put(PATH_POINT_LENGTH, getUInt32LE(header, 0x08));
detail.put(PATH_POINT_SIZE, getUInt32LE(header, 0x0C));
case MOB_FORBIDDEN_AREA:
case CARPET_FORBIDDEN_AREA:
int areaPairs = getUInt16(header, 0x08);
- ArrayList<float[]> area = new ArrayList<float[]>();
+ ArrayList<float[]> area = new ArrayList<>();
for (int areaPair = 0; areaPair < areaPairs; areaPair++) {
float x0 = (getUInt16(raw, blockDataStart + areaPair * 16));
float y0 = getUInt16(raw, blockDataStart + areaPair * 16 + 2);
StringBuilder sb = new StringBuilder();
StringBuilder commentSb = new StringBuilder("Adding support for the following models:\r\n");
Gson gson = new GsonBuilder().setPrettyPrinting().create();
- HashMap<String, String> names = new HashMap<String, String>();
+ HashMap<String, String> names = new HashMap<>();
try {
JsonReader reader = new JsonReader(new FileReader(DEVICE_NAMES_FILE));
names = gson.fromJson(reader, names.getClass());
private Logger logger = LoggerFactory.getLogger(MinecraftSocketHandler.class);
private BehaviorSubject<ServerData> serverRx = BehaviorSubject.create();
- private BehaviorSubject<List<SignData>> signsRx = BehaviorSubject.<List<SignData>> create();
- private BehaviorSubject<List<PlayerData>> playersRx = BehaviorSubject.<List<PlayerData>> create();
+ private BehaviorSubject<List<SignData>> signsRx = BehaviorSubject.create();
+ private BehaviorSubject<List<PlayerData>> playersRx = BehaviorSubject.create();
private Gson gson = new GsonBuilder().create();
public static Observable<ServerConnection> create(final ThingUID thingUID, final String host, final int port) {
final String serverUrl = String.format("ws://%s:%d/stream", host, port);
- return Observable.<ServerConnection> create(new OnSubscribe<ServerConnection>() {
+ return Observable.create(new OnSubscribe<>() {
private final Logger logger = LoggerFactory.getLogger(ServerConnection.class);
private ChannelUID string3VoltChannel;
private ChannelUID string3WattChannel;
- private final ArrayList<E3DCWallboxThingHandler> listeners = new ArrayList<E3DCWallboxThingHandler>();
+ private final ArrayList<E3DCWallboxThingHandler> listeners = new ArrayList<>();
private final Logger logger = LoggerFactory.getLogger(E3DCThingHandler.class);
private final Parser dataParser = new Parser(DataType.DATA);
private ReadStatus dataRead = ReadStatus.NOT_RECEIVED;
E3DCThingHandler handler = new E3DCThingHandler(bridge);
handler.setCallback(callback);
- HashMap<String, Object> map = new HashMap<String, Object>();
+ HashMap<String, Object> map = new HashMap<>();
map.put("refresh", 2000);
Configuration config = new Configuration(map);
when(bridge.getConfiguration()).thenReturn(config);
private AsyncModbusFailure<ModbusReadRequestBlueprint> getFailResult() {
ModbusReadRequestBlueprint readRequest = mock(ModbusReadRequestBlueprint.class);
- return new AsyncModbusFailure<ModbusReadRequestBlueprint>(readRequest, new Exception("Something failed!"));
+ return new AsyncModbusFailure<>(readRequest, new Exception("Something failed!"));
}
}
@RuleAction(label = "@text/action.getErrorMessages.label", description = "@text/action.getErrorMessages.description")
public @ActionOutput(name = "errorMessages", type = "java.util.List<String>") List<String> getErrorMessages() {
- return (handler != null) ? handler.getErrorMessages() : new ArrayList<String>();
+ return (handler != null) ? handler.getErrorMessages() : new ArrayList<>();
}
public static List<String> getErrorMessages(ThingActions actions) {
@RuleAction(label = "@text/action.getWarningMessages.label", description = "@text/action.getWarningMessages.description")
public @ActionOutput(name = "warningMessages", type = "java.util.List<String>") List<String> getWarningMessages() {
- return (handler != null) ? handler.getWarningMessages() : new ArrayList<String>();
+ return (handler != null) ? handler.getWarningMessages() : new ArrayList<>();
}
public static List<String> getWarningMessages(ThingActions actions) {
@RuleAction(label = "@text/action.getInfoMessages.label", description = "@text/action.getInfoMessages.description")
public @ActionOutput(name = "infoMessages", type = "java.util.List<String>") List<String> getInfoMessages() {
- return (handler != null) ? handler.getInfoMessages() : new ArrayList<String>();
+ return (handler != null) ? handler.getInfoMessages() : new ArrayList<>();
}
public static List<String> getInfoMessages(ThingActions actions) {
@RuleAction(label = "@text/action.getStatusMessages.label", description = "@text/action.getStatusMessages.description")
public @ActionOutput(name = "statusMessages", type = "java.util.List<String>") List<String> getStatusMessages() {
- return (handler != null) ? handler.getStatusMessages() : new ArrayList<String>();
+ return (handler != null) ? handler.getStatusMessages() : new ArrayList<>();
}
public static List<String> getStatusMessages(ThingActions actions) {
}
private List<String> getMessages(long bitMask, int bits, String prefix) {
- ArrayList<String> msg = new ArrayList<String>();
+ ArrayList<String> msg = new ArrayList<>();
long mask = 1;
for (int i = 0; i < bits; i++) {
if ((bitMask & mask) != 0) {
* @return an <code>List</code> of messages indicated by the status flags sent by the device
*/
protected List<String> getStatusMessages() {
- ArrayList<String> msg = new ArrayList<String>();
+ ArrayList<String> msg = new ArrayList<>();
if (this.statusFlags.length() == HeliosEasyControlsBindingConstants.BITS_STATUS_MSG) {
for (int i = 0; i < HeliosEasyControlsBindingConstants.BITS_STATUS_MSG; i++) {
String key = HeliosEasyControlsBindingConstants.PREFIX_STATUS_MSG + i + "."
/**
* Array of tasks used to poll the device
*/
- private ArrayList<PollTask> pollTasks = new ArrayList<PollTask>();
+ private ArrayList<PollTask> pollTasks = new ArrayList<>();
/**
* Communication interface to the slave endpoint we're connecting to
@Override
public Set<ThingTypeUID> getSupportedThingTypeUIDs() {
- return new HashSet<ThingTypeUID>(SUPPORTED_THING_TYPES_UIDS.values());
+ return new HashSet<>(SUPPORTED_THING_TYPES_UIDS.values());
}
@Override
parameterName);
}
} else if (parameterValue instanceof BigDecimal parameterBigDecimal) {
- result = Optional.of(new QuantityType<QU>(parameterBigDecimal.toString()));
+ result = Optional.of(new QuantityType<>(parameterBigDecimal.toString()));
} else {
logger.error("Parameter '{}' is not of type String or BigDecimal", parameterName);
return result;
public class MPDResponseParser {
static Map<String, String> responseToMap(MPDResponse response) {
- Map<String, String> map = new HashMap<String, String>();
+ Map<String, String> map = new HashMap<>();
for (String line : response.getLines()) {
int offset = line.indexOf(':');
public class FutureCollector {
public static <X> Collector<CompletableFuture<X>, Set<CompletableFuture<X>>, CompletableFuture<@Nullable Void>> allOf() {
- return Collector.<CompletableFuture<X>, Set<CompletableFuture<X>>, CompletableFuture<@Nullable Void>> of(
- (Supplier<Set<CompletableFuture<X>>>) HashSet::new, Set::add, (left, right) -> {
- left.addAll(right);
- return left;
- }, a -> CompletableFuture.allOf(a.toArray(new CompletableFuture[a.size()])),
+ return Collector.of((Supplier<Set<CompletableFuture<X>>>) HashSet::new, Set::add, (left, right) -> {
+ left.addAll(right);
+ return left;
+ }, a -> CompletableFuture.allOf(a.toArray(new CompletableFuture[a.size()])),
Collector.Characteristics.UNORDERED);
}
}
/* The delegate is the 'default' adapter */
final TypeAdapter<T> delegate = gson.getDelegateAdapter(this, type);
- return new TypeAdapter<T>() {
+ return new TypeAdapter<>() {
@Override
public @Nullable T read(JsonReader in) throws IOException {
/* read the object using the default adapter, but translate the names in the reader */
/* The delegate is the 'default' adapter */
final TypeAdapter<T> delegate = gson.getDelegateAdapter(this, type);
- return new TypeAdapter<T>() {
+ return new TypeAdapter<>() {
@Override
public @Nullable T read(JsonReader in) throws IOException {
/* read the object using the default adapter, but translate the names in the reader */
if (!thingFound) {
// Properties needed for functional Thing
VehicleAttributes vehicleAttributes = vehicle.getVehicleBase().getAttributes();
- Map<String, Object> convertedProperties = new HashMap<String, Object>(properties);
+ Map<String, Object> convertedProperties = new HashMap<>(properties);
convertedProperties.put(MyBMWConstants.VIN, vehicle.getVehicleBase().getVin());
convertedProperties.put(MyBMWConstants.VEHICLE_BRAND, vehicleAttributes.getBrand());
convertedProperties.put(MyBMWConstants.REFRESH_INTERVAL,
return Arrays.asList(vehicleBaseArray);
} catch (JsonSyntaxException e) {
LOGGER.debug("JsonSyntaxException {}", e.getMessage());
- return new ArrayList<VehicleBase>();
+ return new ArrayList<>();
}
}
private boolean hasFuel;
private boolean isHybrid;
- private Map<String, State> specialHandlingMap = new HashMap<String, State>();
+ private Map<String, State> specialHandlingMap = new HashMap<>();
public StatusWrapper(String type, String statusJson) {
hasFuel = type.equals(VehicleType.CONVENTIONAL.toString()) || type.equals(VehicleType.PLUGIN_HYBRID.toString())
Request loginRequest = authHttpClient.POST(authUrl);
loginRequest.header("Content-Type", "application/x-www-form-urlencoded");
- MultiMap<String> baseParams = new MultiMap<String>();
+ MultiMap<String> baseParams = new MultiMap<>();
baseParams.put("client_id", aqr.clientId);
baseParams.put("response_type", "code");
baseParams.put("redirect_uri", aqr.returnUrl);
baseParams.put("code_challenge", codeChallenge);
baseParams.put("code_challenge_method", "S256");
- MultiMap<String> loginParams = new MultiMap<String>(baseParams);
+ MultiMap<String> loginParams = new MultiMap<>(baseParams);
loginParams.put("grant_type", "authorization_code");
loginParams.put("username", user);
loginParams.put("password", pwd);
String authCode = getAuthCode(secondResonse.getContentAsString());
logger.info(authCode);
- MultiMap<String> authParams = new MultiMap<String>(baseParams);
+ MultiMap<String> authParams = new MultiMap<>(baseParams);
authParams.put("authorization", authCode);
Request authRequest = authHttpClient.POST(authUrl).followRedirects(false);
authRequest.header("Content-Type", "application/x-www-form-urlencoded");
codeRequest.header("Content-Type", "application/x-www-form-urlencoded");
codeRequest.header(AUTHORIZATION, basicAuth);
- MultiMap<String> codeParams = new MultiMap<String>();
+ MultiMap<String> codeParams = new MultiMap<>();
codeParams.put("code", code);
codeParams.put("code_verifier", codeVerifier);
codeParams.put("redirect_uri", aqr.returnUrl);
HttpClient apiHttpClient = new HttpClient(sslContextFactory);
apiHttpClient.start();
- MultiMap<String> vehicleParams = new MultiMap<String>();
+ MultiMap<String> vehicleParams = new MultiMap<>();
vehicleParams.put("tireGuardMode", "ENABLED");
vehicleParams.put("appDateTime", Long.toString(System.currentTimeMillis()));
vehicleParams.put("apptimezone", "60");
/**
* CHARGE STATISTICS
*/
- MultiMap<String> chargeStatisticsParams = new MultiMap<String>();
+ MultiMap<String> chargeStatisticsParams = new MultiMap<>();
chargeStatisticsParams.put("vin", "WBY1Z81040V905639");
chargeStatisticsParams.put("currentDate", Converter.getCurrentISOTime());
params = UrlEncoded.encode(chargeStatisticsParams, StandardCharsets.UTF_8, false);
/**
* CHARGE SESSIONS
*/
- MultiMap<String> chargeSessionsParams = new MultiMap<String>();
+ MultiMap<String> chargeSessionsParams = new MultiMap<>();
chargeSessionsParams.put("vin", "WBY1Z81040V905639");
chargeSessionsParams.put("maxResults", "40");
chargeSessionsParams.put("include_date_picker", "true");
}
public static String codeFromUrl(String encodedUrl) {
- final MultiMap<String> tokenMap = new MultiMap<String>();
+ final MultiMap<String> tokenMap = new MultiMap<>();
UrlEncoded.decodeTo(encodedUrl, tokenMap, StandardCharsets.US_ASCII);
final StringBuilder codeFound = new StringBuilder();
tokenMap.forEach((key, value) -> {
public void registerListener(MessageType messageType, MycroftMessageListener<? extends BaseMessage> listener) {
Set<MycroftMessageListener<? extends BaseMessage>> messageTypeListeners = listeners.get(messageType);
if (messageTypeListeners == null) {
- messageTypeListeners = new HashSet<MycroftMessageListener<? extends BaseMessage>>();
+ messageTypeListeners = new HashSet<>();
listeners.put(messageType, messageTypeListeners);
}
messageTypeListeners.add(listener);
private @Nullable HttpClient httpClientSSETouchEvent;
private @Nullable Request sseTouchjobRequest;
- private final List<NanoleafControllerListener> controllerListeners = new CopyOnWriteArrayList<NanoleafControllerListener>();
+ private final List<NanoleafControllerListener> controllerListeners = new CopyOnWriteArrayList<>();
private PanelLayout previousPanelLayout = new PanelLayout();
private final NanoleafPanelColors panelColors = new NanoleafPanelColors();
private boolean updateVisualLayout = true;
private static final String ENTITY_LOGGER_PROPERTY = LoggingFilter.class.getName() + ".entityLogger";
private static final String LOGGING_ID_PROPERTY = LoggingFilter.class.getName() + ".id";
- private static final Comparator<Map.Entry<String, List<String>>> COMPARATOR = new Comparator<Map.Entry<String, List<String>>>() {
+ private static final Comparator<Map.Entry<String, List<String>>> COMPARATOR = new Comparator<>() {
@Override
public int compare(final Map.Entry<String, List<String>> o1, final Map.Entry<String, List<String>> o2) {
}
private Set<Map.Entry<String, List<String>>> getSortedHeaders(final Set<Map.Entry<String, List<String>>> headers) {
- final TreeSet<Map.Entry<String, List<String>>> sortedHeaders = new TreeSet<Map.Entry<String, List<String>>>(
+ final TreeSet<Map.Entry<String, List<String>>> sortedHeaders = new TreeSet<>(
COMPARATOR);
sortedHeaders.addAll(headers);
return sortedHeaders;
}
private <T> TypeAdapter<T> newStrictEnumAdapter(@NonNullByDefault({}) 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);
private static final Random RANDOM = new Random();
- private final ArrayList<ModbusValue> dataReadoutValues = new ArrayList<ModbusValue>() {
+ private final ArrayList<ModbusValue> dataReadoutValues = new ArrayList<>() {
{
add(new ModbusValue(43009, 287));
add(new ModbusValue(43008, 100));
@SuppressWarnings("serial")
private static final Map<Integer, VariableInformation> VARIABLE_INFO_F1X45 = Collections
- .unmodifiableMap(new HashMap<Integer, VariableInformation>() {
+ .unmodifiableMap(new HashMap<>() {
{
// @formatter:off
put(40004, new VariableInformation( 10, NibeDataType.S16, Type.SENSOR , "BT1 Outdoor temp"));
@SuppressWarnings("serial")
private static final Map<Integer, VariableInformation> VARIABLE_INFO_F1X55 = Collections
- .unmodifiableMap(new HashMap<Integer, VariableInformation>() {
+ .unmodifiableMap(new HashMap<>() {
{
// @formatter:off
put(32260, new VariableInformation( 1, NibeDataType.U8 , Type.SENSOR , "NIBE Inverter 216-state"));
@SuppressWarnings("serial")
private static final Map<Integer, VariableInformation> VARIABLE_INFO_F470 = Collections
- .unmodifiableMap(new HashMap<Integer, VariableInformation>() {
+ .unmodifiableMap(new HashMap<>() {
{
// @formatter:off
put(40004, new VariableInformation( 10, NibeDataType.S16, Type.SENSOR , "BT1 Outdoor Temperature"));
@SuppressWarnings("serial")
private static final Map<Integer, VariableInformation> VARIABLE_INFO_F750 = Collections
- .unmodifiableMap(new HashMap<Integer, VariableInformation>() {
+ .unmodifiableMap(new HashMap<>() {
{
// @formatter:off
put(32260, new VariableInformation( 1, NibeDataType.U8 , Type.SENSOR , "NIBE Inverter 216-state"));
@SuppressWarnings("serial")
private static final Map<Integer, VariableInformation> VARIABLE_INFO_SMO40 = Collections
- .unmodifiableMap(new HashMap<Integer, VariableInformation>() {
+ .unmodifiableMap(new HashMap<>() {
{
// @formatter:off
put(40004, new VariableInformation( 10, NibeDataType.S16, Type.SENSOR , "BT1 Outdoor Temperature"));
final String okMessage = "5C0020685001A81F0100A86400FDA7D003449C1E004F9CA000509C7800519C0301529C1B01879C14014E9CC601479C010115B9B0FF3AB94B00C9AF0000489C0D014C9CE7004B9C0000FFFF0000FFFF0000FFFF000045";
@SuppressWarnings("serial")
- final ArrayList<ModbusValue> values = new ArrayList<ModbusValue>() {
+ final ArrayList<ModbusValue> values = new ArrayList<>() {
{
add(new ModbusValue(43009, 287));
add(new ModbusValue(43008, 100));
final String message = "5C0020685001A81F0100A86400FDA7D003449C1E004F9CA000509C7800519C0301529C1B01879C14014E9CC601479C010115B9B0FF3AB94B00C9AF0000489C0D014C9CE7004B9C0000FFFF0000FFFF0000FFFF000045";
@SuppressWarnings("serial")
- final ArrayList<ModbusValue> expectedValues = new ArrayList<ModbusValue>() {
+ final ArrayList<ModbusValue> expectedValues = new ArrayList<>() {
{
add(new ModbusValue(43009, 287));
add(new ModbusValue(43008, 100));
final String message = "5C0020685401A81F0100A86400FDA7D003449C1E004F9CA000509C7800519C0301529C1B01879C14014E9CC601479C010115B9B0FF3AB94B00C9AF0000489C0D014C9CE7004B9C0000FFFF0000FFFF00005C5C5C5C5C5C5C5C41";
@SuppressWarnings("serial")
- final ArrayList<ModbusValue> expectedValues = new ArrayList<ModbusValue>() {
+ final ArrayList<ModbusValue> expectedValues = new ArrayList<>() {
{
add(new ModbusValue(43009, 287));
add(new ModbusValue(43008, 100));
final String message = "5C00206851449C2500489CFC004C9CF1004E9CC7014D9C0B024F9C2500509C3300519C0B01529C5C5C01569C3100C9AF000001A80C01FDA716FAFAA9070098A91B1BFFFF0000A0A9CA02FFFF00009CA99212FFFF0000BE";
@SuppressWarnings("serial")
- final ArrayList<ModbusValue> expectedValues = new ArrayList<ModbusValue>() {
+ final ArrayList<ModbusValue> expectedValues = new ArrayList<>() {
{
add(new ModbusValue(40004, 37));
add(new ModbusValue(40008, 252));
final String message = "5C00206852449C2500489CFE004C9CF2004E9CD4014D9CFB014F9C2500509C3700519C0D01529C5C5C01569C3200C9AF000001A80C01FDA712FAFAA9070098A95C5C1BFFFF0000A0A9D102FFFF00009CA9B412FFFF00007F";
@SuppressWarnings("serial")
- final ArrayList<ModbusValue> expectedValues = new ArrayList<ModbusValue>() {
+ final ArrayList<ModbusValue> expectedValues = new ArrayList<>() {
{
add(new ModbusValue(40004, 37));
add(new ModbusValue(40008, 254));
final String message = "5C00206850449C2600489CF6004C9CF1004E9CD6014D9C0C024F9C4500509C3F00519CF100529C0401569CD500C9AF000001A80C01FDA799FAFAA9020098A91A1BFFFF0000A0A9CA02FFFF00009CA99212FFFF0000C5";
@SuppressWarnings("serial")
- final ArrayList<ModbusValue> expectedValues = new ArrayList<ModbusValue>() {
+ final ArrayList<ModbusValue> expectedValues = new ArrayList<>() {
{
add(new ModbusValue(40004, 38));
add(new ModbusValue(40008, 246));
@NonNullByDefault
public final class ComponentRegister {
- private final @NotNull Map<SerialNumber, Component> register = new HashMap<SerialNumber, Component>();
+ private final @NotNull Map<SerialNumber, Component> register = new HashMap<>();
/**
* Stores a new Component in the register. If a component exists with the same id, that value is overwritten.
@NonNullByDefault
public final class WeekProfileRegister {
- private @NotNull Map<Integer, WeekProfile> register = new HashMap<Integer, WeekProfile>();
+ private @NotNull Map<Integer, WeekProfile> register = new HashMap<>();
/**
* Stores a new week profile in the register. If a week profile exists with the same id, that value is overwritten.
@NonNullByDefault
public final class ZoneRegister {
- private final @NotNull Map<Integer, Zone> register = new HashMap<Integer, Zone>();
+ private final @NotNull Map<Integer, Zone> register = new HashMap<>();
/**
* Stores a new Zone in the register. If a zone exists with the same id, that value is overwritten.
public class NuvoMenu {
@XmlElement(required = true)
- protected List<NuvoMenu.Source> source = new ArrayList<NuvoMenu.Source>();
+ protected List<NuvoMenu.Source> source = new ArrayList<>();
public List<NuvoMenu.Source> getSource() {
return this.source;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
public static class Source {
- protected List<NuvoMenu.Source.TopMenu> topmenu = new ArrayList<NuvoMenu.Source.TopMenu>();
+ protected List<NuvoMenu.Source.TopMenu> topmenu = new ArrayList<>();
public List<NuvoMenu.Source.TopMenu> getTopMenu() {
return this.topmenu;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
public static class TopMenu {
- protected List<String> item = new ArrayList<String>();
+ protected List<String> item = new ArrayList<>();
@XmlAttribute(name = "text", required = true)
protected String text = "";
private boolean isAnyOhNuvoNet = false;
private NuvoMenu nuvoMenus = new NuvoMenu();
- private HashMap<String, Set<NuvoEnum>> nuvoGroupMap = new HashMap<String, Set<NuvoEnum>>();
- private HashMap<NuvoEnum, Integer> nuvoNetSrcMap = new HashMap<NuvoEnum, Integer>();
- private HashMap<NuvoEnum, String> favPrefixMap = new HashMap<NuvoEnum, String>();
- private HashMap<NuvoEnum, String[]> favoriteMap = new HashMap<NuvoEnum, String[]>();
+ private HashMap<String, Set<NuvoEnum>> nuvoGroupMap = new HashMap<>();
+ private HashMap<NuvoEnum, Integer> nuvoNetSrcMap = new HashMap<>();
+ private HashMap<NuvoEnum, String> favPrefixMap = new HashMap<>();
+ private HashMap<NuvoEnum, String[]> favoriteMap = new HashMap<>();
- private HashMap<NuvoEnum, byte[]> albumArtMap = new HashMap<NuvoEnum, byte[]>();
- private HashMap<NuvoEnum, Integer> albumArtIds = new HashMap<NuvoEnum, Integer>();
- private HashMap<NuvoEnum, String> dispInfoCache = new HashMap<NuvoEnum, String>();
+ private HashMap<NuvoEnum, byte[]> albumArtMap = new HashMap<>();
+ private HashMap<NuvoEnum, Integer> albumArtIds = new HashMap<>();
+ private HashMap<NuvoEnum, String> dispInfoCache = new HashMap<>();
Set<Integer> activeZones = new HashSet<>(1);
// A tree map that maps the source ids to source labels
- TreeMap<String, String> sourceLabels = new TreeMap<String, String>();
+ TreeMap<String, String> sourceLabels = new TreeMap<>();
// Indicates if there is a need to poll status because of a disconnection used for MPS4 systems
boolean pollStatusNeeded = true;
nuvoNetSrcMap.put(NuvoEnum.SOURCE5, config.nuvoNetSrc5);
nuvoNetSrcMap.put(NuvoEnum.SOURCE6, config.nuvoNetSrc6);
- nuvoGroupMap.put("1", new HashSet<NuvoEnum>());
- nuvoGroupMap.put("2", new HashSet<NuvoEnum>());
- nuvoGroupMap.put("3", new HashSet<NuvoEnum>());
- nuvoGroupMap.put("4", new HashSet<NuvoEnum>());
+ nuvoGroupMap.put("1", new HashSet<>());
+ nuvoGroupMap.put("2", new HashSet<>());
+ nuvoGroupMap.put("3", new HashSet<>());
+ nuvoGroupMap.put("4", new HashSet<>());
if (this.isMps4) {
logger.debug("Port set to {} configuring binding for MPS4 compatability", MPS4_PORT);
break;
case CHANNEL_TRACK_LENGTH:
case CHANNEL_TRACK_POSITION:
- state = new QuantityType<Time>(Integer.parseInt(value) / 10, NuvoHandler.API_SECOND_UNIT);
+ state = new QuantityType<>(Integer.parseInt(value) / 10, NuvoHandler.API_SECOND_UNIT);
break;
case CHANNEL_ALBUM_ART:
state = new RawType(bytes, "image/jpeg");
import java.util.Objects;
import java.util.function.Consumer;
-import javax.measure.quantity.Temperature;
-
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.ojelectronics.internal.config.OJElectronicsThermostatConfiguration;
}
} else {
synchronized (this) {
- updatedValues.add(new AbstractMap.SimpleImmutableEntry<String, Command>(channelUID.getId(), command));
+ updatedValues.add(new AbstractMap.SimpleImmutableEntry<>(channelUID.getId(), command));
BridgeHandler bridgeHandler = Objects.requireNonNull(getBridge()).getHandler();
if (bridgeHandler != null) {
private void updateManualSetpoint(ThermostatModel thermostat) {
updateState(BindingConstants.CHANNEL_OWD5_MANUALSETPOINT,
- new QuantityType<Temperature>(thermostat.manualModeSetpoint / (double) 100, SIUnits.CELSIUS));
+ new QuantityType<>(thermostat.manualModeSetpoint / (double) 100, SIUnits.CELSIUS));
}
private void updateManualSetpoint(Command command) {
private void updateComfortSetpoint(ThermostatModel thermostat) {
updateState(BindingConstants.CHANNEL_OWD5_COMFORTSETPOINT,
- new QuantityType<Temperature>(thermostat.comfortSetpoint / (double) 100, SIUnits.CELSIUS));
+ new QuantityType<>(thermostat.comfortSetpoint / (double) 100, SIUnits.CELSIUS));
}
private void updateComfortSetpoint(Command command) {
private void updateFloorTemperature(ThermostatModel thermostat) {
updateState(BindingConstants.CHANNEL_OWD5_FLOORTEMPERATURE,
- new QuantityType<Temperature>(thermostat.floorTemperature / (double) 100, SIUnits.CELSIUS));
+ new QuantityType<>(thermostat.floorTemperature / (double) 100, SIUnits.CELSIUS));
}
private void updateFloorTemperature(ThermostatRealTimeValuesModel thermostatRealTimeValues) {
- updateState(BindingConstants.CHANNEL_OWD5_FLOORTEMPERATURE, new QuantityType<Temperature>(
- thermostatRealTimeValues.floorTemperature / (double) 100, SIUnits.CELSIUS));
+ updateState(BindingConstants.CHANNEL_OWD5_FLOORTEMPERATURE,
+ new QuantityType<>(thermostatRealTimeValues.floorTemperature / (double) 100, SIUnits.CELSIUS));
}
private void updateRoomTemperature(ThermostatModel thermostat) {
updateState(BindingConstants.CHANNEL_OWD5_ROOMTEMPERATURE,
- new QuantityType<Temperature>(thermostat.roomTemperature / (double) 100, SIUnits.CELSIUS));
+ new QuantityType<>(thermostat.roomTemperature / (double) 100, SIUnits.CELSIUS));
}
private void updateRoomTemperature(ThermostatRealTimeValuesModel thermostatRealTimeValues) {
- updateState(BindingConstants.CHANNEL_OWD5_ROOMTEMPERATURE, new QuantityType<Temperature>(
- thermostatRealTimeValues.roomTemperature / (double) 100, SIUnits.CELSIUS));
+ updateState(BindingConstants.CHANNEL_OWD5_ROOMTEMPERATURE,
+ new QuantityType<>(thermostatRealTimeValues.roomTemperature / (double) 100, SIUnits.CELSIUS));
}
private void updateHeating(ThermostatModel thermostat) {
public String groupName = "";
- public List<ThermostatModel> thermostats = new ArrayList<ThermostatModel>();
+ public List<ThermostatModel> thermostats = new ArrayList<>();
public int regulationMode;
@NonNullByDefault
public class GroupContentResponseModel extends ResponseModelBase {
- public List<GroupContentModel> groupContents = new ArrayList<GroupContentModel>();
+ public List<GroupContentModel> groupContents = new ArrayList<>();
}
@NonNullByDefault
public class ScheduleModel {
- public List<DayModel> days = new ArrayList<DayModel>();
+ public List<DayModel> days = new ArrayList<>();
public boolean modifiedDueToVerification;
}
@Override
public Iterator<T> iterator() {
- List<T> messages = new ArrayList<T>();
+ List<T> messages = new ArrayList<>();
int currentObjectNumber = objectNumber;
while (true) {
}
public ObjectPropertyRequest<T> build() {
- return new ObjectPropertyRequest<T>(bridgeHandler, request, objectNumber, filter1, filter2, filter3,
- offset);
+ return new ObjectPropertyRequest<>(bridgeHandler, request, objectNumber, filter1, filter2, filter3, offset);
}
}
}
scheduleTriggerEvents(channelUID, now, arrivalAndDepartures,
(ArrivalAndDeparture data) -> data.predicted ? data.predictedArrivalTime : data.scheduledArrivalTime,
EVENT_ARRIVAL);
- scheduleTriggerEvents(channelUID, now, arrivalAndDepartures, new Function<ArrivalAndDeparture, Long>() {
+ scheduleTriggerEvents(channelUID, now, arrivalAndDepartures, new Function<>() {
@Override
public Long apply(ArrivalAndDeparture data) {
return data.predicted ? data.predictedDepartureTime : data.scheduledDepartureTime;
@Override
public QuantityType<Time> getRainDelay() {
if (state.jcReply.rdst == 0) {
- return new QuantityType<Time>(0, Units.SECOND);
+ return new QuantityType<>(0, Units.SECOND);
}
long remainingTime = state.jcReply.rdst - state.jcReply.devt;
- return new QuantityType<Time>(remainingTime, Units.SECOND);
+ return new QuantityType<>(remainingTime, Units.SECOND);
}
/**
import java.math.BigDecimal;
import java.util.ArrayList;
-import javax.measure.quantity.Dimensionless;
-import javax.measure.quantity.ElectricCurrent;
-
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.opensprinkler.internal.OpenSprinklerStateDescriptionProvider;
import org.openhab.binding.opensprinkler.internal.api.OpenSprinklerApi;
updateState(channel, QuantityType.valueOf(localAPI.waterLevel(), PERCENT));
break;
case SENSOR_CURRENT_DRAW:
- updateState(channel, new QuantityType<ElectricCurrent>(localAPI.currentDraw(), MILLI(Units.AMPERE)));
+ updateState(channel, new QuantityType<>(localAPI.currentDraw(), MILLI(Units.AMPERE)));
break;
case SENSOR_SIGNAL_STRENGTH:
int rssiValue = localAPI.signalStrength();
}
break;
case SENSOR_FLOW_COUNT:
- updateState(channel, new QuantityType<Dimensionless>(localAPI.flowSensorCount(), Units.ONE));
+ updateState(channel, new QuantityType<>(localAPI.flowSensorCount(), Units.ONE));
break;
case CHANNEL_PROGRAMS:
break;
private static long lastAllDevicesRefreshTS = 0; // ts when last all device refresh was sent for this handler
- private static Set<OpenWebNetAlarmHandler> zoneHandlers = new HashSet<OpenWebNetAlarmHandler>();
+ private static Set<OpenWebNetAlarmHandler> zoneHandlers = new HashSet<>();
private static final String BATTERY_OK = "OK";
private static final String BATTERY_FAULT = "FAULT";
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
-import javax.measure.quantity.Energy;
-import javax.measure.quantity.Power;
-
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.openwebnet.internal.OpenWebNetBindingConstants;
Integer activePower;
try {
activePower = Integer.parseInt(msg.getDimValues()[0]);
- updateState(CHANNEL_POWER, new QuantityType<Power>(activePower, Units.WATT));
+ updateState(CHANNEL_POWER, new QuantityType<>(activePower, Units.WATT));
} catch (FrameException e) {
logger.warn("FrameException on frame {}: {}", msg, e.getMessage());
updateState(CHANNEL_POWER, UnDefType.UNDEF);
Double currentDayEnergy;
try {
currentDayEnergy = Double.parseDouble(msg.getDimValues()[0]) / 1000d;
- updateState(CHANNEL_ENERGY_TOTALIZER_DAY, new QuantityType<Energy>(currentDayEnergy, Units.KILOWATT_HOUR));
+ updateState(CHANNEL_ENERGY_TOTALIZER_DAY, new QuantityType<>(currentDayEnergy, Units.KILOWATT_HOUR));
} catch (FrameException e) {
logger.warn("FrameException on frame {}: {}", msg, e.getMessage());
updateState(CHANNEL_ENERGY_TOTALIZER_DAY, UnDefType.UNDEF);
Double currentMonthEnergy;
try {
currentMonthEnergy = Double.parseDouble(msg.getDimValues()[0]) / 1000d;
- updateState(CHANNEL_ENERGY_TOTALIZER_MONTH,
- new QuantityType<Energy>(currentMonthEnergy, Units.KILOWATT_HOUR));
+ updateState(CHANNEL_ENERGY_TOTALIZER_MONTH, new QuantityType<>(currentMonthEnergy, Units.KILOWATT_HOUR));
} catch (FrameException e) {
logger.warn("FrameException on frame {}: {}", msg, e.getMessage());
updateState(CHANNEL_ENERGY_TOTALIZER_MONTH, UnDefType.UNDEF);
}
private static Set<Integer> csvStringToSetInt(String s) {
- TreeSet<Integer> intSet = new TreeSet<Integer>();
+ TreeSet<Integer> intSet = new TreeSet<>();
String sNorm = s.replaceAll("\\s", "");
Scanner sc = new Scanner(sNorm);
sc.useDelimiter(",");
import static org.openhab.binding.paradoxalarm.internal.handlers.ParadoxAlarmBindingConstants.*;
-import javax.measure.quantity.ElectricPotential;
-
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.paradoxalarm.internal.model.ParadoxInformation;
import org.openhab.binding.paradoxalarm.internal.model.ParadoxPanel;
updateProperty(PANEL_BOOTLOADER_VERSION_PROPERTY_NAME, panelInformation.getBootLoaderVersion().toString());
updateState(PANEL_TIME, new DateTimeType(panel.getPanelTime()));
- updateState(PANEL_INPUT_VOLTAGE, new QuantityType<ElectricPotential>(panel.getVdcLevel(), Units.VOLT));
- updateState(PANEL_BOARD_VOLTAGE, new QuantityType<ElectricPotential>(panel.getDcLevel(), Units.VOLT));
- updateState(PANEL_BATTERY_VOLTAGE,
- new QuantityType<ElectricPotential>(panel.getBatteryLevel(), Units.VOLT));
+ updateState(PANEL_INPUT_VOLTAGE, new QuantityType<>(panel.getVdcLevel(), Units.VOLT));
+ updateState(PANEL_BOARD_VOLTAGE, new QuantityType<>(panel.getDcLevel(), Units.VOLT));
+ updateState(PANEL_BATTERY_VOLTAGE, new QuantityType<>(panel.getBatteryLevel(), Units.VOLT));
}
}
}
* @return
*/
public List<String> getAvailablePlayers() {
- List<String> availablePlayers = new ArrayList<String>();
+ List<String> availablePlayers = new ArrayList<>();
MediaContainer sessionData = plexAPIConnector.getSessionData();
if (sessionData != null && sessionData.getSize() > 0) {
}
private <T> PlugwiseHAControllerRequest<T> newRequest(Class<T> responseType, @Nullable Transformer transformer) {
- return new PlugwiseHAControllerRequest<T>(responseType, this.xStream, transformer, this.httpClient, this.host,
+ return new PlugwiseHAControllerRequest<>(responseType, this.xStream, transformer, this.httpClient, this.host,
this.port, this.username, this.smileId);
}
private <T> PlugwiseHAControllerRequest<T> newRequest(Class<T> responseType) {
- return new PlugwiseHAControllerRequest<T>(responseType, this.xStream, null, this.httpClient, this.host,
+ return new PlugwiseHAControllerRequest<>(responseType, this.xStream, null, this.httpClient, this.host,
this.port, this.username, this.smileId);
}
private String preset;
@XStreamImplicit(itemFieldName = "appliance")
- private List<String> locationAppliances = new ArrayList<String>();
+ private List<String> locationAppliances = new ArrayList<>();
@XStreamImplicit(itemFieldName = "point_log", keyFieldName = "type")
private Logs pointLogs;
import java.util.Map;
import javax.measure.Unit;
-import javax.measure.quantity.Dimensionless;
-import javax.measure.quantity.Power;
import javax.measure.quantity.Pressure;
import javax.measure.quantity.Temperature;
if (batteryLevel != null) {
batteryLevel = batteryLevel * 100;
- state = new QuantityType<Dimensionless>(batteryLevel.intValue(), Units.PERCENT);
+ state = new QuantityType<>(batteryLevel.intValue(), Units.PERCENT);
if (batteryLevel <= config.getLowBatteryPercentage()) {
updateState(APPLIANCE_BATTERYLEVELLOW_CHANNEL, OnOffType.ON);
} else {
Unit<Temperature> unit = entity.getOffsetTemperatureUnit().orElse(UNIT_CELSIUS).equals(UNIT_CELSIUS)
? SIUnits.CELSIUS
: ImperialUnits.FAHRENHEIT;
- state = new QuantityType<Temperature>(entity.getOffsetTemperature().get(), unit);
+ state = new QuantityType<>(entity.getOffsetTemperature().get(), unit);
}
break;
case APPLIANCE_POWER_CHANNEL:
break;
case APPLIANCE_POWER_USAGE_CHANNEL:
if (entity.getPowerUsage().isPresent()) {
- state = new QuantityType<Power>(entity.getPowerUsage().get(), Units.WATT);
+ state = new QuantityType<>(entity.getPowerUsage().get(), Units.WATT);
}
break;
case APPLIANCE_SETPOINT_CHANNEL:
if (entity.getSetpointTemperature().isPresent()) {
Unit<Temperature> unit = entity.getSetpointTemperatureUnit().orElse(UNIT_CELSIUS)
.equals(UNIT_CELSIUS) ? SIUnits.CELSIUS : ImperialUnits.FAHRENHEIT;
- state = new QuantityType<Temperature>(entity.getSetpointTemperature().get(), unit);
+ state = new QuantityType<>(entity.getSetpointTemperature().get(), unit);
}
break;
case APPLIANCE_TEMPERATURE_CHANNEL:
Unit<Temperature> unit = entity.getTemperatureUnit().orElse(UNIT_CELSIUS).equals(UNIT_CELSIUS)
? SIUnits.CELSIUS
: ImperialUnits.FAHRENHEIT;
- state = new QuantityType<Temperature>(entity.getTemperature().get(), unit);
+ state = new QuantityType<>(entity.getTemperature().get(), unit);
}
break;
case APPLIANCE_VALVEPOSITION_CHANNEL:
if (entity.getValvePosition().isPresent()) {
Double valvePosition = entity.getValvePosition().get() * 100;
- state = new QuantityType<Dimensionless>(valvePosition.intValue(), Units.PERCENT);
+ state = new QuantityType<>(valvePosition.intValue(), Units.PERCENT);
}
break;
case APPLIANCE_WATERPRESSURE_CHANNEL:
if (entity.getWaterPressure().isPresent()) {
Unit<Pressure> unit = HECTO(SIUnits.PASCAL);
- state = new QuantityType<Pressure>(entity.getWaterPressure().get(), unit);
+ state = new QuantityType<>(entity.getWaterPressure().get(), unit);
}
break;
case APPLIANCE_COOLINGSTATE_CHANNEL:
if (entity.getIntendedBoilerTemp().isPresent()) {
Unit<Temperature> unit = entity.getIntendedBoilerTempUnit().orElse(UNIT_CELSIUS)
.equals(UNIT_CELSIUS) ? SIUnits.CELSIUS : ImperialUnits.FAHRENHEIT;
- state = new QuantityType<Temperature>(entity.getIntendedBoilerTemp().get(), unit);
+ state = new QuantityType<>(entity.getIntendedBoilerTemp().get(), unit);
}
break;
case APPLIANCE_FLAMESTATE_CHANNEL:
case APPLIANCE_MODULATIONLEVEL_CHANNEL:
if (entity.getModulationLevel().isPresent()) {
Double modulationLevel = entity.getModulationLevel().get() * 100;
- state = new QuantityType<Dimensionless>(modulationLevel.intValue(), Units.PERCENT);
+ state = new QuantityType<>(modulationLevel.intValue(), Units.PERCENT);
}
break;
case APPLIANCE_OTAPPLICATIONFAULTCODE_CHANNEL:
if (entity.getOTAppFaultCode().isPresent()) {
- state = new QuantityType<Dimensionless>(entity.getOTAppFaultCode().get().intValue(), Units.PERCENT);
+ state = new QuantityType<>(entity.getOTAppFaultCode().get().intValue(), Units.PERCENT);
}
break;
case APPLIANCE_RETURNWATERTEMPERATURE_CHANNEL:
Unit<Temperature> unit = entity.getReturnWaterTempUnit().orElse(UNIT_CELSIUS).equals(UNIT_CELSIUS)
? SIUnits.CELSIUS
: ImperialUnits.FAHRENHEIT;
- state = new QuantityType<Temperature>(entity.getReturnWaterTemp().get(), unit);
+ state = new QuantityType<>(entity.getReturnWaterTemp().get(), unit);
}
break;
case APPLIANCE_DHWTEMPERATURE_CHANNEL:
Unit<Temperature> unit = entity.getDHWTempUnit().orElse(UNIT_CELSIUS).equals(UNIT_CELSIUS)
? SIUnits.CELSIUS
: ImperialUnits.FAHRENHEIT;
- state = new QuantityType<Temperature>(entity.getDHWTemp().get(), unit);
+ state = new QuantityType<>(entity.getDHWTemp().get(), unit);
}
break;
case APPLIANCE_OTOEMFAULTCODE_CHANNEL:
if (entity.getOTOEMFaultcode().isPresent()) {
- state = new QuantityType<Dimensionless>(entity.getOTOEMFaultcode().get().intValue(), Units.PERCENT);
+ state = new QuantityType<>(entity.getOTOEMFaultcode().get().intValue(), Units.PERCENT);
}
break;
case APPLIANCE_BOILERTEMPERATURE_CHANNEL:
Unit<Temperature> unit = entity.getBoilerTempUnit().orElse(UNIT_CELSIUS).equals(UNIT_CELSIUS)
? SIUnits.CELSIUS
: ImperialUnits.FAHRENHEIT;
- state = new QuantityType<Temperature>(entity.getBoilerTemp().get(), unit);
+ state = new QuantityType<>(entity.getBoilerTemp().get(), unit);
}
break;
case APPLIANCE_DHWSETPOINT_CHANNEL:
Unit<Temperature> unit = entity.getDHTSetpointUnit().orElse(UNIT_CELSIUS).equals(UNIT_CELSIUS)
? SIUnits.CELSIUS
: ImperialUnits.FAHRENHEIT;
- state = new QuantityType<Temperature>(entity.getDHTSetpoint().get(), unit);
+ state = new QuantityType<>(entity.getDHTSetpoint().get(), unit);
}
break;
case APPLIANCE_MAXBOILERTEMPERATURE_CHANNEL:
Unit<Temperature> unit = entity.getMaxBoilerTempUnit().orElse(UNIT_CELSIUS).equals(UNIT_CELSIUS)
? SIUnits.CELSIUS
: ImperialUnits.FAHRENHEIT;
- state = new QuantityType<Temperature>(entity.getMaxBoilerTemp().get(), unit);
+ state = new QuantityType<>(entity.getMaxBoilerTemp().get(), unit);
}
break;
case APPLIANCE_DHWCOMFORTMODE_CHANNEL:
if (entity.getSetpointTemperature().isPresent()) {
Unit<Temperature> unit = entity.getSetpointTemperatureUnit().orElse(UNIT_CELSIUS)
.equals(UNIT_CELSIUS) ? SIUnits.CELSIUS : ImperialUnits.FAHRENHEIT;
- state = new QuantityType<Temperature>(entity.getSetpointTemperature().get(), unit);
+ state = new QuantityType<>(entity.getSetpointTemperature().get(), unit);
}
break;
case ZONE_REGULATION_CHANNEL:
Unit<Temperature> unit = entity.getTemperatureUnit().orElse(UNIT_CELSIUS).equals(UNIT_CELSIUS)
? SIUnits.CELSIUS
: ImperialUnits.FAHRENHEIT;
- state = new QuantityType<Temperature>(entity.getTemperature().get(), unit);
+ state = new QuantityType<>(entity.getTemperature().get(), unit);
}
break;
default:
*/
public synchronized void update() {
// one step copy
- modules = new ArrayList<Module>(Parser.parseModules(listModules()));
+ modules = new ArrayList<>(Parser.parseModules(listModules()));
List<AbstractAudioDeviceConfig> newItems = new ArrayList<>(); // prepare new list before assigning it
if (configuration.sink) {
if (itemType == null) {
return Optional.empty();
}
- List<Module> modulesCopy = new ArrayList<Module>(modules);
+ List<Module> modulesCopy = new ArrayList<>(modules);
var isSource = item instanceof Source;
return modulesCopy.stream() // iteration on modules
.filter(module -> MODULE_SIMPLE_PROTOCOL_TCP_NAME.equals(module.getPaName())) // filter on module name
private @Nullable QolsysiqClient apiClient;
private @Nullable ScheduledFuture<?> retryFuture;
private @Nullable QolsysIQChildDiscoveryService discoveryService;
- private List<Partition> partitions = Collections.synchronizedList(new LinkedList<Partition>());
+ private List<Partition> partitions = Collections.synchronizedList(new LinkedList<>());
private String key = "";
public QolsysIQPanelHandler(Bridge bridge) {
private @Nullable ScheduledFuture<?> errorFuture;
private @Nullable String armCode;
private @Nullable String disarmCode;
- private List<Zone> zones = Collections.synchronizedList(new LinkedList<Zone>());
+ private List<Zone> zones = Collections.synchronizedList(new LinkedList<>());
private int partitionId;
public QolsysIQPartitionHandler(Bridge bridge) {
}
private void setSecureArm(Boolean secure) {
- Map<String, String> props = new HashMap<String, String>();
+ Map<String, String> props = new HashMap<>();
props.put("secureArm", String.valueOf(secure));
getThing().setProperties(props);
}
logger.debug("updateZone {}", zone.zoneId);
updateState(QolsysIQBindingConstants.CHANNEL_ZONE_STATE, new DecimalType(zone.state));
updateZoneStatus(zone.status);
- Map<String, String> props = new HashMap<String, String>();
+ Map<String, String> props = new HashMap<>();
props.put("type", zone.type);
props.put("name", zone.name);
props.put("group", zone.group);
switch (channelId) {
case TEMPERATURE:
if (data.getThermostatData().getTemperature() != null) {
- return new QuantityType<Temperature>(data.getThermostatData().getTemperature(),
- API_TEMPERATURE_UNIT);
+ return new QuantityType<>(data.getThermostatData().getTemperature(), API_TEMPERATURE_UNIT);
} else {
return null;
}
return data.getThermostatData().getProgramMode();
case SET_POINT:
if (data.getThermostatData().getSetpoint() != 0) {
- return new QuantityType<Temperature>(data.getThermostatData().getSetpoint(), API_TEMPERATURE_UNIT);
+ return new QuantityType<>(data.getThermostatData().getSetpoint(), API_TEMPERATURE_UNIT);
} else {
return null;
}
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-import javax.measure.quantity.Energy;
-import javax.measure.quantity.Length;
import javax.measure.quantity.Temperature;
-import javax.measure.quantity.Time;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
}
updateStatus(ThingStatus.UNKNOWN);
updateState(CHANNEL_HVAC_TARGET_TEMPERATURE,
- new QuantityType<Temperature>(car.getHvacTargetTemperature(), SIUnits.CELSIUS));
+ new QuantityType<>(car.getHvacTargetTemperature(), SIUnits.CELSIUS));
reschedulePollingJob();
}
if (!car.isDisableHvac()) {
if (command instanceof RefreshType) {
updateState(CHANNEL_HVAC_TARGET_TEMPERATURE,
- new QuantityType<Temperature>(car.getHvacTargetTemperature(), SIUnits.CELSIUS));
+ new QuantityType<>(car.getHvacTargetTemperature(), SIUnits.CELSIUS));
} else if (command instanceof DecimalType decimalCommand) {
car.setHvacTargetTemperature(decimalCommand.doubleValue());
updateState(CHANNEL_HVAC_TARGET_TEMPERATURE,
- new QuantityType<Temperature>(car.getHvacTargetTemperature(), SIUnits.CELSIUS));
+ new QuantityType<>(car.getHvacTargetTemperature(), SIUnits.CELSIUS));
} else if (command instanceof QuantityType) {
@Nullable
QuantityType<Temperature> celsius = ((QuantityType<Temperature>) command)
car.setHvacTargetTemperature(celsius.doubleValue());
}
updateState(CHANNEL_HVAC_TARGET_TEMPERATURE,
- new QuantityType<Temperature>(car.getHvacTargetTemperature(), SIUnits.CELSIUS));
+ new QuantityType<>(car.getHvacTargetTemperature(), SIUnits.CELSIUS));
}
}
break;
Double externalTemperature = car.getExternalTemperature();
if (externalTemperature != null) {
updateState(CHANNEL_EXTERNAL_TEMPERATURE,
- new QuantityType<Temperature>(externalTemperature.doubleValue(), SIUnits.CELSIUS));
+ new QuantityType<>(externalTemperature.doubleValue(), SIUnits.CELSIUS));
}
} catch (RenaultNotImplementedException e) {
logger.warn("Disabling unsupported HVAC status update.");
httpSession.getCockpit(car);
Double odometer = car.getOdometer();
if (odometer != null) {
- updateState(CHANNEL_ODOMETER, new QuantityType<Length>(odometer.doubleValue(), KILO(METRE)));
+ updateState(CHANNEL_ODOMETER, new QuantityType<>(odometer.doubleValue(), KILO(METRE)));
}
} catch (RenaultNotImplementedException e) {
logger.warn("Disabling unsupported cockpit status update.");
}
Double estimatedRange = car.getEstimatedRange();
if (estimatedRange != null) {
- updateState(CHANNEL_ESTIMATED_RANGE,
- new QuantityType<Length>(estimatedRange.doubleValue(), KILO(METRE)));
+ updateState(CHANNEL_ESTIMATED_RANGE, new QuantityType<>(estimatedRange.doubleValue(), KILO(METRE)));
}
Double batteryAvailableEnergy = car.getBatteryAvailableEnergy();
if (batteryAvailableEnergy != null) {
updateState(CHANNEL_BATTERY_AVAILABLE_ENERGY,
- new QuantityType<Energy>(batteryAvailableEnergy.doubleValue(), KILOWATT_HOUR));
+ new QuantityType<>(batteryAvailableEnergy.doubleValue(), KILOWATT_HOUR));
}
Integer chargingRemainingTime = car.getChargingRemainingTime();
if (chargingRemainingTime != null) {
updateState(CHANNEL_CHARGING_REMAINING_TIME,
- new QuantityType<Time>(chargingRemainingTime.doubleValue(), MINUTE));
+ new QuantityType<>(chargingRemainingTime.doubleValue(), MINUTE));
}
ZonedDateTime batteryStatusUpdated = car.getBatteryStatusUpdated();
if (batteryStatusUpdated != null) {
TcpDataSource[] dataSources = TcpDataSourceProvider.discoverDataSources(broadcastAddress, 3, 500, false);
- Map<String, TcpDataSource> currentDataSourceById = new HashMap<String, TcpDataSource>();
+ Map<String, TcpDataSource> currentDataSourceById = new HashMap<>();
for (TcpDataSource ds : dataSources) {
if (!discoveryRunning) {
break;
@Component(service = { ChannelTypeProvider.class, ResolChannelTypeProvider.class })
@NonNullByDefault
public class ResolChannelTypeProvider implements ChannelTypeProvider {
- private Map<ChannelTypeUID, ChannelType> channelTypes = new ConcurrentHashMap<ChannelTypeUID, ChannelType>();
+ private Map<ChannelTypeUID, ChannelType> channelTypes = new ConcurrentHashMap<>();
public ResolChannelTypeProvider() {
// let's add all channel types from known by the resol-vbus java library
* Map RFXCOM packet types to RFXCOM Thing types and vice versa.
*/
public static final Map<PacketType, ThingTypeUID> PACKET_TYPE_THING_TYPE_UID_MAP = Collections
- .unmodifiableMap(new HashMap<PacketType, ThingTypeUID>() {
+ .unmodifiableMap(new HashMap<>() {
{
put(PacketType.BAROMETRIC, RFXComBindingConstants.THING_TYPE_BAROMETRIC);
put(PacketType.BBQ, RFXComBindingConstants.THING_TYPE_BBQ_TEMPERATURE);
@SuppressWarnings("serial")
private static final Map<PacketType, Class<? extends RFXComMessage>> MESSAGE_CLASSES = Collections
- .unmodifiableMap(new HashMap<PacketType, Class<? extends RFXComMessage>>() {
+ .unmodifiableMap(new HashMap<>() {
{
put(PacketType.INTERFACE_CONTROL, RFXComInterfaceControlMessage.class);
put(PacketType.INTERFACE_MESSAGE, RFXComInterfaceMessage.class);
@XmlRootElement(name = "apps")
public class Apps {
@XmlElement
- private List<Apps.App> app = new ArrayList<Apps.App>();
+ private List<Apps.App> app = new ArrayList<>();
public List<Apps.App> getApp() {
return this.app;
@XmlRootElement(name = "tv-channels")
public class TvChannels {
@XmlElement
- private List<TvChannels.Channel> channel = new ArrayList<TvChannels.Channel>();
+ private List<TvChannels.Channel> channel = new ArrayList<>();
public List<TvChannels.Channel> getChannel() {
return this.channel;
* The table of channels to unique identifiers for media management functions
*/
@SuppressWarnings("serial")
- private final Map<String, AtomicInteger> mmSeqNbrs = Collections
- .unmodifiableMap(new HashMap<String, AtomicInteger>() {
- {
- put(RioConstants.CHANNEL_SOURCEMMMENU, new AtomicInteger(0));
- put(RioConstants.CHANNEL_SOURCEMMSCREEN, new AtomicInteger(0));
- put(RioConstants.CHANNEL_SOURCEMMTITLE, new AtomicInteger(0));
- put(RioConstants.CHANNEL_SOURCEMMATTR, new AtomicInteger(0));
- put(RioConstants.CHANNEL_SOURCEMMBUTTONOKTEXT, new AtomicInteger(0));
- put(RioConstants.CHANNEL_SOURCEMMBUTTONBACKTEXT, new AtomicInteger(0));
- put(RioConstants.CHANNEL_SOURCEMMINFOTEXT, new AtomicInteger(0));
- put(RioConstants.CHANNEL_SOURCEMMHELPTEXT, new AtomicInteger(0));
- put(RioConstants.CHANNEL_SOURCEMMTEXTFIELD, new AtomicInteger(0));
- }
- });
+ private final Map<String, AtomicInteger> mmSeqNbrs = Collections.unmodifiableMap(new HashMap<>() {
+ {
+ put(RioConstants.CHANNEL_SOURCEMMMENU, new AtomicInteger(0));
+ put(RioConstants.CHANNEL_SOURCEMMSCREEN, new AtomicInteger(0));
+ put(RioConstants.CHANNEL_SOURCEMMTITLE, new AtomicInteger(0));
+ put(RioConstants.CHANNEL_SOURCEMMATTR, new AtomicInteger(0));
+ put(RioConstants.CHANNEL_SOURCEMMBUTTONOKTEXT, new AtomicInteger(0));
+ put(RioConstants.CHANNEL_SOURCEMMBUTTONBACKTEXT, new AtomicInteger(0));
+ put(RioConstants.CHANNEL_SOURCEMMINFOTEXT, new AtomicInteger(0));
+ put(RioConstants.CHANNEL_SOURCEMMHELPTEXT, new AtomicInteger(0));
+ put(RioConstants.CHANNEL_SOURCEMMTEXTFIELD, new AtomicInteger(0));
+ }
+ });
/**
* The client used for http requests
@SuppressWarnings("serial")
private static final Map<String, Class<? extends SamsungTvService>> SERVICEMAP = Collections
- .unmodifiableMap(new HashMap<String, Class<? extends SamsungTvService>>() {
+ .unmodifiableMap(new HashMap<>() {
{
put(MainTVServerService.SERVICE_NAME, MainTVServerService.class);
put(MediaRendererService.SERVICE_NAME, MediaRendererService.class);
} else {
value = value.setScale(scale, RoundingMode.HALF_UP);
}
- updateState(channel.getUID(), new QuantityType<Q>(value, unit));
+ updateState(channel.getUID(), new QuantityType<>(value, unit));
}
protected BigDecimal getSenecValue(String value) {
public void testValidNoPressureUpdate() {
ThingMock t = new ThingMock();
- HashMap<String, Object> properties = new HashMap<String, Object>();
+ HashMap<String, Object> properties = new HashMap<>();
// String sensorid taken from thing-types.xml
properties.put("sensorid", 12345);
t.setConfiguration(properties);
public void testValidWithPressureUpdate() {
ThingMock t = new ThingMock();
- HashMap<String, Object> properties = new HashMap<String, Object>();
+ HashMap<String, Object> properties = new HashMap<>();
// String sensorid taken from thing-types.xml
properties.put("sensorid", 12345);
t.setConfiguration(properties);
public void testInvalidUpdate() {
ThingMock t = new ThingMock();
- HashMap<String, Object> properties = new HashMap<String, Object>();
+ HashMap<String, Object> properties = new HashMap<>();
// String sensorid taken from thing-types.xml
properties.put("sensorid", 12345);
t.setConfiguration(properties);
public void testEmptyUpdate() {
ThingMock t = new ThingMock();
- HashMap<String, Object> properties = new HashMap<String, Object>();
+ HashMap<String, Object> properties = new HashMap<>();
// String sensorid taken from thing-types.xml
properties.put("sensorid", 12345);
t.setConfiguration(properties);
public void testNullUpdate() {
ThingMock t = new ThingMock();
- HashMap<String, Object> properties = new HashMap<String, Object>();
+ HashMap<String, Object> properties = new HashMap<>();
// String sensorid taken from thing-types.xml
properties.put("sensorid", 12345);
t.setConfiguration(properties);
public void testInternalUpdate() {
ThingMock t = new ThingMock();
- HashMap<String, Object> properties = new HashMap<String, Object>();
+ HashMap<String, Object> properties = new HashMap<>();
// String sensorid taken from thing-types.xml
properties.put("ipAddress", "192.168.178.1");
t.setConfiguration(properties);
public void testValidUpdate() {
ThingMock t = new ThingMock();
- HashMap<String, Object> properties = new HashMap<String, Object>();
+ HashMap<String, Object> properties = new HashMap<>();
// String sensorid taken from thing-types.xml
properties.put("sensorid", 12345);
t.setConfiguration(properties);
public void testInvalidUpdate() {
ThingMock t = new ThingMock();
- HashMap<String, Object> properties = new HashMap<String, Object>();
+ HashMap<String, Object> properties = new HashMap<>();
// String sensorid taken from thing-types.xml
properties.put("sensorid", 12345);
t.setConfiguration(properties);
public void testEmptyUpdate() {
ThingMock t = new ThingMock();
- HashMap<String, Object> properties = new HashMap<String, Object>();
+ HashMap<String, Object> properties = new HashMap<>();
// String sensorid taken from thing-types.xml
properties.put("sensorid", 12345);
t.setConfiguration(properties);
public void testNullUpdate() {
ThingMock t = new ThingMock();
- HashMap<String, Object> properties = new HashMap<String, Object>();
+ HashMap<String, Object> properties = new HashMap<>();
// String sensorid taken from thing-types.xml
properties.put("sensorid", 12345);
t.setConfiguration(properties);
public void testValidConfigStatus() {
ThingMock t = new ThingMock();
- HashMap<String, Object> properties = new HashMap<String, Object>();
+ HashMap<String, Object> properties = new HashMap<>();
// String sensorid taken from thing-types.xml
properties.put("sensorid", 12345);
t.setConfiguration(properties);
public void testInvalidConfigStatus() {
ThingMock t = new ThingMock();
- HashMap<String, Object> properties = new HashMap<String, Object>();
+ HashMap<String, Object> properties = new HashMap<>();
// String sensorid taken from thing-types.xml
properties.put("sensorid", -1);
t.setConfiguration(properties);
public void testValidUpdate() {
ThingMock t = new ThingMock();
- HashMap<String, Object> properties = new HashMap<String, Object>();
+ HashMap<String, Object> properties = new HashMap<>();
// String sensorid taken from thing-types.xml
properties.put("sensorid", 12345);
t.setConfiguration(properties);
public void testInvalidUpdate() {
ThingMock t = new ThingMock();
- HashMap<String, Object> properties = new HashMap<String, Object>();
+ HashMap<String, Object> properties = new HashMap<>();
// String sensorid taken from thing-types.xml
properties.put("sensorid", 12345);
t.setConfiguration(properties);
public void testEmptyUpdate() {
ThingMock t = new ThingMock();
- HashMap<String, Object> properties = new HashMap<String, Object>();
+ HashMap<String, Object> properties = new HashMap<>();
// String sensorid taken from thing-types.xml
properties.put("sensorid", 12345);
t.setConfiguration(properties);
public void testNullUpdate() {
ThingMock t = new ThingMock();
- HashMap<String, Object> properties = new HashMap<String, Object>();
+ HashMap<String, Object> properties = new HashMap<>();
// String sensorid taken from thing-types.xml
properties.put("ipAdress", "192.168.178.1");
t.setConfiguration(properties);
public void testInternalPMSensor() {
ThingMock t = new ThingMock();
- HashMap<String, Object> properties = new HashMap<String, Object>();
+ HashMap<String, Object> properties = new HashMap<>();
// String sensorid taken from thing-types.xml
properties.put("sensorid", 12345);
t.setConfiguration(properties);
@Override
public List<Channel> getChannels() {
- return new ArrayList<Channel>();
+ return new ArrayList<>();
}
@Override
public List<Channel> getChannelsOfGroup(String channelGroupId) {
- return new ArrayList<Channel>();
+ return new ArrayList<>();
}
@Override
@Override
public Map<String, String> getProperties() {
- return new HashMap<String, String>();
+ return new HashMap<>();
}
@Override
}
List<CoIotSensor> sensorUpdates = list.generic;
- Map<String, State> updates = new TreeMap<String, State>();
+ Map<String, State> updates = new TreeMap<>();
logger.debug("{}: {} CoAP sensor updates received", thingName, sensorUpdates.size());
int failed = 0;
ShellyColorUtils col = new ShellyColorUtils();
@SuppressWarnings("null")
public void registerDeviceDiscoveryService() {
if (discoveryService == null) {
- discoveryService = bundleContext.registerService(DiscoveryService.class.getName(), this,
- new Hashtable<String, Object>());
+ discoveryService = bundleContext.registerService(DiscoveryService.class.getName(), this, new Hashtable<>());
}
}
private static final long serialVersionUID = 1L;
- private Map<K, Long> timeMap = new ConcurrentHashMap<K, Long>();
+ private Map<K, Long> timeMap = new ConcurrentHashMap<>();
private long expiryInMillis = ShellyManagerConstants.CACHE_TIMEOUT_DEF_MIN * 60 * 1000; // Default 1h
public ShellyManagerCache() {
// no files available for this device type
logger.info("{}: No firmware files found for device type {}", LOG_PREFIX, deviceType);
list = new FwArchList();
- list.versions = new ArrayList<FwArchEntry>();
+ list.versions = new ArrayList<>();
} else {
// Create selection list
json = "{" + json.replace("[{", "\"versions\":[{") + "}"; // make it a named array
import java.util.Map;
import java.util.Map.Entry;
-import javax.measure.quantity.ElectricCurrent;
-
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.junit.jupiter.api.Test;
assertNotNull(celsius);
assertEquals(18.55, celsius.floatValue(), 0.01);
- assertEquals(new QuantityType<ElectricCurrent>(0, Units.AMPERE),
- dataPoints.getPointByClass("'HDevElLd").getState());
+ assertEquals(new QuantityType<>(0, Units.AMPERE), dataPoints.getPointByClass("'HDevElLd").getState());
state = dataPoints.getPointByClass("'SpHPcf").getState();
assertTrue(state instanceof QuantityType<?>);
@Override
public Publisher<T> getMeterValues(byte @Nullable [] initMessage, Duration period, ExecutorService executor) {
- Flowable<T> itemPublisher = Flowable.<T> create((emitter) -> {
+ Flowable<T> itemPublisher = Flowable.create((emitter) -> {
emitValues(initMessage, emitter);
}, BackpressureStrategy.DROP);
}
MeterDevice<Object> getMeterDevice(ConnectorBase<Object> connector) {
- return new MeterDevice<Object>(() -> mock(SerialPortManager.class), "id", "port", null, 9600, 0,
- ProtocolMode.SML) {
+ return new MeterDevice<>(() -> mock(SerialPortManager.class), "id", "port", null, 9600, 0, ProtocolMode.SML) {
@Override
protected @NonNull IMeterReaderConnector<Object> createConnector(
return;
}
try {
- Dictionary<String, String> servletParams = new Hashtable<String, String>();
+ Dictionary<String, String> servletParams = new Hashtable<>();
httpService.registerServlet(PATH, this, servletParams, httpService.createDefaultHttpContext());
} catch (ServletException | NamespaceException e) {
logger.warn("Could not start Smartthings servlet service: {}", e.getMessage());
break;
case "error":
// This is an error message from smartthings
- Map<String, String> map = new HashMap<String, String>();
+ Map<String, String> map = new HashMap<>();
map = gson.fromJson(s, map.getClass());
logger.warn("Error message from Smartthings: {}", map.get("message"));
break;
}
private void publishEvent(String topic, String name, String data) {
- Dictionary<String, String> props = new Hashtable<String, String>();
+ Dictionary<String, String> props = new Hashtable<>();
props.put(name, data);
Event event = new Event(topic, props);
if (eventAdmin != null) {
@Override
public Collection<ConfigStatusMessage> getConfigStatus() {
- Collection<ConfigStatusMessage> configStatusMessages = new LinkedList<ConfigStatusMessage>();
+ Collection<ConfigStatusMessage> configStatusMessages = new LinkedList<>();
// The IP must be provided
String ip = config.smartthingsIp;
private String smartthingsName;
private int timeout;
private SmartthingsHandlerFactory smartthingsHandlerFactory;
- private Map<ChannelUID, SmartthingsConverter> converters = new HashMap<ChannelUID, SmartthingsConverter>();
+ private Map<ChannelUID, SmartthingsConverter> converters = new HashMap<>();
private final String smartthingsConverterName = "smartthings-converter";
@Override
public Collection<ConfigStatusMessage> getConfigStatus() {
- Collection<ConfigStatusMessage> configStatusMessages = new LinkedList<ConfigStatusMessage>();
+ Collection<ConfigStatusMessage> configStatusMessages = new LinkedList<>();
// The name must be provided
String stName = config.smartthingsName;
if (this.modem.getStatus() == Status.Started) {
try {
this.modem.getModemDriver().lock();
- ArrayList<InboundMessage> messageList = new ArrayList<InboundMessage>();
+ ArrayList<InboundMessage> messageList = new ArrayList<>();
try {
for (int i = 0; i < (this.modem.getModemDriver().getMemoryLocations().length() / 2); i++) {
String memLocation = this.modem.getModemDriver().getMemoryLocations().substring((i * 2),
private @Nullable ScheduledFuture<?> checkScheduled;
// we keep a list of msisdn sender for autodiscovery
- private Set<String> senderMsisdn = new HashSet<String>();
+ private Set<String> senderMsisdn = new HashSet<>();
private @Nullable SMSConversationDiscoveryService discoveryService;
private boolean shouldRun = false;
if (places != null && !places.isEmpty()) {
places.forEach(place -> {
// stop_point:SNCF:87386573:Bus
- List<String> idElts = new LinkedList<String>(Arrays.asList(place.id.split(":")));
+ List<String> idElts = new LinkedList<>(Arrays.asList(place.id.split(":")));
idElts.remove(0);
idElts.remove(0);
thingDiscovered(DiscoveryResultBuilder
@Test
public void testForCommands() throws UnknownHostException, SolarMaxException {
List<String> validCommands = new ArrayList<>();
- List<String> commandsToCheck = new ArrayList<String>();
+ List<String> commandsToCheck = new ArrayList<>();
List<String> failedCommands = new ArrayList<>();
int failedCommandRetry = 0;
String lastFailedCommand = "";
private boolean checkIsValidCommand(String command)
throws InterruptedException, UnknownHostException, SolarMaxException {
- List<String> commands = new ArrayList<String>();
+ List<String> commands = new ArrayList<>();
commands.add(command);
Map<String, @Nullable String> responseMap = null;
private boolean alreadyRemovedUnsupportedChannels;
- private final Set<String> unsupportedExistingChannels = new HashSet<String>();
+ private final Set<String> unsupportedExistingChannels = new HashSet<>();
private final ReentrantLock retrieveDataCallLock = new ReentrantLock();
private @Nullable ScheduledFuture<?> loginFuture;
// List of futures used for command retries
- private Collection<ScheduledFuture<?>> retryFutures = new ConcurrentLinkedQueue<ScheduledFuture<?>>();
+ private Collection<ScheduledFuture<?>> retryFutures = new ConcurrentLinkedQueue<>();
/**
* List of executions
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
-import javax.measure.quantity.Dimensionless;
-import javax.measure.quantity.Energy;
-import javax.measure.quantity.Power;
-
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.sonnen.internal.communication.SonnenJSONCommunication;
if (dataPM != null && dataPM.length >= 2) {
switch (channelId) {
case CHANNELENERGYIMPORTEDSTATEPRODUCTION:
- state = new QuantityType<Energy>(dataPM[0].getKwhImported(), Units.KILOWATT_HOUR);
+ state = new QuantityType<>(dataPM[0].getKwhImported(), Units.KILOWATT_HOUR);
update(state, channelId);
break;
case CHANNELENERGYEXPORTEDSTATEPRODUCTION:
- state = new QuantityType<Energy>(dataPM[0].getKwhExported(), Units.KILOWATT_HOUR);
+ state = new QuantityType<>(dataPM[0].getKwhExported(), Units.KILOWATT_HOUR);
update(state, channelId);
break;
case CHANNELENERGYIMPORTEDSTATECONSUMPTION:
- state = new QuantityType<Energy>(dataPM[1].getKwhImported(), Units.KILOWATT_HOUR);
+ state = new QuantityType<>(dataPM[1].getKwhImported(), Units.KILOWATT_HOUR);
update(state, channelId);
break;
case CHANNELENERGYEXPORTEDSTATECONSUMPTION:
- state = new QuantityType<Energy>(dataPM[1].getKwhExported(), Units.KILOWATT_HOUR);
+ state = new QuantityType<>(dataPM[1].getKwhExported(), Units.KILOWATT_HOUR);
update(state, channelId);
break;
}
update(OnOffType.from(data.isBatteryCharging()), channelId);
break;
case CHANNELCONSUMPTION:
- state = new QuantityType<Power>(data.getConsumptionHouse(), Units.WATT);
+ state = new QuantityType<>(data.getConsumptionHouse(), Units.WATT);
update(state, channelId);
break;
case CHANNELBATTERYDISCHARGING:
- state = new QuantityType<Power>(data.getbatteryCurrent() > 0 ? data.getbatteryCurrent() : 0,
+ state = new QuantityType<>(data.getbatteryCurrent() > 0 ? data.getbatteryCurrent() : 0,
Units.WATT);
update(state, channelId);
break;
case CHANNELBATTERYCHARGING:
- state = new QuantityType<Power>(
- data.getbatteryCurrent() <= 0 ? (data.getbatteryCurrent() * -1) : 0, Units.WATT);
+ state = new QuantityType<>(data.getbatteryCurrent() <= 0 ? (data.getbatteryCurrent() * -1) : 0,
+ Units.WATT);
update(state, channelId);
break;
case CHANNELGRIDFEEDIN:
- state = new QuantityType<Power>(data.getGridValue() > 0 ? data.getGridValue() : 0, Units.WATT);
+ state = new QuantityType<>(data.getGridValue() > 0 ? data.getGridValue() : 0, Units.WATT);
update(state, channelId);
break;
case CHANNELGRIDCONSUMPTION:
- state = new QuantityType<Power>(data.getGridValue() <= 0 ? (data.getGridValue() * -1) : 0,
+ state = new QuantityType<>(data.getGridValue() <= 0 ? (data.getGridValue() * -1) : 0,
Units.WATT);
update(state, channelId);
break;
case CHANNELSOLARPRODUCTION:
- state = new QuantityType<Power>(data.getSolarProduction(), Units.WATT);
+ state = new QuantityType<>(data.getSolarProduction(), Units.WATT);
update(state, channelId);
break;
case CHANNELBATTERYLEVEL:
- state = new QuantityType<Dimensionless>(data.getBatteryChargingLevel(), Units.PERCENT);
+ state = new QuantityType<>(data.getBatteryChargingLevel(), Units.PERCENT);
update(state, channelId);
break;
case CHANNELFLOWCONSUMPTIONBATTERYSTATE:
public ZonedDateTime updatedAt = ZonedDateTime.now();
public Map<String, String> getThingProperties() {
- Map<String, String> properties = new HashMap<String, String>();
+ Map<String, String> properties = new HashMap<>();
properties.put("id", id.toString());
properties.put("version", version);
properties.put("createdAt", createdAt.toString());
import java.time.format.DateTimeParseException;
import java.util.List;
-import javax.measure.quantity.Mass;
-
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.surepetcare.internal.SurePetcareAPIHelper;
import org.openhab.binding.surepetcare.internal.SurePetcareApiException;
if (bowlId == BOWL_ID_ONE_BOWL_USED) {
updateState(DEVICE_CHANNEL_BOWLS_FOOD,
new StringType(bowlSettings.get(0).foodId.toString()));
- updateState(DEVICE_CHANNEL_BOWLS_TARGET, new QuantityType<Mass>(
+ updateState(DEVICE_CHANNEL_BOWLS_TARGET, new QuantityType<>(
device.control.bowls.bowlSettings.get(0).targetId, SIUnits.GRAM));
} else if (bowlId == BOWL_ID_TWO_BOWLS_USED) {
updateState(DEVICE_CHANNEL_BOWLS_FOOD_LEFT,
new StringType(bowlSettings.get(0).foodId.toString()));
updateState(DEVICE_CHANNEL_BOWLS_TARGET_LEFT,
- new QuantityType<Mass>(bowlSettings.get(0).targetId, SIUnits.GRAM));
+ new QuantityType<>(bowlSettings.get(0).targetId, SIUnits.GRAM));
if (numBowls > 1) {
updateState(DEVICE_CHANNEL_BOWLS_FOOD_RIGHT,
new StringType(bowlSettings.get(1).foodId.toString()));
updateState(DEVICE_CHANNEL_BOWLS_TARGET_RIGHT,
- new QuantityType<Mass>(bowlSettings.get(1).targetId, SIUnits.GRAM));
+ new QuantityType<>(bowlSettings.get(1).targetId, SIUnits.GRAM));
}
}
}
import java.time.ZoneId;
import java.time.ZonedDateTime;
-import javax.measure.quantity.Mass;
-
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.surepetcare.internal.SurePetcareAPIHelper;
updateState(PET_CHANNEL_DATE_OF_BIRTH, pet.dateOfBirth == null ? UnDefType.UNDEF
: new DateTimeType(pet.dateOfBirth.atStartOfDay(ZoneId.systemDefault())));
updateState(PET_CHANNEL_WEIGHT,
- pet.weight == null ? UnDefType.UNDEF : new QuantityType<Mass>(pet.weight, SIUnits.KILOGRAM));
+ pet.weight == null ? UnDefType.UNDEF : new QuantityType<>(pet.weight, SIUnits.KILOGRAM));
if (pet.tagId != null) {
SurePetcareTag tag = petcareAPI.getTag(pet.tagId.toString());
if (tag != null) {
if (numBowls > 0) {
if (bowlId == BOWL_ID_ONE_BOWL_USED) {
updateState(PET_CHANNEL_FEEDER_LAST_CHANGE,
- new QuantityType<Mass>(feeding.feedChange.get(0), SIUnits.GRAM));
+ new QuantityType<>(feeding.feedChange.get(0), SIUnits.GRAM));
} else if (bowlId == BOWL_ID_TWO_BOWLS_USED) {
updateState(PET_CHANNEL_FEEDER_LAST_CHANGE_LEFT,
- new QuantityType<Mass>(feeding.feedChange.get(0), SIUnits.GRAM));
+ new QuantityType<>(feeding.feedChange.get(0), SIUnits.GRAM));
if (numBowls > 1) {
updateState(PET_CHANNEL_FEEDER_LAST_CHANGE_RIGHT,
- new QuantityType<Mass>(feeding.feedChange.get(1), SIUnits.GRAM));
+ new QuantityType<>(feeding.feedChange.get(1), SIUnits.GRAM));
}
}
}
import java.util.ArrayList;
-import javax.measure.quantity.Illuminance;
-import javax.measure.quantity.Temperature;
-
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.touchwand.internal.dto.TouchWandAlarmSensorCurrentStatus.BinarySensorEvent;
import org.openhab.binding.touchwand.internal.dto.TouchWandAlarmSensorCurrentStatus.Sensor;
void updateIllumination(TouchWandUnitDataAlarmSensor unitData) {
for (Sensor sensor : unitData.getCurrStatus().getSensorsStatus()) {
if (sensor.type == SENSOR_TYPE_LUMINANCE) {
- updateState(CHANNEL_ILLUMINATION, new QuantityType<Illuminance>(sensor.value, Units.LUX));
+ updateState(CHANNEL_ILLUMINATION, new QuantityType<>(sensor.value, Units.LUX));
}
}
}
void updateChannelTemperature(TouchWandUnitDataAlarmSensor unitData) {
for (Sensor sensor : unitData.getCurrStatus().getSensorsStatus()) {
if (sensor.type == SENSOR_TYPE_TEMPERATURE) {
- updateState(CHANNEL_TEMPERATURE, new QuantityType<Temperature>(sensor.value, SIUnits.CELSIUS));
+ updateState(CHANNEL_TEMPERATURE, new QuantityType<>(sensor.value, SIUnits.CELSIUS));
}
}
}
private static final int REQUEST_TIMEOUT_SEC = 10;
- private static final Map<String, String> COMMAND_MAP = new HashMap<String, String>();
+ private static final Map<String, String> COMMAND_MAP = new HashMap<>();
static {
COMMAND_MAP.put(CMD_LOGIN, "/auth/login?");
COMMAND_MAP.put(CMD_LIST_UNITS, "/units/listUnits");
void updateTargetTemperature(TouchWandThermostatUnitData unitData) {
int targetTemperature = unitData.getCurrStatus().getTargetTemperature();
- QuantityType<Temperature> temperatureValue = new QuantityType<Temperature>(targetTemperature, SIUnits.CELSIUS);
+ QuantityType<Temperature> temperatureValue = new QuantityType<>(targetTemperature, SIUnits.CELSIUS);
updateState(CHANNEL_THERMOSTAT_TARGET_TEMPERATURE, temperatureValue);
}
void updateRoomTemperature(TouchWandThermostatUnitData unitData) {
int roomTemperature = unitData.getCurrStatus().getRoomTemperature();
- QuantityType<Temperature> temperatureValue = new QuantityType<Temperature>(roomTemperature, SIUnits.CELSIUS);
+ QuantityType<Temperature> temperatureValue = new QuantityType<>(roomTemperature, SIUnits.CELSIUS);
updateState(CHANNEL_THERMOSTAT_ROOM_TEMPERATURE, temperatureValue);
}
public class TouchWandAlarmSensorCurrentStatus {
private int batt;
- private List<Sensor> sensorsStatus = new ArrayList<Sensor>();
- private List<AlarmEvent> alarmsStatus = new ArrayList<AlarmEvent>();
- private List<BinarySensorEvent> bSensorsStatus = new ArrayList<BinarySensorEvent>();
+ private List<Sensor> sensorsStatus = new ArrayList<>();
+ private List<AlarmEvent> alarmsStatus = new ArrayList<>();
+ private List<BinarySensorEvent> bSensorsStatus = new ArrayList<>();
public void setBatt(Integer batt) {
this.batt = batt;
import static org.openhab.binding.tradfri.internal.TradfriBindingConstants.*;
-import javax.measure.quantity.Dimensionless;
import javax.measure.quantity.Time;
import org.eclipse.jdt.annotation.NonNullByDefault;
if (airQuality != null) {
int pm25InPpm = airQuality.getAsInt();
if (pm25InPpm != AIR_PURIFIER_AIR_QUALITY_UNDEFINED) {
- return new QuantityType<Dimensionless>(pm25InPpm, Units.PARTS_PER_MILLION);
+ return new QuantityType<>(pm25InPpm, Units.PARTS_PER_MILLION);
} else {
return UnDefType.UNDEF;
}
JsonElement nextFilterCheckTTL = attributes.get(NEXT_FILTER_CHECK);
if (nextFilterCheckTTL != null) {
int remainingMinutes = nextFilterCheckTTL.getAsInt();
- return new QuantityType<Time>(remainingMinutes, Units.MINUTE);
+ return new QuantityType<>(remainingMinutes, Units.MINUTE);
} else {
return null;
}
JsonElement filterUptime = attributes.get(FILTER_UPTIME);
if (filterUptime != null) {
int filterUptimeMinutes = filterUptime.getAsInt();
- return new QuantityType<Time>(filterUptimeMinutes, Units.MINUTE);
+ return new QuantityType<>(filterUptimeMinutes, Units.MINUTE);
} else {
return null;
}
UpnpAudioSink audioSink = new UpnpAudioSink(handler, audioHTTPServer, callbackUrl);
@SuppressWarnings("unchecked")
ServiceRegistration<AudioSink> reg = (ServiceRegistration<AudioSink>) bundleContext
- .registerService(AudioSink.class.getName(), audioSink, new Hashtable<String, Object>());
+ .registerService(AudioSink.class.getName(), audioSink, new Hashtable<>());
Thing thing = handler.getThing();
audioSinkRegistrations.put(thing.getUID().toString(), reg);
logger.debug("Audio sink added for media renderer {}", thing.getLabel());
callbackUrl);
@SuppressWarnings("unchecked")
ServiceRegistration<AudioSink> notificationReg = (ServiceRegistration<AudioSink>) bundleContext
- .registerService(AudioSink.class.getName(), notificationAudioSink, new Hashtable<String, Object>());
+ .registerService(AudioSink.class.getName(), notificationAudioSink, new Hashtable<>());
audioSinkRegistrations.put(thing.getUID().toString() + NOTIFICATION_AUDIOSINK_EXTENSION, notificationReg);
logger.debug("Notification audio sink added for media renderer {}", thing.getLabel());
}
}
// Set new futures, so we don't try to use service when connection id's are not known yet
- isConnectionIdSet = new CompletableFuture<Boolean>();
- isAvTransportIdSet = new CompletableFuture<Boolean>();
- isRcsIdSet = new CompletableFuture<Boolean>();
+ isConnectionIdSet = new CompletableFuture<>();
+ isAvTransportIdSet = new CompletableFuture<>();
+ isRcsIdSet = new CompletableFuture<>();
- HashMap<String, String> inputs = new HashMap<String, String>();
+ HashMap<String, String> inputs = new HashMap<>();
inputs.put("RemoteProtocolInfo", remoteProtocolInfo);
inputs.put("PeerConnectionManager", peerConnectionManager);
inputs.put("PeerConnectionID", Integer.toString(peerConnectionId));
}
// Set new futures, so we don't try to use service when connection id's are not known yet
- isAvTransportIdSet = new CompletableFuture<Boolean>();
- isRcsIdSet = new CompletableFuture<Boolean>();
+ isAvTransportIdSet = new CompletableFuture<>();
+ isRcsIdSet = new CompletableFuture<>();
// ConnectionID will default to 0 if not set through prepareForConnection method
Map<String, String> inputs = Map.of(CONNECTION_ID, Integer.toString(connectionId));
if (stopping != null) {
stopping.complete(false);
}
- isStopping = new CompletableFuture<Boolean>(); // set this so we can check if stop confirmation has been
- // received
+ isStopping = new CompletableFuture<>(); // set this so we can check if stop confirmation has been
+ // received
}
Map<String, String> inputs = Map.of(INSTANCE_ID, Integer.toString(avTransportId));
if (settingURI != null) {
settingURI.complete(false);
}
- isSettingURI = new CompletableFuture<Boolean>(); // set this so we don't start playing when not finished
- // setting URI
+ isSettingURI = new CompletableFuture<>(); // set this so we don't start playing when not finished
+ // setting URI
} else {
logger.debug("New URI {} is same as previous on renderer {}", nowPlayingUri, thing.getLabel());
}
}
if (browsed) {
- isBrowsing = new CompletableFuture<Boolean>();
+ isBrowsing = new CompletableFuture<>();
Map<String, String> inputs = new HashMap<>();
inputs.put("ObjectID", objectID);
}
if (browsed) {
- isBrowsing = new CompletableFuture<Boolean>();
+ isBrowsing = new CompletableFuture<>();
Map<String, String> inputs = new HashMap<>();
inputs.put("ContainerID", containerID);
updateTitleSelection(removeDuplicates(list));
}
} else {
- updateTitleSelection(new ArrayList<UpnpEntry>());
+ updateTitleSelection(new ArrayList<>());
}
browseUp = false;
if (browsing != null) {
}
// Shuffle the queue again
- shuffledQueue = new ArrayList<UpnpEntry>(currentQueue);
+ shuffledQueue = new ArrayList<>(currentQueue);
Collections.shuffle(shuffledQueue);
if (current != null) {
// Put the current entry at the beginning of the shuffled queue
mute = (rcService.getStateVariable("Mute") != null);
loudness = (rcService.getStateVariable("Loudness") != null);
if (rcService.getStateVariable("A_ARG_TYPE_Channel") != null) {
- audioChannels = new HashSet<String>(Arrays
+ audioChannels = new HashSet<>(Arrays
.asList(rcService.getStateVariable("A_ARG_TYPE_Channel").getTypeDetails().getAllowedValues()));
}
}
private static class AVTransportEventHandler extends DefaultHandler {
- private final Map<String, String> changes = new HashMap<String, String>();
+ private final Map<String, String> changes = new HashMap<>();
AVTransportEventHandler() {
// shouldn't be used outside of this package.
// Maintain a set of elements it is not useful to complain about.
// This list will be initialized on the first failure case.
- private static List<String> ignore = new ArrayList<String>();
+ private static List<String> ignore = new ArrayList<>();
private String id = "";
private String refId = "";
// Register a media queue
expectLastChangeOnSetAVTransportURI(true, 2);
- List<UpnpEntry> startList = new ArrayList<UpnpEntry>();
+ List<UpnpEntry> startList = new ArrayList<>();
startList.add(requireNonNull(upnpEntryQueue.get(2)));
UpnpEntryQueue startQueue = new UpnpEntryQueue(startList, "54321");
handler.registerQueue(requireNonNull(startQueue));
@NonNullByDefault
public class SVDRPTimerList {
- private List<String> timers = new ArrayList<String>();
+ private List<String> timers = new ArrayList<>();
/**
* parse object from SVDRP Client Response
*/
public static SVDRPTimerList parse(String message) {
SVDRPTimerList timers = new SVDRPTimerList();
- List<String> lines = new ArrayList<String>();
+ List<String> lines = new ArrayList<>();
StringTokenizer st = new StringTokenizer(message, System.lineSeparator());
while (st.hasMoreTokens()) {
public InputStream inputStream;
- private ArrayList<Byte> currentData = new ArrayList<Byte>();
+ private ArrayList<Byte> currentData = new ArrayList<>();
private @Nullable Byte currentSTX = null;
private @Nullable Byte currentPriority = null;
private @Nullable Byte currentAddress = null;
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = new HashSet<>(Arrays.asList(THING_TYPE_VMB2PBN,
THING_TYPE_VMB6PBN, THING_TYPE_VMB8PBU, THING_TYPE_VMBPIRC, THING_TYPE_VMBPIRM, THING_TYPE_VMBRFR8S,
THING_TYPE_VMBVP1, THING_TYPE_VMBKP, THING_TYPE_VMBIN, THING_TYPE_VMB4PB));
- private static final HashMap<ThingTypeUID, Integer> ALARM_CONFIGURATION_MEMORY_ADDRESSES = new HashMap<ThingTypeUID, Integer>();
+ private static final HashMap<ThingTypeUID, Integer> ALARM_CONFIGURATION_MEMORY_ADDRESSES = new HashMap<>();
static {
ALARM_CONFIGURATION_MEMORY_ADDRESSES.put(THING_TYPE_VMB2PBN, 0x0093);
/**
* The ascending sorted list of generic Objects indexed by an Integer
*/
- private SortedMap<Integer, String> mapAscending = new TreeMap<>(new Comparator<Integer>() {
+ private SortedMap<Integer, String> mapAscending = new TreeMap<>(new Comparator<>() {
@Override
public int compare(Integer o1, Integer o2) {
return o1.compareTo(o2);
/**
* The descending sorted list of generic Objects indexed by an Integer
*/
- private SortedMap<Integer, String> mapDescending = new TreeMap<>(new Comparator<Integer>() {
+ private SortedMap<Integer, String> mapDescending = new TreeMap<>(new Comparator<>() {
@Override
public int compare(Integer o1, Integer o2) {
return o2.compareTo(o1);
import javax.measure.Quantity;
import javax.measure.Unit;
-import javax.measure.quantity.Dimensionless;
import javax.measure.quantity.Temperature;
import org.eclipse.jdt.annotation.NonNullByDefault;
Optional<VenstarSensor> optSensor = sensorData.stream()
.filter(sensor -> "Thermostat".equalsIgnoreCase(sensor.getName())).findAny();
if (optSensor.isPresent()) {
- return new QuantityType<Temperature>(optSensor.get().getTemp(), unitSystem);
+ return new QuantityType<>(optSensor.get().getTemp(), unitSystem);
}
return UnDefType.UNDEF;
Optional<VenstarSensor> optSensor = sensorData.stream()
.filter(sensor -> "Thermostat".equalsIgnoreCase(sensor.getName())).findAny();
if (optSensor.isPresent()) {
- return new QuantityType<Dimensionless>(optSensor.get().getHum(), Units.PERCENT);
+ return new QuantityType<>(optSensor.get().getHum(), Units.PERCENT);
}
return UnDefType.UNDEF;
Optional<VenstarSensor> optSensor = sensorData.stream()
.filter(sensor -> "Outdoor".equalsIgnoreCase(sensor.getName())).findAny();
if (optSensor.isPresent()) {
- return new QuantityType<Temperature>(optSensor.get().getTemp(), unitSystem);
+ return new QuantityType<>(optSensor.get().getTemp(), unitSystem);
}
return UnDefType.UNDEF;
}
private QuantityType<Temperature> getCoolingSetpoint() {
- return new QuantityType<Temperature>(infoData.getCooltemp(), unitSystem);
+ return new QuantityType<>(infoData.getCooltemp(), unitSystem);
}
private QuantityType<Temperature> getHeatingSetpoint() {
- return new QuantityType<Temperature>(infoData.getHeattemp(), unitSystem);
+ return new QuantityType<>(infoData.getHeattemp(), unitSystem);
}
private ZonedDateTime getTimestampRuntime(VenstarRuntime runtime) {
if (command instanceof QuantityType) {
return (QuantityType<U>) command;
}
- return new QuantityType<U>(new BigDecimal(command.toString()), defaultUnit);
+ return new QuantityType<>(new BigDecimal(command.toString()), defaultUnit);
}
protected DecimalType commandToDecimalType(Command command) {
int discReplaceHours = info.getDiscIonT() * 5 / 60;
int cleaningHours = info.getCleaningT() * 5 / 60;
- QuantityType<Time> opHoursState = new QuantityType<Time>(opHours, Units.HOUR);
+ QuantityType<Time> opHoursState = new QuantityType<>(opHours, Units.HOUR);
updateState(VentaAirBindingConstants.CHANNEL_OPERATION_TIME, opHoursState);
channelValueCache.put(VentaAirBindingConstants.CHANNEL_OPERATION_TIME, opHoursState);
- QuantityType<Time> discReplaceHoursState = new QuantityType<Time>(2200 - discReplaceHours, Units.HOUR);
+ QuantityType<Time> discReplaceHoursState = new QuantityType<>(2200 - discReplaceHours, Units.HOUR);
updateState(VentaAirBindingConstants.CHANNEL_DISC_REPLACE_TIME, discReplaceHoursState);
channelValueCache.put(VentaAirBindingConstants.CHANNEL_DISC_REPLACE_TIME, discReplaceHoursState);
- QuantityType<Time> cleaningHoursState = new QuantityType<Time>(4400 - cleaningHours, Units.HOUR);
+ QuantityType<Time> cleaningHoursState = new QuantityType<>(4400 - cleaningHours, Units.HOUR);
updateState(VentaAirBindingConstants.CHANNEL_CLEANING_TIME, cleaningHoursState);
channelValueCache.put(VentaAirBindingConstants.CHANNEL_CLEANING_TIME, cleaningHoursState);
updateState(VentaAirBindingConstants.CHANNEL_CLEAN_MODE, cleanModeState);
channelValueCache.put(VentaAirBindingConstants.CHANNEL_CLEAN_MODE, cleanModeState);
- QuantityType<Time> timerTimePassedState = new QuantityType<Time>(info.getTimerT(), Units.MINUTE);
+ QuantityType<Time> timerTimePassedState = new QuantityType<>(info.getTimerT(), Units.MINUTE);
updateState(VentaAirBindingConstants.CHANNEL_TIMER_TIME_PASSED, timerTimePassedState);
channelValueCache.put(VentaAirBindingConstants.CHANNEL_TIMER_TIME_PASSED, timerTimePassedState);
- QuantityType<Time> serviceTimeState = new QuantityType<Time>(info.getServiceT(), Units.MINUTE);
+ QuantityType<Time> serviceTimeState = new QuantityType<>(info.getServiceT(), Units.MINUTE);
updateState(VentaAirBindingConstants.CHANNEL_SERVICE_TIME, serviceTimeState);
channelValueCache.put(VentaAirBindingConstants.CHANNEL_SERVICE_TIME, serviceTimeState);
@Component(service = ThingHandlerFactory.class, configurationPid = "binding.verisure")
public class VerisureHandlerFactory extends BaseThingHandlerFactory {
- public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = new HashSet<ThingTypeUID>();
+ public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = new HashSet<>();
static {
SUPPORTED_THING_TYPES.addAll(VerisureBridgeHandler.SUPPORTED_THING_TYPES);
SUPPORTED_THING_TYPES.addAll(VerisureAlarmThingHandler.SUPPORTED_THING_TYPES);
import java.util.List;
import java.util.Set;
-import javax.measure.quantity.Dimensionless;
-import javax.measure.quantity.Temperature;
-
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.verisure.internal.dto.VerisureBatteryStatusDTO;
import org.openhab.binding.verisure.internal.dto.VerisureClimatesDTO;
@NonNullByDefault
public class VerisureClimateDeviceThingHandler extends VerisureThingHandler<VerisureClimatesDTO> {
- public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = new HashSet<ThingTypeUID>();
+ public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = new HashSet<>();
static {
SUPPORTED_THING_TYPES.add(THING_TYPE_SMOKEDETECTOR);
SUPPORTED_THING_TYPES.add(THING_TYPE_WATERDETECTOR);
case CHANNEL_TEMPERATURE:
if (climateList != null && !climateList.isEmpty()) {
double temperature = climateList.get(0).getTemperatureValue();
- return new QuantityType<Temperature>(temperature, SIUnits.CELSIUS);
+ return new QuantityType<>(temperature, SIUnits.CELSIUS);
}
case CHANNEL_HUMIDITY:
if (climateList != null && !climateList.isEmpty() && climateList.get(0).isHumidityEnabled()) {
double humidity = climateList.get(0).getHumidityValue();
- return new QuantityType<Dimensionless>(humidity, Units.PERCENT);
+ return new QuantityType<>(humidity, Units.PERCENT);
}
case CHANNEL_HUMIDITY_ENABLED:
if (climateList != null && !climateList.isEmpty()) {
import java.util.List;
import java.util.Set;
-import javax.measure.quantity.Temperature;
-import javax.measure.quantity.Time;
-
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.verisure.internal.dto.VerisureMiceDetectionDTO;
import org.openhab.binding.verisure.internal.dto.VerisureMiceDetectionDTO.Detection;
}
case CHANNEL_DURATION_LATEST_DETECTION:
if (mouse.getDetections().isEmpty()) {
- return new QuantityType<Time>(0, Units.SECOND);
+ return new QuantityType<>(0, Units.SECOND);
} else {
- return new QuantityType<Time>(mouse.getDetections().get(0).getDuration(), Units.SECOND);
+ return new QuantityType<>(mouse.getDetections().get(0).getDuration(), Units.SECOND);
}
case CHANNEL_DURATION_LAST_24_HOURS:
if (mouse.getDetections().isEmpty()) {
- return new QuantityType<Time>(0, Units.SECOND);
+ return new QuantityType<>(0, Units.SECOND);
} else {
- return new QuantityType<Time>(mouse.getDetections().stream().mapToInt(Detection::getDuration).sum(),
+ return new QuantityType<>(mouse.getDetections().stream().mapToInt(Detection::getDuration).sum(),
Units.SECOND);
}
case CHANNEL_LOCATION:
case CHANNEL_TEMPERATURE:
double temperature = miceDetectionJSON.getTemperatureValue();
return temperature != VerisureMiceDetectionDTO.UNDEFINED
- ? new QuantityType<Temperature>(temperature, SIUnits.CELSIUS)
+ ? new QuantityType<>(temperature, SIUnits.CELSIUS)
: UnDefType.UNDEF;
}
return UnDefType.UNDEF;
*/
public class VizioApps {
@SerializedName("Apps")
- private List<VizioApp> apps = new ArrayList<VizioApp>();
+ private List<VizioApp> apps = new ArrayList<>();
public List<VizioApp> getApps() {
return apps;
@SerializedName("STATUS")
private Status status;
@SerializedName("HASHLIST")
- private List<Long> hashlist = new ArrayList<Long>();
+ private List<Long> hashlist = new ArrayList<>();
@SerializedName("GROUP")
private String group;
@SerializedName("NAME")
@SerializedName("PARAMETERS")
private Parameters parameters;
@SerializedName("ITEMS")
- private List<ItemAudio> items = new ArrayList<ItemAudio>();
+ private List<ItemAudio> items = new ArrayList<>();
@SerializedName("URI")
private String uri;
@SerializedName("CNAME")
@SerializedName("STATUS")
private Status status;
@SerializedName("ITEMS")
- private List<ItemInput> items = new ArrayList<ItemInput>();
+ private List<ItemInput> items = new ArrayList<>();
@SerializedName("HASHLIST")
- private List<Long> hashlist = new ArrayList<Long>();
+ private List<Long> hashlist = new ArrayList<>();
@SerializedName("URI")
private String uri;
@SerializedName("PARAMETERS")
@SerializedName("STATUS")
private Status status;
@SerializedName("HASHLIST")
- private List<Long> hashlist = new ArrayList<Long>();
+ private List<Long> hashlist = new ArrayList<>();
@SerializedName("GROUP")
private String group;
@SerializedName("NAME")
@SerializedName("PARAMETERS")
private Parameters parameters;
@SerializedName("ITEMS")
- private List<Item> items = new ArrayList<Item>();
+ private List<Item> items = new ArrayList<>();
@SerializedName("URI")
private String uri;
@SerializedName("CNAME")
@SerializedName("STATUS")
private Status status;
@SerializedName("ITEMS")
- private List<ItemPower> items = new ArrayList<ItemPower>();
+ private List<ItemPower> items = new ArrayList<>();
@SerializedName("URI")
private String uri;
private @Nullable ScheduledFuture<?> metadataRefreshJob;
private VizioCommunicator communicator;
- private List<VizioApp> userConfigApps = new ArrayList<VizioApp>();
+ private List<VizioApp> userConfigApps = new ArrayList<>();
private Object sequenceLock = new Object();
private int pairingDeviceId = -1;
@Override
public void refresh(@Nullable QueryResponseDTO domain) {
if (domain != null) {
- HashSet<ThingUID> discoveredThings = new HashSet<ThingUID>();
+ HashSet<ThingUID> discoveredThings = new HashSet<>();
for (LocationDTO location : domain.getData().getUser().getLocations()) {
for (RoomDTO room : location.getRooms()) {
discoverRoom(location, room, discoveredThings);
@NonNullByDefault
public class WemoPowerBank {
- private final Deque<CacheItem> slidingCache = new ConcurrentLinkedDeque<CacheItem>();
+ private final Deque<CacheItem> slidingCache = new ConcurrentLinkedDeque<>();
@Nullable
private QuantityType<?> previousCurrentPower = null;
}
private static Map<String, String> buildBuiltinXMLEntityMap() {
- Map<String, String> entities = new HashMap<String, String>(10);
+ Map<String, String> entities = new HashMap<>(10);
entities.put("lt", "<");
entities.put("gt", ">");
entities.put("amp", "&");
protected WemoHttpCall wemoHttpCaller;
private @Nullable String host;
- private Map<String, Instant> subscriptions = new ConcurrentHashMap<String, Instant>();
+ private Map<String, Instant> subscriptions = new ConcurrentHashMap<>();
public WemoBaseThingHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpCaller) {
super(thing);
private int scanForPort(String host) {
Integer portFromService = getPortFromService();
- List<Integer> portsToCheck = new ArrayList<Integer>(PORT_RANGE_END - PORT_RANGE_START + 1);
+ List<Integer> portsToCheck = new ArrayList<>(PORT_RANGE_END - PORT_RANGE_START + 1);
Stream<Integer> portRange = IntStream.rangeClosed(PORT_RANGE_START, PORT_RANGE_END).boxed();
if (portFromService != null) {
portsToCheck.add(portFromService);
public class WemoInsightHandler extends WemoHandler {
private final Logger logger = LoggerFactory.getLogger(WemoInsightHandler.class);
- private final Map<String, String> stateMap = new ConcurrentHashMap<String, String>();
+ private final Map<String, String> stateMap = new ConcurrentHashMap<>();
private WemoPowerBank wemoPowerBank = new WemoPowerBank();
private int currentPowerSlidingSeconds;
public class WemoMotionHandler extends WemoHandler {
private final Logger logger = LoggerFactory.getLogger(WemoMotionHandler.class);
- private final Map<String, String> stateMap = new ConcurrentHashMap<String, String>();
+ private final Map<String, String> stateMap = new ConcurrentHashMap<>();
public WemoMotionHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpCaller) {
super(thing, upnpIOService, wemoHttpCaller);
public class WemoSwitchHandler extends WemoHandler {
private final Logger logger = LoggerFactory.getLogger(WemoSwitchHandler.class);
- private final Map<String, String> stateMap = new ConcurrentHashMap<String, String>();
+ private final Map<String, String> stateMap = new ConcurrentHashMap<>();
public WemoSwitchHandler(Thing thing, UpnpIOService upnpIOService, WemoHttpCall wemoHttpCaller) {
super(thing, upnpIOService, wemoHttpCaller);
@Component(configurationPid = "binding.wlanthermo", service = ThingHandlerFactory.class)
public class WlanThermoHandlerFactory 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<>(
Arrays.asList(WlanThermoBindingConstants.THING_TYPE_WLANTHERMO_NANO_V1,
WlanThermoBindingConstants.THING_TYPE_WLANTHERMO_MINI,
WlanThermoBindingConstants.THING_TYPE_WLANTHERMO_ESP32));
@SerializedName("type")
@Expose
- private List<String> type = new ArrayList<String>();
+ private List<String> type = new ArrayList<>();
@SerializedName("pm")
@Expose
- private List<Pm> pm = new ArrayList<Pm>();
+ private List<Pm> pm = new ArrayList<>();
/**
* No args constructor for use in serialization
public Integer service;
@SerializedName("services")
@Expose
- public List<String> services = new ArrayList<String>();
+ public List<String> services = new ArrayList<>();
}
@SerializedName("fcm")
@Expose
- public List<Object> fcm = new ArrayList<Object>();
+ public List<Object> fcm = new ArrayList<>();
@SerializedName("ext")
@Expose
public Ext ext;
public System system;
@SerializedName("hardware")
@Expose
- public List<String> hardware = new ArrayList<String>();
+ public List<String> hardware = new ArrayList<>();
@SerializedName("api")
@Expose
public Api api;
@SerializedName("sensors")
@Expose
- public List<String> sensors = new ArrayList<String>();
+ public List<String> sensors = new ArrayList<>();
@SerializedName("pid")
@Expose
- public List<Pid> pid = new ArrayList<Pid>();
+ public List<Pid> pid = new ArrayList<>();
@SerializedName("aktor")
@Expose
- public List<String> aktor = new ArrayList<String>();
+ public List<String> aktor = new ArrayList<>();
@SerializedName("iot")
@Expose
public Iot iot;
public class WLedBridgeHandler extends BaseBridgeHandler {
private final Logger logger = LoggerFactory.getLogger(getClass());
public final WledDynamicStateDescriptionProvider stateDescriptionProvider;
- private Map<Integer, WLedSegmentHandler> segmentHandlers = new HashMap<Integer, WLedSegmentHandler>();
+ private Map<Integer, WLedSegmentHandler> segmentHandlers = new HashMap<>();
private WledApiFactory apiFactory;
public boolean hasWhite = false;
public @Nullable WledApi api;
public static final String CONFIG_SYSTEM_ID = "systemId";
public static final String CONFIG_UNIT_ID = "unitId";
- public static final List<SubMenuEntryWithMenuItemTabView> EMPTY_UNITS = Collections
- .<SubMenuEntryWithMenuItemTabView> emptyList();
- public static final List<GetSystemListDTO> EMPTY_SYSTEMS = Collections.<GetSystemListDTO> emptyList();
+ public static final List<SubMenuEntryWithMenuItemTabView> EMPTY_UNITS = Collections.emptyList();
+ public static final List<GetSystemListDTO> EMPTY_SYSTEMS = Collections.emptyList();
}
private String getSystemDescriptionString(Integer systemId, Integer gatewayId) {
String resp = "";
try {
- Map<String, String> params = new HashMap<String, String>();
+ Map<String, String> params = new HashMap<>();
params.put("SystemId", systemId.toString());
params.put("GatewayId", gatewayId.toString());
resp = requestGET("api/portal/GetGuiDescriptionForGateway", params).get();
}
private CompletableFuture<String> requestGET(String url) throws WolfSmartsetCloudException {
- return requestGET(url, new HashMap<String, String>());
+ return requestGET(url, new HashMap<>());
}
private CompletableFuture<String> requestGET(String url, Map<String, String> params)
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
-import javax.measure.quantity.Time;
-
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.zoneminder.internal.action.ZmActions;
new DateTimeType(ZonedDateTime.ofInstant(event.getEnd().toInstant(), timeZoneProvider.getTimeZone())));
updateChannelState(CHANNEL_EVENT_FRAMES, new DecimalType(event.getFrames()));
updateChannelState(CHANNEL_EVENT_ALARM_FRAMES, new DecimalType(event.getAlarmFrames()));
- updateChannelState(CHANNEL_EVENT_LENGTH, new QuantityType<Time>(event.getLength(), Units.SECOND));
+ updateChannelState(CHANNEL_EVENT_LENGTH, new QuantityType<>(event.getLength(), Units.SECOND));
}
private void clearEventChannels() {
this.instance = instance;
this.applyUpdatesDebouncer = new Debouncer("update-homekit-devices-" + instance, scheduler,
Duration.ofMillis(1000), Clock.systemUTC(), this::applyUpdates);
- metadataChangeListener = new RegistryChangeListener<Metadata>() {
+ metadataChangeListener = new RegistryChangeListener<>() {
@Override
public void added(final Metadata metadata) {
final MetadataKey uid = metadata.getUID();
public static final String METADATA_KEY = "homekit"; // prefix for HomeKit meta information in items.xml
/** List of mandatory attributes for each accessory type. **/
- private static final Map<HomekitAccessoryType, HomekitCharacteristicType[]> MANDATORY_CHARACTERISTICS = new HashMap<HomekitAccessoryType, HomekitCharacteristicType[]>() {
+ private static final Map<HomekitAccessoryType, HomekitCharacteristicType[]> MANDATORY_CHARACTERISTICS = new HashMap<>() {
{
put(ACCESSORY_GROUP, new HomekitCharacteristicType[] {});
put(LEAK_SENSOR, new HomekitCharacteristicType[] { LEAK_DETECTED_STATE });
};
/** List of service implementation for each accessory type. **/
- private static final Map<HomekitAccessoryType, Class<? extends AbstractHomekitAccessoryImpl>> SERVICE_IMPL_MAP = new HashMap<HomekitAccessoryType, Class<? extends AbstractHomekitAccessoryImpl>>() {
+ private static final Map<HomekitAccessoryType, Class<? extends AbstractHomekitAccessoryImpl>> SERVICE_IMPL_MAP = new HashMap<>() {
{
put(ACCESSORY_GROUP, HomekitAccessoryGroupImpl.class);
put(LEAK_SENSOR, HomekitLeakSensorImpl.class);
private static final Logger LOGGER = LoggerFactory.getLogger(HomekitCharacteristicFactory.class);
// List of optional characteristics and corresponding method to create them.
- private static final Map<HomekitCharacteristicType, BiFunction<HomekitTaggedItem, HomekitAccessoryUpdater, Characteristic>> OPTIONAL = new HashMap<HomekitCharacteristicType, BiFunction<HomekitTaggedItem, HomekitAccessoryUpdater, Characteristic>>() {
+ private static final Map<HomekitCharacteristicType, BiFunction<HomekitTaggedItem, HomekitAccessoryUpdater, Characteristic>> OPTIONAL = new HashMap<>() {
{
put(NAME, HomekitCharacteristicFactory::createNameCharacteristic);
put(BATTERY_LOW_STATUS, HomekitCharacteristicFactory::createStatusLowBatteryCharacteristic);
public static final String CONFIG_DEFAULT_DURATION = "homekitDefaultDuration";
private static final String CONFIG_TIMER = "homekitTimer";
- private static final Map<String, ValveTypeEnum> CONFIG_VALVE_TYPE_MAPPING = new HashMap<String, ValveTypeEnum>() {
+ private static final Map<String, ValveTypeEnum> CONFIG_VALVE_TYPE_MAPPING = new HashMap<>() {
{
put("GENERIC", ValveTypeEnum.GENERIC);
put("IRRIGATION", ValveTypeEnum.IRRIGATION);
private static final String ENTITY_LOGGER_PROPERTY = LoggingFilter.class.getName() + ".entityLogger";
private static final String LOGGING_ID_PROPERTY = LoggingFilter.class.getName() + ".id";
- private static final Comparator<Map.Entry<String, List<String>>> COMPARATOR = new Comparator<Map.Entry<String, List<String>>>() {
+ private static final Comparator<Map.Entry<String, List<String>>> COMPARATOR = new Comparator<>() {
@Override
public int compare(final Map.Entry<String, List<String>> o1, final Map.Entry<String, List<String>> o2) {
}
private Set<Map.Entry<String, List<String>>> getSortedHeaders(final Set<Map.Entry<String, List<String>>> headers) {
- final TreeSet<Map.Entry<String, List<String>>> sortedHeaders = new TreeSet<Map.Entry<String, List<String>>>(
+ final TreeSet<Map.Entry<String, List<String>>> sortedHeaders = new TreeSet<>(
COMPARATOR);
sortedHeaders.addAll(headers);
return sortedHeaders;
@Override
public EnhancedType<ZonedDateTime> type() {
- return EnhancedType.<ZonedDateTime> of(ZonedDateTime.class);
+ return EnhancedType.of(ZonedDateTime.class);
}
@Override
@Override
public EnhancedType<ZonedDateTime> type() {
- return EnhancedType.<ZonedDateTime> of(ZonedDateTime.class);
+ return EnhancedType.of(ZonedDateTime.class);
}
@Override
CompletableFuture<List<DynamoDBItem<?>>> itemsFuture = new CompletableFuture<>();
final SdkPublisher<? extends DynamoDBItem<?>> itemPublisher = table.query(queryExpression).items();
- Subscriber<DynamoDBItem<?>> pageSubscriber = new PageOfInterestSubscriber<DynamoDBItem<?>>(itemsFuture,
+ Subscriber<DynamoDBItem<?>> pageSubscriber = new PageOfInterestSubscriber<>(itemsFuture,
filter.getPageNumber(), filter.getPageSize());
itemPublisher.subscribe(pageSubscriber);
// NumberItem.getUnit() is expensive, we avoid calling it in the loop
@Override
public TableCreatingPutItem<? extends DynamoDBItem<?>> visit(
DynamoDBBigDecimalItem dynamoBigDecimalItem) {
- return new TableCreatingPutItem<DynamoDBBigDecimalItem>(DynamoDBPersistenceService.this,
- dynamoBigDecimalItem, getTable(DynamoDBBigDecimalItem.class));
+ return new TableCreatingPutItem<>(DynamoDBPersistenceService.this, dynamoBigDecimalItem,
+ getTable(DynamoDBBigDecimalItem.class));
}
@Override
public TableCreatingPutItem<? extends DynamoDBItem<?>> visit(DynamoDBStringItem dynamoStringItem) {
- return new TableCreatingPutItem<DynamoDBStringItem>(DynamoDBPersistenceService.this,
- dynamoStringItem, getTable(DynamoDBStringItem.class));
+ return new TableCreatingPutItem<>(DynamoDBPersistenceService.this, dynamoStringItem,
+ getTable(DynamoDBStringItem.class));
}
}).putItemAsync();
}, executor).exceptionally(e -> {
*/
private String getTableNameAccordingToLegacySchema(DynamoDBItem<?> item) {
// Use the visitor pattern to deduce the table name
- return item.accept(new DynamoDBItemVisitor<String>() {
+ return item.accept(new DynamoDBItemVisitor<>() {
@Override
public String visit(DynamoDBBigDecimalItem dynamoBigDecimalItem) {
private final DynamoDBPersistenceService service;
private T dto;
private DynamoDbAsyncTable<T> table;
- private CompletableFuture<Void> aggregateFuture = new CompletableFuture<Void>();
+ private CompletableFuture<Void> aggregateFuture = new CompletableFuture<>();
private Instant start = Instant.now();
private ExecutorService executor;
private DynamoDbAsyncClient lowLevelClient;
initialized = false;
}
- List<ItemsVO> itemIdTableNames = ifItemsTableExists() ? getItemIDTableNames() : new ArrayList<ItemsVO>();
+ List<ItemsVO> itemIdTableNames = ifItemsTableExists() ? getItemIDTableNames() : new ArrayList<>();
var itemTables = getItemTables().stream().map(ItemsVO::getTableName).collect(Collectors.toList());
List<ItemVO> oldNewTableNames;
itemIdToItemNameMap.put(1, "First");
itemIdToItemNameMap.put(3, "Third");
- List<String> itemTables = new ArrayList<String>(3);
+ List<String> itemTables = new ArrayList<>(3);
itemTables.add("Item1");
itemTables.add("Item2");
itemTables.add("Item3");
itemIdToItemNameMap.put(2, "Second");
itemIdToItemNameMap.put(3, "Third");
- List<String> itemTables = new ArrayList<String>(3);
+ List<String> itemTables = new ArrayList<>(3);
itemTables.add("Item1");
itemTables.add("Item002");
itemTables.add("third_0003");
itemIdToItemNameMap.put(2, "Second");
itemIdToItemNameMap.put(3, "Third");
- List<String> itemTables = new ArrayList<String>(3);
+ List<String> itemTables = new ArrayList<>(3);
itemTables.add("Item1");
itemTables.add("Item002");
itemTables.add("third_0003");
itemIdToItemNameMap.put(1, "MyItem");
itemIdToItemNameMap.put(2, "myItem");
- List<String> itemTables = new ArrayList<String>(2);
+ List<String> itemTables = new ArrayList<>(2);
itemTables.add("MyItem");
itemTables.add("myItem");
itemIdToItemNameMap.put(1, "MyItem");
itemIdToItemNameMap.put(2, "myItem");
- List<String> itemTables = new ArrayList<String>(2);
+ List<String> itemTables = new ArrayList<>(2);
itemTables.add("Item1");
itemTables.add("Item2");
itemIdToItemNameMap.put(1, "MyItem");
itemIdToItemNameMap.put(2, "myItem");
- List<String> itemTables = new ArrayList<String>(2);
+ List<String> itemTables = new ArrayList<>(2);
itemTables.add("Item1");
itemTables.add("Item2");
itemIdToItemNameMap.put(1, "Item2");
itemIdToItemNameMap.put(2, "Item1");
- List<String> itemTables = new ArrayList<String>(2);
+ List<String> itemTables = new ArrayList<>(2);
itemTables.add("Item2");
itemTables.add("Item1");
}
private List<String> getItemTables(String tableName) {
- List<String> itemTables = new ArrayList<String>(1);
+ List<String> itemTables = new ArrayList<>(1);
itemTables.add(tableName);
return itemTables;
}
@SuppressWarnings("null")
private Optional<MapDbItem> deserialize(String json) {
- MapDbItem item = mapper.<MapDbItem> fromJson(json, MapDbItem.class);
+ MapDbItem item = mapper.fromJson(json, MapDbItem.class);
if (item == null || !item.isValid()) {
logger.warn("Deserialized invalid item: {}", item);
return Optional.empty();
@Override
public Set<AudioFormat> getSupportedFormats() {
- return Set.<AudioFormat> of(AUDIO_FORMAT);
+ return Set.of(AUDIO_FORMAT);
}
/**
List<ChannelDefinition> channelDefinitions = thingType.getChannelDefinitions();
assertNotNull(channelDefinitions);
- List<Channel> channels = new ArrayList<Channel>();
+ List<Channel> channels = new ArrayList<>();
for (ChannelDefinition channelDefinition : channelDefinitions) {
ChannelTypeUID channelTypeUid = channelDefinition.getChannelTypeUID();
assertNotNull(channelTypeUid);
assertNull(bits);
assertNull(registers);
assertNotNull(error);
- AsyncModbusFailure<ModbusReadRequestBlueprint> result = new AsyncModbusFailure<ModbusReadRequestBlueprint>(
- request, error);
+ AsyncModbusFailure<ModbusReadRequestBlueprint> result = new AsyncModbusFailure<>(request, error);
dataHandler.handleReadError(result);
}
return dataHandler;
dataHandler.handleCommand(new ChannelUID(dataHandler.getThing().getUID(), channel), command);
if (error != null) {
- dataHandler.handleReadError(new AsyncModbusFailure<ModbusReadRequestBlueprint>(request, error));
+ dataHandler.handleReadError(new AsyncModbusFailure<>(request, error));
} else {
ModbusResponse resp = new ModbusResponse() {
assertThat(poller.getStatusInfo().toString(), poller.getStatus(), is(equalTo(ThingStatus.ONLINE)));
verifyEndpointBasicInitInteraction();
- verify(mockedModbusManager).newModbusCommunicationInterface(argThat(new TypeSafeMatcher<ModbusSlaveEndpoint>() {
+ verify(mockedModbusManager).newModbusCommunicationInterface(argThat(new TypeSafeMatcher<>() {
@Override
public void describeTo(Description description) {
}
}), any());
- verify(comms).registerRegularPoll(argThat(new TypeSafeMatcher<ModbusReadRequestBlueprint>() {
+ verify(comms).registerRegularPoll(argThat(new TypeSafeMatcher<>() {
@Override
public void describeTo(Description description) {
// verify registration
final AtomicReference<ModbusReadCallback> callbackRef = new AtomicReference<>();
- verify(mockedModbusManager).newModbusCommunicationInterface(argThat(new TypeSafeMatcher<ModbusSlaveEndpoint>() {
+ verify(mockedModbusManager).newModbusCommunicationInterface(argThat(new TypeSafeMatcher<>() {
@Override
public void describeTo(Description description) {
return checkEndpoint(endpoint);
}
}), any());
- verify(comms).registerRegularPoll(argThat(new TypeSafeMatcher<ModbusReadRequestBlueprint>() {
+ verify(comms).registerRegularPoll(argThat(new TypeSafeMatcher<>() {
@Override
public void describeTo(Description description) {
protected boolean matchesSafely(ModbusReadRequestBlueprint request) {
return checkRequest(request, ModbusReadFunctionCode.READ_COILS);
}
- }), eq(150l), eq(0L), argThat(new TypeSafeMatcher<ModbusReadCallback>() {
+ }), eq(150l), eq(0L), argThat(new TypeSafeMatcher<>() {
@Override
public void describeTo(Description description) {
ModbusDataThingHandler child1 = Mockito.mock(ModbusDataThingHandler.class);
ModbusDataThingHandler child2 = Mockito.mock(ModbusDataThingHandler.class);
- AsyncModbusFailure<ModbusReadRequestBlueprint> result = new AsyncModbusFailure<ModbusReadRequestBlueprint>(
- request, error);
+ AsyncModbusFailure<ModbusReadRequestBlueprint> result = new AsyncModbusFailure<>(request, error);
// has one data child
thingHandler.childHandlerInitialized(child1, Mockito.mock(Thing.class));
ModbusRegisterArray registers = Mockito.mock(ModbusRegisterArray.class);
Exception error = Mockito.mock(Exception.class);
AsyncModbusReadResult registersResult = new AsyncModbusReadResult(request, registers);
- AsyncModbusFailure<ModbusReadRequestBlueprint> errorResult = new AsyncModbusFailure<ModbusReadRequestBlueprint>(
- request2, error);
+ AsyncModbusFailure<ModbusReadRequestBlueprint> errorResult = new AsyncModbusFailure<>(request2, error);
pollerReadCallback.handle(registersResult);