nul annotations, checkstyle, forbidden packagel (#13981)

Signed-off-by: lsiepel <leosiepel@gmail.com>
This commit is contained in:
lsiepel 2022-12-20 00:04:43 +01:00 committed by GitHub
parent 40b8b77840
commit 1519cb4b1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 34 deletions

View File

@ -39,7 +39,7 @@ import org.slf4j.LoggerFactory;
* @author Kai Kreuzer - Added Airthings Wave Mini support
*/
@NonNullByDefault
abstract public class AbstractAirthingsHandler extends BeaconBluetoothHandler {
public abstract class AbstractAirthingsHandler extends BeaconBluetoothHandler {
private static final int CHECK_PERIOD_SEC = 10;
@ -283,5 +283,5 @@ abstract public class AbstractAirthingsHandler extends BeaconBluetoothHandler {
*
* @param is the content of the bluetooth characteristic
*/
abstract protected void updateChannels(int[] is);
protected abstract void updateChannels(int[] is);
}

View File

@ -12,24 +12,12 @@
*/
package org.openhab.binding.bluetooth.airthings.internal;
import java.math.BigInteger;
import java.util.Set;
import javax.measure.Unit;
import javax.measure.quantity.Dimensionless;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.bluetooth.BluetoothBindingConstants;
import org.openhab.core.library.dimension.Density;
import org.openhab.core.library.unit.SIUnits;
import org.openhab.core.library.unit.Units;
import org.openhab.core.thing.ThingTypeUID;
import tech.units.indriya.format.SimpleUnitFormat;
import tech.units.indriya.function.MultiplyConverter;
import tech.units.indriya.unit.ProductUnit;
import tech.units.indriya.unit.TransformedUnit;
/**
* The {@link AirthingsBindingConstants} class defines common constants, which are
* used across the whole binding.
@ -60,14 +48,4 @@ public class AirthingsBindingConstants {
public static final String CHANNEL_ID_TVOC = "tvoc";
public static final String CHANNEL_ID_RADON_ST_AVG = "radon_st_avg";
public static final String CHANNEL_ID_RADON_LT_AVG = "radon_lt_avg";
public static final Unit<Dimensionless> PARTS_PER_BILLION = new TransformedUnit<>(Units.ONE,
MultiplyConverter.ofRational(BigInteger.ONE, BigInteger.valueOf(1000000000)));
public static final Unit<Density> BECQUEREL_PER_CUBIC_METRE = new ProductUnit<>(
Units.BECQUEREL.divide(SIUnits.CUBIC_METRE));
static {
SimpleUnitFormat.getInstance().label(PARTS_PER_BILLION, "ppb");
SimpleUnitFormat.getInstance().label(BECQUEREL_PER_CUBIC_METRE, "Bq/m³");
}
}

View File

@ -98,10 +98,7 @@ public class AirthingsDiscoveryParticipant implements BluetoothDiscoveryParticip
private boolean isAirthingsDevice(BluetoothDiscoveryDevice device) {
Integer manufacturerId = device.getManufacturerId();
if (manufacturerId != null && manufacturerId == AIRTHINGS_COMPANY_ID) {
return true;
}
return false;
return manufacturerId != null && manufacturerId == AIRTHINGS_COMPANY_ID;
}
private DiscoveryResult createResult(BluetoothDiscoveryDevice device, ThingUID thingUID, String label) {

View File

@ -87,7 +87,7 @@ public class AirthingsWaveGen1Handler extends AbstractAirthingsHandler {
logger.debug("Change next readSensor to: {}", readSensor);
logger.debug("Update channel 3");
updateState(CHANNEL_ID_RADON_ST_AVG,
QuantityType.valueOf(Double.valueOf(intResult), BECQUEREL_PER_CUBIC_METRE));
QuantityType.valueOf(Double.valueOf(intResult), Units.BECQUEREL_PER_CUBIC_METRE));
logger.debug("Update channel 3 done");
break;
case RADON_LTA:
@ -97,7 +97,7 @@ public class AirthingsWaveGen1Handler extends AbstractAirthingsHandler {
logger.debug("Change next readSensor to: {}", readSensor);
logger.debug("Update channel 4");
updateState(CHANNEL_ID_RADON_LT_AVG,
QuantityType.valueOf(Double.valueOf(intResult), BECQUEREL_PER_CUBIC_METRE));
QuantityType.valueOf(Double.valueOf(intResult), Units.BECQUEREL_PER_CUBIC_METRE));
logger.debug("Update channel 4 done");
break;
}

View File

@ -63,7 +63,7 @@ public class AirthingsWaveMiniHandler extends AbstractAirthingsHandler {
}
Number tvoc = data.get(AirthingsDataParser.TVOC);
if (tvoc != null) {
updateState(CHANNEL_ID_TVOC, new QuantityType<Dimensionless>(tvoc, PARTS_PER_BILLION));
updateState(CHANNEL_ID_TVOC, new QuantityType<Dimensionless>(tvoc, Units.PARTS_PER_BILLION));
}
} catch (AirthingsParserException e) {
logger.error("Failed to parse data received from Airthings sensor: {}", e.getMessage());

View File

@ -73,17 +73,17 @@ public class AirthingsWavePlusHandler extends AbstractAirthingsHandler {
}
Number tvoc = data.get(AirthingsDataParser.TVOC);
if (tvoc != null) {
updateState(CHANNEL_ID_TVOC, new QuantityType<Dimensionless>(tvoc, PARTS_PER_BILLION));
updateState(CHANNEL_ID_TVOC, new QuantityType<Dimensionless>(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<Density>(radonShortTermAvg, BECQUEREL_PER_CUBIC_METRE));
new QuantityType<Density>(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<Density>(radonLongTermAvg, BECQUEREL_PER_CUBIC_METRE));
new QuantityType<Density>(radonLongTermAvg, Units.BECQUEREL_PER_CUBIC_METRE));
}
} catch (AirthingsParserException e) {
logger.error("Failed to parse data received from Airthings sensor: {}", e.getMessage());