@Override public BridgeBuilder withBridge(@Nullable ThingUID bridgeUID) { return (BridgeBuilder) super.withBridge(bridgeUID); }
/** * Creates a thing based on a given thing type. It also creates the * default-configuration given in the configDescriptions if the * configDescriptionRegistry is not null * * @param thingType (must not be null) * @param thingUID (must not be null) * @param configuration (must not be null) * @param bridgeUID (can be null) * @param configDescriptionRegistry (can be null) * @return thing the thing */ public static Thing createThing(ThingType thingType, ThingUID thingUID, Configuration configuration, @Nullable ThingUID bridgeUID, @Nullable ConfigDescriptionRegistry configDescriptionRegistry) { ThingFactoryHelper.applyDefaultConfiguration(configuration, thingType, configDescriptionRegistry); List<Channel> channels = ThingFactoryHelper.createChannels(thingType, thingUID, configDescriptionRegistry); return createThingBuilder(thingType, thingUID).withConfiguration(configuration).withChannels(channels) .withProperties(thingType.getProperties()).withBridge(bridgeUID).build(); }
/** * Creates a thing builder, which allows to modify the thing. The method * {@link BaseThingHandler#updateThing(Thing)} must be called to persist the changes. * * @return {@link ThingBuilder} which builds an exact copy of the thing (not null) */ protected ThingBuilder editThing() { return ThingBuilder.create(this.thing.getThingTypeUID(), this.thing.getUID()) .withBridge(this.thing.getBridgeUID()).withChannels(this.thing.getChannels()) .withConfiguration(this.thing.getConfiguration()).withLabel(this.thing.getLabel()) .withLocation(this.thing.getLocation()).withProperties(this.thing.getProperties()); }
thingBuilder.withBridge(bridgeUID); thingBuilder.withLabel(label); thingBuilder.withLocation(location);
builder.withBridge(new ThingUID(updatedContents.bridgeUID)); } else { builder.withBridge(thing.getBridgeUID());