本文整理匯總了Java中org.eclipse.smarthome.core.library.items.ContactItem類的典型用法代碼示例。如果您正苦於以下問題:Java ContactItem類的具體用法?Java ContactItem怎麽用?Java ContactItem使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ContactItem類屬於org.eclipse.smarthome.core.library.items包,在下文中一共展示了ContactItem類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: mapToOpenHABItem
import org.eclipse.smarthome.core.library.items.ContactItem; //導入依賴的package包/類
public static org.openhab.core.items.Item mapToOpenHABItem(Item item) {
org.openhab.core.items.Item result = null;
if(item instanceof StringItem) result = new org.openhab.core.library.items.StringItem(item.getName());
if(item instanceof SwitchItem) result = new org.openhab.core.library.items.SwitchItem(item.getName());
if(item instanceof ContactItem) result = new org.openhab.core.library.items.ContactItem(item.getName());
if(item instanceof NumberItem) result = new org.openhab.core.library.items.NumberItem(item.getName());
if(item instanceof RollershutterItem) result = new org.openhab.core.library.items.RollershutterItem(item.getName());
if(item instanceof DimmerItem) result = new org.openhab.core.library.items.DimmerItem(item.getName());
if(item instanceof ColorItem) result = new org.openhab.core.library.items.ColorItem(item.getName());
if(item instanceof DateTimeItem) result = new org.openhab.core.library.items.DateTimeItem(item.getName());
if(item instanceof ESHCallItem) result = new org.openhab.library.tel.items.CallItem(item.getName());
if(item instanceof GroupItem) {
GroupItem gItem = (GroupItem) item;
org.openhab.core.items.Item baseItem = ItemMapper.mapToOpenHABItem(gItem.getBaseItem());
org.openhab.core.items.GroupItem ohgItem;
if(baseItem instanceof GenericItem) {
ohgItem = new org.openhab.core.items.GroupItem(item.getName(), (GenericItem) baseItem);
} else {
ohgItem = new org.openhab.core.items.GroupItem(item.getName());
}
for(Item member : gItem.getMembers()) {
org.openhab.core.items.Item ohMember = ItemMapper.mapToOpenHABItem(member);
if(ohMember != null) {
ohgItem.addMember(ohMember);
}
}
result = ohgItem;
}
if(result instanceof org.openhab.core.items.GenericItem) {
org.openhab.core.items.GenericItem genericItem = (GenericItem) result;
if(item.getState()!=null) {
genericItem.setState(TypeParser.parseState(genericItem.getAcceptedDataTypes(), item.getState().toString()));
}
}
return result;
}