Class ThingFactory


  • @NonNullByDefault
    public class ThingFactory
    extends Object
    ThingFactory helps to create thing based on a given ThingType .
    Author:
    Dennis Nobel - Initial contribution, added support for channel groups, Benedikt Niehues - fix for Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=445137 considering default values, Thomas Höfer - added thing and thing type properties, Chris Jackson - Added properties, label, description
    • Constructor Detail

      • ThingFactory

        public ThingFactory()
    • Method Detail

      • generateRandomThingUID

        public static ThingUID generateRandomThingUID​(ThingTypeUID thingTypeUID)
        Generates a random Thing UID for the given thingType
        Parameters:
        thingTypeUID - thing type (must not be null)
        Returns:
        random Thing UID
      • createThing

        public static Thing createThing​(ThingType thingType,
                                        ThingUID thingUID,
                                        Configuration configuration,
                                        @Nullable ThingUID bridgeUID)
        Creates a thing based on a given thing type.
        Parameters:
        thingType - thing type (must not be null)
        thingUID - thindUID (must not be null)
        configuration - (must not be null)
        bridge - (can be null)
        Returns:
        thing the thing
      • createThing

        public static Thing createThing​(ThingType thingType,
                                        ThingUID thingUID,
                                        Configuration configuration,
                                        @Nullable ThingUID bridgeUID,
                                        @Nullable ConfigDescriptionRegistry configDescriptionRegistry)
        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
        Parameters:
        thingType - (must not be null)
        thingUID - (must not be null)
        configuration - (must not be null)
        bridgeUID - (can be null)
        configDescriptionRegistry - (can be null)
        Returns:
        thing the thing
      • createThing

        public static Thing createThing​(ThingType thingType,
                                        ThingUID thingUID,
                                        Configuration configuration)
        Creates a thing based on given thing type.
        Parameters:
        thingType - thing type (must not be null)
        thingUID - thingUID (must not be null)
        configuration - (must not be null)
        Returns:
        thing the thing