• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java StringItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.openhab.core.library.items.StringItem的典型用法代码示例。如果您正苦于以下问题:Java StringItem类的具体用法?Java StringItem怎么用?Java StringItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



StringItem类属于org.openhab.core.library.items包,在下文中一共展示了StringItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: validateItemType

import org.openhab.core.library.items.StringItem; //导入依赖的package包/类
@Override
public void validateItemType(Item item, String bindingConfig)
		throws BindingConfigParseException {

	if (!(item instanceof NumberItem || item instanceof SwitchItem
			|| item instanceof ContactItem || item instanceof StringItem
			|| item instanceof DateTimeItem || item instanceof DimmerItem || item instanceof RollershutterItem)) {
		throw new BindingConfigParseException(
				"Item '"
						+ item.getName()
						+ "' is of type '"
						+ item.getClass().getSimpleName()
						+ "', only NumberItems, SwitchItems, ContactItems, DateTimeItem, StringItem, DimmerItem or RollershutterItem are allowed - please check your *.items configuration");

	}

}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:18,代码来源:IhcGenericBindingProvider.java


示例2: newCallItemUpdate

import org.openhab.core.library.items.StringItem; //导入依赖的package包/类
/**
 * Update items for new calls
 * @param config
 * @param channel
 */
private void newCallItemUpdate(FreeswitchBindingConfig config, Channel channel){

	if (config.getItemType().isAssignableFrom(SwitchItem.class)) {

		eventPublisher.postUpdate(config.getItemName(), OnOffType.ON);
	}
	else if (config.getItemType().isAssignableFrom(CallItem.class)) {

		eventPublisher.postUpdate(config.getItemName(), channel.getCall());
	}
	else if (config.getItemType().isAssignableFrom(StringItem.class)) {

		eventPublisher.postUpdate(config.getItemName(), 
				new StringType(String.format("%s : %s",
						channel.getEventHeader(CID_NAME),
						channel.getEventHeader(CID_NUMBER))));
	}
	else {
		logger.warn("handleHangupCall - postUpdate for itemType '{}' is undefined", config.getItemName());
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:27,代码来源:FreeswitchBinding.java


示例3: createOneWireDeviceProperty

import org.openhab.core.library.items.StringItem; //导入依赖的package包/类
/**
 * @param pvItem
 * @param pvBindingConfig
 * @return a new BindingConfig, corresponding to the given <code><pvItem/code> and <code><pvBindingConfig/code>
 * @throws BindingConfigParseException
 */
public static OneWireBindingConfig createOneWireDeviceProperty(Item pvItem, String pvBindingConfig) throws BindingConfigParseException {
	logger.debug("createOneWireDeviceProperty: " + pvItem.getName() + " - bindingConfig:" + pvBindingConfig);

	OneWireBindingConfig lvNewBindingConfig = null;
	if (OneWireClearCacheControlBindingConfig.isBindingConfigToCreate(pvItem, pvBindingConfig)) {
		lvNewBindingConfig = new OneWireClearCacheControlBindingConfig(pvBindingConfig);
	} else if (OneWireDevicePropertySwitchMinMaxNumberWarningBindingConfig.isBindingConfigToCreate(pvItem, pvBindingConfig)) {
		lvNewBindingConfig = new OneWireDevicePropertySwitchMinMaxNumberWarningBindingConfig(pvBindingConfig);
	} else if (pvItem instanceof NumberItem) {
		lvNewBindingConfig = new OneWireDevicePropertyNumberBindingConfig(pvBindingConfig);
	} else if (pvItem instanceof ContactItem) {
		lvNewBindingConfig = new OneWireDevicePropertyContactBindingConfig(pvBindingConfig);
	} else if (pvItem instanceof SwitchItem) {
		lvNewBindingConfig = new OneWireDevicePropertySwitchBindingConfig(pvBindingConfig);
	} else if (pvItem instanceof StringItem) {
		lvNewBindingConfig = new OneWireDevicePropertyStringBindingConfig(pvBindingConfig);
	} else {
		throw new UnsupportedOperationException("the item-type " + pvItem.getClass() + " cannot be a onewire device");
	}

	logger.debug("created newBindingConfig: " + lvNewBindingConfig.toString());

	return lvNewBindingConfig;
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:31,代码来源:OneWireBindingConfigFactory.java


示例4: mapCommandToItemType

import org.openhab.core.library.items.StringItem; //导入依赖的package包/类
private Class<? extends Item> mapCommandToItemType(Command command) {
	if (command instanceof IncreaseDecreaseType) {
		return DimmerItem.class;
	} else if (command instanceof PercentType) {
		return DimmerItem.class;
	} else if (command instanceof DecimalType) {
		return NumberItem.class;
	} else if (command instanceof OnOffType) {
		return SwitchItem.class;
	} else if (command instanceof StringType) {
		return StringItem.class;
	} else {
		logger.warn(
				"No explicit mapping found for command type '{}' - return StringItem.class instead",
				command.getClass().getSimpleName());
		return StringItem.class;
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:19,代码来源:PulseaudioBinding.java


示例5: validateItemType

import org.openhab.core.library.items.StringItem; //导入依赖的package包/类
/**
 * @{inheritDoc
 */
@Override
public void validateItemType(Item item, String bindingConfig)
		throws BindingConfigParseException {
	if (!(item instanceof SwitchItem 
			|| item instanceof NumberItem
			|| item instanceof DimmerItem
			|| item instanceof RollershutterItem 
			|| item instanceof StringItem)) {
		throw new BindingConfigParseException(
				"item '"
						+ item.getName()
						+ "' is of type '"
						+ item.getClass().getSimpleName()
						+ "', only SwitchItem, NumberItem, DimmerItem, RollershutterItem and StringItem are allowed - please check your *.items configuration");
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:20,代码来源:SamsungTvGenericBindingProvider.java


示例6: testImage

import org.openhab.core.library.items.StringItem; //导入依赖的package包/类
@Test
public void testImage() throws Exception {
	addBindingConfig(new StringItem("Ulux_Image"), "{switchId=1, type='IMAGE'}");

	receiveCommand("Ulux_Image", new StringType("http://www.openhab.org/images/openhab-logo-square.png"));

	byte[] actual = toBytes(datagramList.poll());
	byte[] expected = toBytes("0C:A2:00:00:00:00:00:00:01:00:00:00");

	assertThat(actual, equalTo(expected));

	assertThat(datagramList.size(), equalTo(46));

	for (int i = 1; !datagramList.isEmpty(); i++) {
		final UluxDatagram datagram = datagramList.poll();

		assertThat(datagram, isVideoDatagram());

		if (i % 10 == 0) {
			actual = toBytes(datagram);
			expected = toBytes(new File("src/test/resources/VideoStreamMessageTest-" + i + ".txt"));

			assertThat(actual, equalTo(expected));
		}
	}
}
 
开发者ID:abrenk,项目名称:openhab-ulux-binding,代码行数:27,代码来源:VideoStreamMessageTest.java


示例7: convertToState

import org.openhab.core.library.items.StringItem; //导入依赖的package包/类
@Override
public State convertToState(RFXComValueSelector valueSelector) throws RFXComException {

    org.openhab.core.types.State state = UnDefType.UNDEF;

    if (valueSelector.getItemClass() == StringItem.class) {
        if (valueSelector == RFXComValueSelector.RAW_DATA) {
            state = new StringType(DatatypeConverter.printHexBinary(rawMessage));
        } else if (valueSelector == RFXComValueSelector.DATA) {
            state = new StringType(DatatypeConverter.printHexBinary(rawData));
        } else {
            throw new RFXComException("Can't convert " + valueSelector + " to StringItem");
        }
    } else {
        throw new RFXComException("Can't convert " + valueSelector + " to " + valueSelector.getItemClass());
    }

    return state;
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:20,代码来源:RFXComUndecodedRFMessage.java


示例8: updateItem

import org.openhab.core.library.items.StringItem; //导入依赖的package包/类
@Override
public void updateItem(Item item, OmniLinkBindingConfig config, EventPublisher publisher) {
    String str = " ";

    switch (config.getObjectType()) {

        case AUDIOSOURCE_TEXT:
            str = formatAudioText();
            break;
        case AUDIOSOURCE_TEXT_FIELD1:
            str = getAudioText(0);
            break;
        case AUDIOSOURCE_TEXT_FIELD2:
            str = getAudioText(1);
            break;
        case AUDIOSOURCE_TEXT_FIELD3:
            str = getAudioText(2);
            break;
        default:
            return;
    }

    if (item instanceof StringItem) {
        publisher.postUpdate(item.getName(), new StringType(str));
    }
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:27,代码来源:AudioSource.java


示例9: resolveConfigDataLength

import org.openhab.core.library.items.StringItem; //导入依赖的package包/类
int resolveConfigDataLength(String configParameters, Item item) throws BindingConfigParseException {
    String[] optionalConfigs = configParameters.substring(1).split(":");

    for (int i = 0; i < optionalConfigs.length; i++) {
        String param = optionalConfigs[i].toLowerCase();
        // is datatype?
        if (!(param.equals("i") || param.equals("o") || param.equals("io"))) {

            Matcher matcher = Pattern.compile("^array\\[(\\d+)\\]$").matcher(param);

            if (matcher.matches()) {
                if (item.getClass().isAssignableFrom(StringItem.class)) {
                    if (!param.startsWith("array")) {
                        logger.warn(
                                "Item %s support datatype array only. Type %s is ignored. Setted to ARRAY with length 32.",
                                item.getName(), param);
                        return 32;
                    } else {
                        return Integer.valueOf(matcher.group(1)).intValue();
                    }
                }
            }
        }
    }

    return 1;
}
 
开发者ID:docbender,项目名称:openHAB-Simatic,代码行数:28,代码来源:SimaticGenericBindingProvider.java


示例10: resolveDataTypeFromItemType

import org.openhab.core.library.items.StringItem; //导入依赖的package包/类
SimaticTypes resolveDataTypeFromItemType(Item item, String address) throws BindingConfigParseException {
    Class<? extends Item> itemType = item.getClass();

    if (itemType.isAssignableFrom(NumberItem.class)) {
        switch (SimaticPLCAddress.create(address).dataType) {
            case DWORD:
                return SimaticTypes.DWORD;
            case WORD:
                return SimaticTypes.WORD;
            default:
                return SimaticTypes.BYTE;
        }
    } else if (itemType.isAssignableFrom(SwitchItem.class)) {
        return SimaticTypes.BYTE;
    } else if (itemType.isAssignableFrom(DimmerItem.class)) {
        return SimaticTypes.BYTE;
    } else if (itemType.isAssignableFrom(ColorItem.class)) {
        logger.warn("Item %s has not specified datatype. Setted to RGB.", item.getName());
        return SimaticTypes.RGB;
    } else if (itemType.isAssignableFrom(StringItem.class)) {
        logger.warn("Item %s has not specified datatype with length. Setted to ARRAY with length 32.",
                item.getName());
        return SimaticTypes.ARRAY;
    } else if (itemType.isAssignableFrom(ContactItem.class)) {
        return SimaticTypes.BYTE;
    } else if (itemType.isAssignableFrom(RollershutterItem.class)) {
        return SimaticTypes.WORD;
    } else {
        throw new BindingConfigParseException("Unsupported item type: " + item);
    }
}
 
开发者ID:docbender,项目名称:openHAB-Simatic,代码行数:32,代码来源:SimaticGenericBindingProvider.java


示例11: validateItemType

import org.openhab.core.library.items.StringItem; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException {
	if (!(item instanceof SwitchItem || item instanceof NumberItem || item instanceof StringItem)) {
		throw new BindingConfigParseException("item '" + item.getName()
				+ "' is of type '" + item.getClass().getSimpleName()
				+ "', only Switch-, String and NumberItems are allowed - please check your *.items configuration");
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:12,代码来源:VDRGenericBindingProvider.java


示例12: validateItemType

import org.openhab.core.library.items.StringItem; //导入依赖的package包/类
/**
 * @{inheritDoc
 */
@Override
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException {
	if (!(item instanceof NumberItem || item instanceof DimmerItem || item instanceof ContactItem || item instanceof StringItem)) {
		throw new BindingConfigParseException("item '" + item.getName() + "' is of type '" + item.getClass().getSimpleName()
				+ "', only Number-, Dimmer-, Contact- and StringItems are allowed - please check your *.items configuration");
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:11,代码来源:MaxCubeGenericBindingProvider.java


示例13: validateItemType

import org.openhab.core.library.items.StringItem; //导入依赖的package包/类
/**
 * @{inheritDoc
 */
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException {
	if (!(item instanceof NumberItem || item instanceof StringItem || item instanceof DateTimeItem)) {
		throw new BindingConfigParseException("item '" + item.getName() + "' is of type '" + item.getClass().getSimpleName()
				+ "', only Number- and StringItems are allowed - please check your *.items configuration");
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:10,代码来源:DavisGenericBindingProvider.java


示例14: validateItemType

import org.openhab.core.library.items.StringItem; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void validateItemType(Item item, String bindingConfig)
		throws BindingConfigParseException {
	if (!(item instanceof SwitchItem || item instanceof StringItem || item instanceof NumberItem || item instanceof DateTimeItem)) {
		throw new BindingConfigParseException("item '" + item.getName()
				+ "' is of type '" + item.getClass().getSimpleName()
				+ "', only Switch-, String-, Number-, or DateTime Items are allowed - please check your *.items configuration");
	}	}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:11,代码来源:OceanicGenericBindingProvider.java


示例15: validateItemType

import org.openhab.core.library.items.StringItem; //导入依赖的package包/类
/**
 * @{inheritDoc
 */
@Override
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");
	}
	logger.debug(bindingConfig);

}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:18,代码来源:Iec6205621MeterGenericBindingProvider.java


示例16: validateItemType

import org.openhab.core.library.items.StringItem; //导入依赖的package包/类
/**
 * @{inheritDoc
 */
@Override
public void validateItemType(Item item, String bindingConfig)
		throws BindingConfigParseException {
	if (!(item instanceof SwitchItem || item instanceof NumberItem || item instanceof StringItem)) {
		throw new BindingConfigParseException(
				"item '"
						+ item.getName()
						+ "' is of type '"
						+ item.getClass().getSimpleName()
						+ "', only Switch-, Number, String and DimmerItems are allowed - please check your *.items configuration");
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:16,代码来源:Enigma2GenericBindingProvider.java


示例17: validateItemType

import org.openhab.core.library.items.StringItem; //导入依赖的package包/类
/**
 * @{inheritDoc
 */
@Override
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException {
	if( item == null ) {
		throw new BindingConfigParseException(
				"item is not permitted to be null.  item must be a non-null NumberItem or StringItem - please check your *.items configuration");
	}
	else if (!(item instanceof NumberItem || item instanceof StringItem)) {
		throw new BindingConfigParseException(
				"item '" + item.getName() + "' is of type '" + item.getClass().getSimpleName()
				+ "', only NumberItem and StringItem are allowed - please check your *.items configuration");
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:16,代码来源:SysteminfoGenericBindingProvider.java


示例18: validateItemType

import org.openhab.core.library.items.StringItem; //导入依赖的package包/类
/**
 * @{inheritDoc}
 */
@Override
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException {
	if (!(item instanceof StringItem || item instanceof CallItem || item instanceof SwitchItem ||
			item instanceof NumberItem)) {
		throw new BindingConfigParseException("item '" + item.getName()
				+ "' is of type '" + item.getClass().getSimpleName()
				+ "', only String, Number, Call and Switch Items are allowed");
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:13,代码来源:FreeswitchGenericBindingProvider.java


示例19: validateItemType

import org.openhab.core.library.items.StringItem; //导入依赖的package包/类
/**
 * @{inheritDoc}
 */
@Override
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException {
	if (!(item instanceof SwitchItem || item instanceof DimmerItem || item instanceof ContactItem
			|| item instanceof StringItem || item instanceof NumberItem)) {
		throw new BindingConfigParseException("item '" + item.getName()
				+ "' is of type '" + item.getClass().getSimpleName()
				+ "', only Switch, Dimmer, Contact, String and Number are supported for now- please check your *.items configuration");
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:13,代码来源:PilightGenericBindingProvider.java


示例20: validateItemType

import org.openhab.core.library.items.StringItem; //导入依赖的package包/类
/**
 * @{inheritDoc}
 */
@Override
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException {
	if (!(item instanceof SwitchItem || item instanceof DimmerItem || item instanceof StringItem)) {
		throw new BindingConfigParseException("item '" + item.getName()
				+ "' is of type '" + item.getClass().getSimpleName()
				+ "', only Switch-, Dimmer- and StringItems are allowed - please check your *.items configuration");
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:12,代码来源:DenonGenericBindingProvider.java



注:本文中的org.openhab.core.library.items.StringItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RandomCCNumberGeneratorMeta类代码示例发布时间:2022-05-22
下一篇:
Java PackageVersion类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap