FilterAPI { public static SubscriptionData buildSubscriptionData(final String consumerGroup, String topic, String subString) throws Exception { SubscriptionData subscriptionData = new SubscriptionData(); subscriptionData.setTopic(topic); subscriptionData.setSubString(subString); if (null == subString || subString.equals(SubscriptionData.SUB_ALL) || subString.length() == 0) { subscriptionData.setSubString(SubscriptionData.SUB_ALL); } else { String[] tags = subString.split("\\|\\|"); if (tags != null && tags.length > 0) { for (String tag : tags) { if (tag.length() > 0) { String trimString = tag.trim(); if (trimString.length() > 0) { subscriptionData.getTagsSet().add(trimString); subscriptionData.getCodeSet().add(trimString.hashCode()); } } } } else { throw new Exception("subString split error"); } } return subscriptionData; }  static String simpleClassName(final String className); static URL classFile(final String className); static SubscriptionData buildSubscriptionData(final String consumerGroup, String topic,
            String subString);  }
@Test public void testBuildSubscriptionData() throws Exception { SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData("ConsumerGroup1", "TestTopic", "TAG1 || Tag2 || tag3"); System.out.println(subscriptionData); }
@Test public void testSubscriptionData() throws Exception { SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData("ConsumerGroup1", "TestTopic", "TAG1 || Tag2 || tag3"); subscriptionData.setFilterClassSource("java hello"); String json = RemotingSerializable.toJson(subscriptionData, true); System.out.println(json); }