本文整理了Java中org.openhab.core.items.Item.getName()
方法的一些代码示例,展示了Item.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Item.getName()
方法的具体详情如下:
包路径:org.openhab.core.items.Item
类名称:Item
方法名:getName
[英]returns the name of the item
[中]返回项的名称
代码示例来源:origin: openhab/openhab1-addons
/**
* @{inheritDoc
*/
@Override
protected void internalSend(Command command) {
if (eventPublisher != null) {
for (Item member : members) {
// try to send the command to the bus
eventPublisher.sendCommand(member.getName(), command);
}
}
}
代码示例来源:origin: openhab/openhab1-addons
private void notifyListeners(Item item) {
for (BindingChangeListener listener : listeners) {
try {
listener.bindingChanged(this, item.getName());
} catch (Exception e) {
logger.error("Binding {} threw an exception: ", listener.getClass().getName(), e);
}
}
}
代码示例来源:origin: openhab/openhab1-addons
protected void addBindingConfig(Item item, BindingConfig config) {
bindingConfigs.put(item.getName(), config);
notifyListeners(item);
}
代码示例来源:origin: openhab/openhab1-addons
@Override
public void processBindingConfiguration(String context, Item item, String bindingConfig)
throws BindingConfigParseException {
if (context == null) {
throw new BindingConfigParseException("null context is not permitted for item " + item.getName());
}
synchronized (contextMap) {
Set<Item> items = contextMap.get(context);
if (items == null) {
items = new HashSet<>();
contextMap.put(context, items);
}
items.add(item);
}
}
代码示例来源:origin: openhab/openhab1-addons
@Override
public void removeConfigurations(String context) {
Set<Item> items = null;
synchronized (contextMap) {
items = contextMap.get(context);
if (items != null) {
contextMap.remove(context);
}
}
if (items != null) {
for (Item item : items) {
// we remove all binding configurations for all items
bindingConfigs.remove(item.getName());
notifyListeners(item);
}
}
}
代码示例来源:origin: org.openhab.binding/org.openhab.binding.zwave
/**
* {@inheritDoc}
*/
@Override
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException {
// All types are valid
logger.trace("validateItemType({}, {})", item.getName(), bindingConfig);
}
代码示例来源:origin: org.openhab.binding/org.openhab.binding.nikobus
@Override
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException {
if (!(item instanceof SwitchItem) && !(item instanceof RollershutterItem)) {
throw new BindingConfigParseException("Item '" + item.getName()
+ "' is of type '" + item.getClass().getSimpleName()
+ "', which is not supported by the Nikobus Binding.");
}
}
代码示例来源:origin: org.openhab.binding/org.openhab.binding.tivo
/**
* @{inheritDoc}
*/
@Override
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException {
if (!(item instanceof SwitchItem)) {
throw new BindingConfigParseException("item '" + item.getName()
+ "' is of type '" + item.getClass().getSimpleName()
+ "', only SwitchItems are allowed - please check your *.items configuration");
}
}
代码示例来源:origin: org.openhab.binding/org.openhab.binding.fritzaha
/**
* @{inheritDoc
*/
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException {
if (!(item instanceof SwitchItem || item instanceof NumberItem)) {
throw new BindingConfigParseException("item '" + item.getName() + "' is of type '"
+ item.getClass().getSimpleName()
+ "', only Switch- and NumberItems are allowed - please check your *.items configuration");
}
}
代码示例来源:origin: org.openhab.binding/org.openhab.binding.enocean
protected void postCommand(Command command) {
if (command != null) {
for (Item item : items) {
eventPublisher.postCommand(item.getName(), command);
}
}
}
代码示例来源:origin: org.openhab.binding/org.openhab.binding.bluetooth
/**
* @{inheritDoc}
*/
@Override
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException {
if (!(item instanceof SwitchItem || item instanceof StringItem || item instanceof NumberItem)) {
throw new BindingConfigParseException("item '" + item.getName()
+ "' is of type '" + item.getClass().getSimpleName()
+ "', only Switch-, String- and NumberItems are allowed - please check your *.items configuration");
}
}
代码示例来源:origin: org.openhab.binding/org.openhab.binding.pulseaudio
/**
* {@inheritDoc}
*/
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException {
if ((item instanceof NumberItem) || (item instanceof StringItem) || (item instanceof SwitchItem) || (item instanceof DimmerItem)) {
return;
}
throw new BindingConfigParseException("item '" + item.getName()
+ "' is of type '" + item.getClass().getSimpleName()
+ "', which is not supported by the pulseaudio binding - please check your *.items configuration");
}
代码示例来源:origin: org.openhab.binding/org.openhab.binding.caldav-personal
/**
* @{inheritDoc}
*/
@Override
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException {
if (!(item instanceof SwitchItem || item instanceof StringItem || item instanceof DateTimeItem)) {
throw new BindingConfigParseException("item '" + item.getName()
+ "' is of type '" + item.getClass().getSimpleName()
+ "', only Switch-, String and DateTimeItem are allowed - please check your *.items configuration");
}
}
代码示例来源:origin: org.openhab.binding/org.openhab.binding.novelanheatpump
/**
* @{inheritDoc}
*/
public void validateItemType(Item item, String bindingConfig)
throws BindingConfigParseException {
if (!(item instanceof NumberItem || item instanceof StringItem)) {
throw new BindingConfigParseException("item '" + item.getName()
+ "' is of type '" + item.getClass().getSimpleName()
+ "', only Number- and StringItems are allowed - please check your *.items configuration");
}
}
代码示例来源:origin: org.openhab.binding/org.openhab.binding.fritzbox
/**
* @{inheritDoc}
*/
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException {
if (!(item instanceof SwitchItem || item instanceof CallItem || item instanceof StringItem || item instanceof NumberItem)) {
throw new BindingConfigParseException("item '" + item.getName()
+ "' is of type '" + item.getClass().getSimpleName()
+ "', only Switch- and CallItems are allowed - please check your *.items configuration");
}
}
代码示例来源:origin: openhab/openhab-core
/**
* @{inheritDoc
*/
@Override
protected void internalSend(Command command) {
if (eventPublisher != null) {
for (Item member : members) {
// try to send the command to the bus
eventPublisher.sendCommand(member.getName(), command);
}
}
}
代码示例来源:origin: org.openhab.binding/org.openhab.binding.zwave
/**
* {@inheritDoc}
*/
@Override
public void receiveCommand(Item item, Command command, ZWaveNode node,
ZWaveAlarmSensorCommandClass commandClass, int endpointId, Map<String,String> arguments) {
ZWaveCommandConverter<?,?> converter = this.getCommandConverter(command.getClass());
if (converter == null) {
logger.warn("No converter found for item = {}, node = {} endpoint = {}, ignoring command.", item.getName(), node.getNodeId(), endpointId);
return;
}
}
代码示例来源:origin: org.openhab.binding/org.openhab.binding.zwave
/**
* {@inheritDoc}
*/
@Override
public void receiveCommand(Item item, Command command, ZWaveNode node,
ZWaveBinarySensorCommandClass commandClass, int endpointId, Map<String,String> arguments) {
ZWaveCommandConverter<?,?> converter = this.getCommandConverter(command.getClass());
if (converter == null) {
logger.warn("No converter found for item = {}, node = {} endpoint = {}, ignoring command.", item.getName(), node.getNodeId(), endpointId);
return;
}
}
代码示例来源:origin: org.openhab.binding/org.openhab.binding.zwave
/**
* {@inheritDoc}
*/
@Override
public void receiveCommand(Item item, Command command, ZWaveNode node,
ZWaveAlarmCommandClass commandClass, int endpointId, Map<String,String> arguments) {
ZWaveCommandConverter<?,?> converter = this.getCommandConverter(command.getClass());
if (converter == null) {
logger.warn("NODE {}: No converter found for item = {}, endpoint = {}, ignoring command.", node.getNodeId(), item.getName(), endpointId);
return;
}
}
代码示例来源:origin: org.openhab.binding/org.openhab.binding.nikobus
@Override
public void processBindingConfiguration(String context, Item item,
String bindingConfig) throws BindingConfigParseException {
super.processBindingConfiguration(context, item, bindingConfig);
String config = (bindingConfig == null) ? "" : bindingConfig.replaceAll(" ", "").toUpperCase();
log.trace("Binding item: {} with configuration {}", item.getName(), config);
final AbstractNikobusItemConfig itemBinding = parseItem(item, config);
addBindingConfig(item, itemBinding);
}
内容来源于网络,如有侵权,请联系作者删除!