当前位置: 首页>>代码示例>>Java>>正文


Java WxMenuButton.setName方法代码示例

本文整理汇总了Java中me.chanjar.weixin.common.bean.menu.WxMenuButton.setName方法的典型用法代码示例。如果您正苦于以下问题:Java WxMenuButton.setName方法的具体用法?Java WxMenuButton.setName怎么用?Java WxMenuButton.setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在me.chanjar.weixin.common.bean.menu.WxMenuButton的用法示例。


在下文中一共展示了WxMenuButton.setName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testAddConditionalToJson

import me.chanjar.weixin.common.bean.menu.WxMenuButton; //导入方法依赖的package包/类
@Test(dataProvider = "wxAddConditionalMenu")
public void testAddConditionalToJson(String json) {
  WxMenu menu = new WxMenu();
  WxMenuButton button1 = new WxMenuButton();
  button1.setType("click");
  button1.setName("今日歌曲");
  button1.setKey("V1001_TODAY_MUSIC");

  menu.getButtons().add(button1);

  WxMenuRule wxMenuRule = new WxMenuRule();
  wxMenuRule.setTagId("2");
  wxMenuRule.setSex("1");
  wxMenuRule.setCountry("中国");
  wxMenuRule.setProvince("广东");
  wxMenuRule.setCity("广州");
  wxMenuRule.setClientPlatformType("2");
  wxMenuRule.setLanguage("zh_CN");
  menu.setMatchRule(wxMenuRule);

  Assert.assertEquals(menu.toJson(), json);
}
 
开发者ID:11590692,项目名称:Wechat-Group,代码行数:23,代码来源:WxMenuTest.java

示例2: convertFromJson

import me.chanjar.weixin.common.bean.menu.WxMenuButton; //导入方法依赖的package包/类
protected WxMenuButton convertFromJson(JsonObject json) {
  WxMenuButton button = new WxMenuButton();
  button.setName(GsonHelper.getString(json, "name"));
  button.setKey(GsonHelper.getString(json, "key"));
  button.setUrl(GsonHelper.getString(json, "url"));
  button.setType(GsonHelper.getString(json, "type"));
  button.setMediaId(GsonHelper.getString(json, "media_id"));
  return button;
}
 
开发者ID:11590692,项目名称:Wechat-Group,代码行数:10,代码来源:WxMenuGsonAdapter.java

示例3: convertFromJson

import me.chanjar.weixin.common.bean.menu.WxMenuButton; //导入方法依赖的package包/类
protected WxMenuButton convertFromJson(JsonObject json) {
  WxMenuButton button = new WxMenuButton();
  button.setName(GsonHelper.getString(json, "name"));
  button.setKey(GsonHelper.getString(json, "key"));
  button.setUrl(GsonHelper.getString(json, "url"));
  button.setType(GsonHelper.getString(json, "type"));
  button.setMediaId(GsonHelper.getString(json, "media_id"));
  button.setAppId(GsonHelper.getString(json, "appid"));
  button.setPagePath(GsonHelper.getString(json, "pagepath"));
  return button;
}
 
开发者ID:binarywang,项目名称:weixin-java-tools,代码行数:12,代码来源:WxMenuGsonAdapter.java

示例4: getMenu

import me.chanjar.weixin.common.bean.menu.WxMenuButton; //导入方法依赖的package包/类
@DataProvider(name = "menu")
public Object[][] getMenu() {
  WxMenu menu = new WxMenu();
  WxMenuButton button1 = new WxMenuButton();
  button1.setType(WxConsts.BUTTON_CLICK);
  button1.setName("今日歌曲");
  button1.setKey("V1001_TODAY_MUSIC");

  WxMenuButton button2 = new WxMenuButton();
  button2.setType(WxConsts.BUTTON_CLICK);
  button2.setName("歌手简介");
  button2.setKey("V1001_TODAY_SINGER");

  WxMenuButton button3 = new WxMenuButton();
  button3.setName("菜单");

  menu.getButtons().add(button1);
  menu.getButtons().add(button2);
  menu.getButtons().add(button3);

  WxMenuButton button31 = new WxMenuButton();
  button31.setType(WxConsts.BUTTON_VIEW);
  button31.setName("搜索");
  button31.setUrl("http://www.soso.com/");

  WxMenuButton button32 = new WxMenuButton();
  button32.setType(WxConsts.BUTTON_VIEW);
  button32.setName("视频");
  button32.setUrl("http://v.qq.com/");

  WxMenuButton button33 = new WxMenuButton();
  button33.setType(WxConsts.BUTTON_CLICK);
  button33.setName("赞一下我们");
  button33.setKey("V1001_GOOD");

  button3.getSubButtons().add(button31);
  button3.getSubButtons().add(button32);
  button3.getSubButtons().add(button33);

  return new Object[][]{
          new Object[]{
                  menu
          }
  };

}
 
