/** * Parses the input string into a {@link ChannelKind}. * * @param input the input string * @return the parsed ChannelKind. * @throws IllegalArgumentException if the input couldn't be parsed. */ public static ChannelKind parse(String input) { if (input == null) { return STATE; } for (ChannelKind value : values()) { if (value.name().equalsIgnoreCase(input)) { return value; } } throw new IllegalArgumentException("Unknown channel kind: '" + input + "'"); } }
public ChannelTypeDTO(String UID, String label, String description, String category, String itemType, ChannelKind kind, List<ConfigDescriptionParameterDTO> parameters, List<ConfigDescriptionParameterGroupDTO> parameterGroups, StateDescription stateDescription, Set<String> tags, boolean advanced) { this.UID = UID; this.label = label; this.description = description; this.category = category; this.parameters = parameters; this.parameterGroups = parameterGroups; this.stateDescription = stateDescription; this.tags = tags; this.kind = kind.toString(); this.itemType = itemType; this.advanced = advanced; } }
/** * Maps channel DTO into channel object. * * @param channelDTO the channel DTO * @return the channel object */ public static Channel map(ChannelDTO channelDTO) { ChannelUID channelUID = new ChannelUID(channelDTO.uid); ChannelTypeUID channelTypeUID = new ChannelTypeUID(channelDTO.channelTypeUID); return ChannelBuilder.create(channelUID, channelDTO.itemType) .withConfiguration(new Configuration(channelDTO.configuration)).withLabel(channelDTO.label) .withDescription(channelDTO.description).withProperties(channelDTO.properties).withType(channelTypeUID) .withDefaultTags(channelDTO.defaultTags).withKind(ChannelKind.parse(channelDTO.kind)).build(); } }
parsedKind = ChannelKind.parse(kind);
ChannelKind cKind = ChannelKind.parse(kind); URI configDescriptionURI = (URI) configDescriptionObjects[0]; ChannelType channelType = null;
public ChannelDTO(ChannelUID uid, String channelTypeUID, String itemType, ChannelKind kind, String label, String description, Map<String, String> properties, Configuration configuration, Set<String> defaultTags) { this.uid = uid.toString(); this.id = uid.getId(); this.channelTypeUID = channelTypeUID; this.itemType = itemType; this.label = label; this.description = description; this.properties = properties; this.configuration = toMap(configuration); this.defaultTags = new HashSet<>(defaultTags); this.kind = kind.toString(); }