本文整理了Java中org.eclipse.smarthome.core.items.Item.getCategory()
方法的一些代码示例,展示了Item.getCategory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Item.getCategory()
方法的具体详情如下:
包路径:org.eclipse.smarthome.core.items.Item
类名称:Item
方法名:getCategory
[英]Returns the category of the item or null if no category is set.
[中]返回项目的类别,如果未设置类别,则返回null。
代码示例来源:origin: eclipse/smarthome
@Override
protected PersistedItem toPersistableElement(Item item) {
PersistedItem persistedItem = new PersistedItem(
item instanceof GroupItem ? ITEM_TYPE_GROUP : toItemFactoryName(item));
if (item instanceof GroupItem) {
GroupItem groupItem = (GroupItem) item;
String baseItemType = null;
Item baseItem = groupItem.getBaseItem();
if (baseItem != null) {
baseItemType = toItemFactoryName(baseItem);
}
persistedItem.baseItemType = baseItemType;
addFunctionToPersisedItem(persistedItem, groupItem);
}
persistedItem.label = item.getLabel();
persistedItem.groupNames = new ArrayList<>(item.getGroupNames());
persistedItem.tags = new HashSet<>(item.getTags());
persistedItem.category = item.getCategory();
return persistedItem;
}
代码示例来源:origin: eclipse/smarthome
public ItemBuilderImpl(Set<ItemFactory> itemFactories, Item item) {
this.itemFactories = itemFactories;
this.itemType = item.getType();
this.name = item.getName();
this.category = item.getCategory();
this.groups = item.getGroupNames();
this.label = item.getLabel();
this.tags = item.getTags();
if (item instanceof GroupItem) {
this.baseItem = ((GroupItem) item).getBaseItem();
this.groupFunction = ((GroupItem) item).getFunction();
}
}
代码示例来源:origin: eclipse/smarthome
private static void fillProperties(ItemDTO itemDTO, Item item) {
if (item instanceof GroupItem) {
GroupItem groupItem = (GroupItem) item;
GroupItemDTO groupItemDTO = (GroupItemDTO) itemDTO;
if (groupItem.getBaseItem() != null) {
groupItemDTO.groupType = groupItem.getBaseItem().getType();
groupItemDTO.function = mapFunction(groupItem.getFunction());
}
}
itemDTO.name = item.getName();
itemDTO.type = item.getType();
itemDTO.label = item.getLabel();
itemDTO.tags = item.getTags();
itemDTO.category = item.getCategory();
itemDTO.groupNames = item.getGroupNames();
}
代码示例来源:origin: org.eclipse.smarthome.ui/org.eclipse.smarthome.ui
public String getItemCategory(@NonNull String itemName) {
try {
Item item = itemRegistry.getItem(itemName);
return item.getCategory();
} catch (ItemNotFoundException e) {
return null;
}
}
代码示例来源:origin: openhab/openhab-core
public String getItemCategory(@NonNull String itemName) {
try {
Item item = itemRegistry.getItem(itemName);
return item.getCategory();
} catch (ItemNotFoundException e) {
return null;
}
}
代码示例来源:origin: openhab/openhab-core
@Override
protected PersistedItem toPersistableElement(Item item) {
PersistedItem persistedItem = new PersistedItem(
item instanceof GroupItem ? ITEM_TYPE_GROUP : toItemFactoryName(item));
if (item instanceof GroupItem) {
GroupItem groupItem = (GroupItem) item;
String baseItemType = null;
Item baseItem = groupItem.getBaseItem();
if (baseItem != null) {
baseItemType = toItemFactoryName(baseItem);
}
persistedItem.baseItemType = baseItemType;
addFunctionToPersisedItem(persistedItem, groupItem);
}
persistedItem.label = item.getLabel();
persistedItem.groupNames = new ArrayList<>(item.getGroupNames());
persistedItem.tags = new HashSet<>(item.getTags());
persistedItem.category = item.getCategory();
return persistedItem;
}
代码示例来源:origin: openhab/openhab-core
public ItemBuilderImpl(Set<ItemFactory> itemFactories, Item item) {
this.itemFactories = itemFactories;
this.itemType = item.getType();
this.name = item.getName();
this.category = item.getCategory();
this.groups = item.getGroupNames();
this.label = item.getLabel();
this.tags = item.getTags();
if (item instanceof GroupItem) {
this.baseItem = ((GroupItem) item).getBaseItem();
this.groupFunction = ((GroupItem) item).getFunction();
}
}
代码示例来源:origin: openhab/openhab-core
private static void fillProperties(ItemDTO itemDTO, Item item) {
if (item instanceof GroupItem) {
GroupItem groupItem = (GroupItem) item;
GroupItemDTO groupItemDTO = (GroupItemDTO) itemDTO;
if (groupItem.getBaseItem() != null) {
groupItemDTO.groupType = groupItem.getBaseItem().getType();
groupItemDTO.function = mapFunction(groupItem.getFunction());
}
}
itemDTO.name = item.getName();
itemDTO.type = item.getType();
itemDTO.label = item.getLabel();
itemDTO.tags = item.getTags();
itemDTO.category = item.getCategory();
itemDTO.groupNames = item.getGroupNames();
}
内容来源于网络,如有侵权,请联系作者删除!