开发者ID:11590692,项目名称:Wechat-Group,代码行数:47,代码来源:WxMenuAPITest.java

示例5: getMenu

import me.chanjar.weixin.common.bean.menu.WxMenuButton; //导入方法依赖的package包/类
@DataProvider(name = "menu")
public Object[][] getMenu() {
  WxMenu menu = new WxMenu();
  WxMenuButton button1 = new WxMenuButton();
  button1.setType(WxConsts.BUTTON_CLICK);
  button1.setName("今日歌曲");
  button1.setKey("V1001_TODAY_MUSIC");

  WxMenuButton button2 = new WxMenuButton();
  button2.setType(WxConsts.BUTTON_CLICK);
  button2.setName("歌手简介");
  button2.setKey("V1001_TODAY_SINGER");

  WxMenuButton button3 = new WxMenuButton();
  button3.setName("菜单");

  menu.getButtons().add(button1);
  menu.getButtons().add(button2);
  menu.getButtons().add(button3);

  WxMenuButton button31 = new WxMenuButton();
  button31.setType(WxConsts.BUTTON_VIEW);
  button31.setName("搜索");
  button31.setUrl("http://www.soso.com/");

  WxMenuButton button32 = new WxMenuButton();
  button32.setType(WxConsts.BUTTON_VIEW);
  button32.setName("视频");
  button32.setUrl("http://v.qq.com/");

  WxMenuButton button33 = new WxMenuButton();
  button33.setType(WxConsts.BUTTON_CLICK);
  button33.setName("赞一下我们");
  button33.setKey("V1001_GOOD");

  button3.getSubButtons().add(button31);
  button3.getSubButtons().add(button32);
  button3.getSubButtons().add(button33);

  return new Object[][]{
    new Object[]{
      menu
    }
  };

}
 
开发者ID:11590692,项目名称:Wechat-Group,代码行数:47,代码来源:WxMpMenuServiceImplTest.java

示例6: testToJson

import me.chanjar.weixin.common.bean.menu.WxMenuButton; //导入方法依赖的package包/类
@Test(dataProvider = "wxPushMenu")
public void testToJson(String json) {
  WxMenu menu = new WxMenu();
  WxMenuButton button1 = new WxMenuButton();
  button1.setType("click");
  button1.setName("今日歌曲");
  button1.setKey("V1001_TODAY_MUSIC");

  WxMenuButton button2 = new WxMenuButton();
  button2.setType("click");
  button2.setName("歌手简介");
  button2.setKey("V1001_TODAY_SINGER");

  WxMenuButton button3 = new WxMenuButton();
  button3.setName("菜单");

  menu.getButtons().add(button1);
  menu.getButtons().add(button2);
  menu.getButtons().add(button3);

  WxMenuButton button31 = new WxMenuButton();
  button31.setType("view");
  button31.setName("搜索");
  button31.setUrl("http://www.soso.com/");

  WxMenuButton button32 = new WxMenuButton();
  button32.setType("view");
  button32.setName("视频");
  button32.setUrl("http://v.qq.com/");

  WxMenuButton button33 = new WxMenuButton();
  button33.setType("click");
  button33.setName("赞一下我们");
  button33.setKey("V1001_GOOD");

  button3.getSubButtons().add(button31);
  button3.getSubButtons().add(button32);
  button3.getSubButtons().add(button33);

  Assert.assertEquals(menu.toJson(), json);
}
 
开发者ID:11590692,项目名称:Wechat-Group,代码行数:42,代码来源:WxMenuTest.java

示例7: menuData

import me.chanjar.weixin.common.bean.menu.WxMenuButton; //导入方法依赖的package包/类
@DataProvider
public Object[][] menuData() {
  WxMenu menu = new WxMenu();
  WxMenuButton button1 = new WxMenuButton();
  button1.setType(WxConsts.MenuButtonType.CLICK);
  button1.setName("今日歌曲");
  button1.setKey("V1001_TODAY_MUSIC");

  WxMenuButton button2 = new WxMenuButton();
  button2.setType(WxConsts.MenuButtonType.CLICK);
  button2.setName("歌手简介");
  button2.setKey("V1001_TODAY_SINGER");

  WxMenuButton button3 = new WxMenuButton();
  button3.setName("菜单");

  menu.getButtons().add(button1);
  menu.getButtons().add(button2);
  menu.getButtons().add(button3);

  WxMenuButton button31 = new WxMenuButton();
  button31.setType(WxConsts.MenuButtonType.VIEW);
  button31.setName("搜索");
  button31.setUrl("http://www.soso.com/");

  WxMenuButton button32 = new WxMenuButton();
  button32.setType(WxConsts.MenuButtonType.VIEW);
  button32.setName("视频");
  button32.setUrl("http://v.qq.com/");

  WxMenuButton button33 = new WxMenuButton();
  button33.setType(WxConsts.MenuButtonType.CLICK);
  button33.setName("赞一下我们");
  button33.setKey("V1001_GOOD");

  button3.getSubButtons().add(button31);
  button3.getSubButtons().add(button32);
  button3.getSubButtons().add(button33);

  return new Object[][]{
    new Object[]{
      menu
    }
  };

}
 
