本文整理汇总了Java中org.eclipse.paho.client.mqttv3.MqttTopic.validate方法的典型用法代码示例。如果您正苦于以下问题:Java MqttTopic.validate方法的具体用法?Java MqttTopic.validate怎么用?Java MqttTopic.validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.paho.client.mqttv3.MqttTopic
的用法示例。
在下文中一共展示了MqttTopic.validate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onViewClicked
import org.eclipse.paho.client.mqttv3.MqttTopic; //导入方法依赖的package包/类
@OnClick(R.id.btn_subscribe)
public void onViewClicked() {
String topic = mTopic.getText().toString().trim();
try {
MqttTopic.validate(topic, true/*allow wildcards*/);
} catch (IllegalArgumentException e) {
TipUtil.showSnackbar(mLinearLayout, e.getMessage());
return;
}
int qos = mQoSLayout.getQoS();
Subscription subscription = new Subscription(topic, qos);
Intent intent = new Intent();
intent.putExtra(Constant.ExtraConstant.EXTRA_SUBSCRIPTION, subscription);
setResult(RESULT_OK, intent);
finish();
}
示例2: onViewClicked
import org.eclipse.paho.client.mqttv3.MqttTopic; //导入方法依赖的package包/类
@OnClick(R.id.btn_publish)
public void onViewClicked() {
String topic = mTopic.getText().toString().trim();
try{
MqttTopic.validate(topic, false/*wildcards NOT allowed*/);
}catch (IllegalArgumentException e){
TipUtil.showSnackbar(mLinearLayout, e.getMessage());
return;
}
int qos = mQoSChooseLayout.getQoS();
String payload = mPayload.getText().toString().trim();
boolean isRetained = mRetainedSwitch.isChecked();
Publication publication = new Publication(topic, payload, qos, isRetained);
Intent intent = new Intent();
intent.putExtra(Constant.ExtraConstant.EXTRA_PUBLICATION, publication);
setResult(RESULT_OK, intent);
finish();
}
示例3: testValidTopicFilterWildcards
import org.eclipse.paho.client.mqttv3.MqttTopic; //导入方法依赖的package包/类
@Test
public void testValidTopicFilterWildcards() throws Exception {
String methodName = Utility.getMethodName();
LoggingUtilities.banner(log, cclass, methodName);
String[] topics = new String[] {
"+", "+/+", "+/foo",
"+/tennis/#",
"foo/+", "foo/+/bar",
"/+", "/+/sport/+/player1",
"#", "/#",
"sport/#",
"sport/tennis/#"
};
for(String topic:topics){
MqttTopic.validate(topic, true);
}
}
示例4: onAddSubscription
import org.eclipse.paho.client.mqttv3.MqttTopic; //导入方法依赖的package包/类
@Override
public void onAddSubscription(Subscription subscription) {
try {
MqttTopic.validate(subscription.getTopic(),true);
}catch (IllegalArgumentException e){
TipUtil.showSnackbar(mCoordinatorLayout,e.getMessage());
return;
}
subscription.setConnectionId(mConnection.getId());
mSubscription = subscription;
RealmHelper.getInstance().addSubscription(mSubscription);
subscribe(subscription);
}
示例5: testInvalidTopicFilterWildcards1
import org.eclipse.paho.client.mqttv3.MqttTopic; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testInvalidTopicFilterWildcards1() throws Exception {
String methodName = Utility.getMethodName();
LoggingUtilities.banner(log, cclass, methodName);
MqttTopic.validate("sport/tennis#", true);
}
示例6: testInvalidTopicFilterWildcards2
import org.eclipse.paho.client.mqttv3.MqttTopic; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testInvalidTopicFilterWildcards2() throws Exception {
String methodName = Utility.getMethodName();
LoggingUtilities.banner(log, cclass, methodName);
MqttTopic.validate("sport/tennis/#/ranking", true);
}
示例7: testInvalidTopicFilterWildcards3
import org.eclipse.paho.client.mqttv3.MqttTopic; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testInvalidTopicFilterWildcards3() throws Exception {
String methodName = Utility.getMethodName();
LoggingUtilities.banner(log, cclass, methodName);
MqttTopic.validate("sport+", true);
}
示例8: testInvalidTopicFilterWildcards4
import org.eclipse.paho.client.mqttv3.MqttTopic; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testInvalidTopicFilterWildcards4() throws Exception {
String methodName = Utility.getMethodName();
LoggingUtilities.banner(log, cclass, methodName);
MqttTopic.validate("sport/+aa", true);
}
示例9: testInvalidTopicFilterWildcards5
import org.eclipse.paho.client.mqttv3.MqttTopic; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testInvalidTopicFilterWildcards5() throws Exception {
String methodName = Utility.getMethodName();
LoggingUtilities.banner(log, cclass, methodName);
MqttTopic.validate("sport/#/ball/+/aa", true);
}