开发者ID:binarywang,项目名称:weixin-java-tools,代码行数:47,代码来源:WxCpMenuServiceImplTest.java

示例8: getMenu

import me.chanjar.weixin.common.bean.menu.WxMenuButton; //导入方法依赖的package包/类
@DataProvider(name = "menu")
  public Object[][] getMenu() {
    WxMenu menu = new WxMenu();
    WxMenuButton button1 = new WxMenuButton();
    button1.setType(WxConsts.MenuButtonType.CLICK);
    button1.setName("今日歌曲");
    button1.setKey("V1001_TODAY_MUSIC");

//    WxMenuButton button2 = new WxMenuButton();
//    button2.setType(WxConsts.MenuButtonType.MINIPROGRAM);
//    button2.setName("小程序");
//    button2.setAppId("wx286b93c14bbf93aa");
//    button2.setPagePath("pages/lunar/index.html");
//    button2.setUrl("http://mp.weixin.qq.com");

    WxMenuButton button3 = new WxMenuButton();
    button3.setName("菜单");

    menu.getButtons().add(button1);
//    menu.getButtons().add(button2);
    menu.getButtons().add(button3);

    WxMenuButton button31 = new WxMenuButton();
    button31.setType(WxConsts.MenuButtonType.VIEW);
    button31.setName("搜索");
    button31.setUrl("http://www.soso.com/");

    WxMenuButton button32 = new WxMenuButton();
    button32.setType(WxConsts.MenuButtonType.VIEW);
    button32.setName("视频");
    button32.setUrl("http://v.qq.com/");

    WxMenuButton button33 = new WxMenuButton();
    button33.setType(WxConsts.MenuButtonType.CLICK);
    button33.setName("赞一下我们");
    button33.setKey("V1001_GOOD");

    button3.getSubButtons().add(button31);
    button3.getSubButtons().add(button32);
    button3.getSubButtons().add(button33);

    return new Object[][]{
      new Object[]{
        menu
      }
    };

  }
 
开发者ID:binarywang,项目名称:weixin-java-tools,代码行数:49,代码来源:WxMpMenuServiceImplTest.java

示例9: getMenu

import me.chanjar.weixin.common.bean.menu.WxMenuButton; //导入方法依赖的package包/类
@DataProvider(name="menu")
public Object[][] getMenu() {
  WxMenu menu = new WxMenu();
  WxMenuButton button1 = new WxMenuButton();
  button1.setType(WxConsts.BUTTON_CLICK);
  button1.setName("今日歌曲");
  button1.setKey("V1001_TODAY_MUSIC");
  
  WxMenuButton button2 = new WxMenuButton();
  button2.setType(WxConsts.BUTTON_CLICK);
  button2.setName("歌手简介");
  button2.setKey("V1001_TODAY_SINGER");
  
  WxMenuButton button3 = new WxMenuButton();
  button3.setName("菜单");
  
  menu.getButtons().add(button1);
  menu.getButtons().add(button2);
  menu.getButtons().add(button3);
  
  WxMenuButton button31 = new WxMenuButton();
  button31.setType(WxConsts.BUTTON_VIEW);
  button31.setName("搜索");
  button31.setUrl("http://www.soso.com/");
  
  WxMenuButton button32 = new WxMenuButton();
  button32.setType(WxConsts.BUTTON_VIEW);
  button32.setName("视频");
  button32.setUrl("http://v.qq.com/");
  
  WxMenuButton button33 = new WxMenuButton();
  button33.setType(WxConsts.BUTTON_CLICK);
  button33.setName("赞一下我们");
  button33.setKey("V1001_GOOD");
  
  button3.getSubButtons().add(button31);
  button3.getSubButtons().add(button32);
  button3.getSubButtons().add(button33);
  
  return new Object[][] {
      new Object[] {
          menu
      }
  };

}
 
开发者ID:binarywang,项目名称:weixin-java-tools-for-JDK6,代码行数:47,代码来源:WxMpMenuServiceImplTest.java


注:本文中的me.chanjar.weixin.common.bean.menu.WxMenuButton.setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。