当前位置: 首页 > news >正文

一直往下get的map

一直往下get的map
文档:一直往下get的map.note
链接:http://note.youdao.com/noteshare?id=7b6d315d86ce9e5f8d7cac9be8e924b8&sub=95F9FFDA8EB447BBA506286E261F4C88
添加链接描述

package com.example.demo.entity;import org.bson.Document;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import top.starp.util.MapUtil;import java.util.*;//HashMap<String ,Object>
//extends Map<? ,?>
// HashMap<? ,?>
// extends HashMap<String ,Object>
public class TableDataItemextends HashMap<String ,Object>implementsMap<String, Object>,java.io.Serializable {
//    Object g(Object key){
//        Object o = get(key);
//        return  o;
//    }public TableDataItem(){
//       Document}public TableDataItem get(String ...keys){return  get(this,keys);
//        TableDataItem tableDataItem=this;
//        for (String key : keys) {
//            tableDataItem= tableDataItem.getNext(key);
//        }
//        return tableDataItem;}public TableDataItem get(String keys){return  get(this,keys);}public static TableDataItem get(TableDataItem tableDataItem,String ...keys){
//        TableDataItem tableDataItem=this;for (String key : keys) {tableDataItem= tableDataItem.getNext(key);}return tableDataItem;}public static TableDataItem get(TableDataItem tableDataItem,String keys){String[] split = keys.split("\\.");return get(tableDataItem,split);
//        TableDataItem tableDataItem=this;
//        for (String key : split) {
//            tableDataItem= tableDataItem.getNext(key);
//        }
//        return tableDataItem;}public static Map<String, Object> getMap(Map<String, Object> mapNoType, Object key) {Map<String, Object> data = (Map<String, Object>) mapNoType.get(key);
//        data.getreturn data;}public static TableDataItem of(String key, Object value){TableDataItem tableDataItem = new TableDataItem();Object put = tableDataItem.put(key, value);return tableDataItem;}public static TableDataItem of(Map<String ,Object>map){TableDataItem tableDataItem = new TableDataItem();tableDataItem.putAll(map);
//        Object put = tableDataItem.put(key, value);return tableDataItem;}public static List<TableDataItem> of( List< Map<String ,Object>> map){List<TableDataItem>tableDataItems=new ArrayList<>();for (Map<String, Object> stringObjectMap : map) {TableDataItem tableDataItem = new TableDataItem();tableDataItem.putAll(stringObjectMap);tableDataItems.add(tableDataItem);}
//        TableDataItem tableDataItem = new TableDataItem();
//        tableDataItem.putAll(map);
        Object put = tableDataItem.put(key, value);return tableDataItems;}public static void main(String[] args) {
//        TableDataItem.pTableDataItem tableDataItem2 = new TableDataItem();
//        tableDataItem2.TableDataItem tableDataItem = new TableDataItem();
//        tableDataItem.put("1",new TableDataItem());tableDataItem.put("1",TableDataItem.of("2","3131"));/*** tableDataItem1* {2=3131}*/
//        TableDataItem tableDataItem1 = tableDataItem.get("1");TableDataItem tableDataItem1 = tableDataItem.getNext("1");System.out.println("tableDataItem1");System.out.println(tableDataItem1);}//    @Overridepublic TableDataItem getNext(Object key) {HashMap <String ,Object> next= (HashMap<String ,Object>)  super.get(key);TableDataItem tableDataItem = new TableDataItem();tableDataItem.putAll(next);return  tableDataItem;
//        return  (TableDataItem) super.get(key);}public TableDataItem g(Object key) {return getNext(key);}public String getStr(String key) {String string = MapUtil.getString(this, key);return string;}Map<?, ?> getMap(Object key){Map<?, ?> map = MapUtil.getMap(this, key);return  map;}/
//        return 0;
}@ApiOperation(value = "tableDataItemShow", notes = "walking")@RequestMapping(value = "/tableDataItemShow", method = RequestMethod.POST)public   Object tableDataItemShow(@RequestBody TableDataItem tableDataItem){log.info("tableDataItem {}",tableDataItem);
//        creator//        TableDataItem haha = tableDataItem.get(k.creator).get("xixi").get("haha");
//        TableDataItem haha = tableDataItem.get(k.creator).getN("xixi").get("haha");TableDataItem haha = tableDataItem.getNext(k.creator).getNext("xixi").getNext("haha");log.info("haha {}",haha);/***  tableDataItem2_haha {hoho=1}* 2023-08-17 21:24:59.305  INFO 10540 --- [nio-8889-exec-2] c.example.demo.controller.AllController  : tableDataItem1_ll {hoho=1}*/TableDataItem tableDataItem2_haha = tableDataItem.get("creator.xixi.haha");log.info("tableDataItem2_haha {}",tableDataItem2_haha);//        TableDataItem.get
//        TableDataItem tableDataItem1 = TableDataItem.get(tableDataItem, "31", "3131", "313", "3141");TableDataItem tableDataItem1_ll = TableDataItem.get(tableDataItem, "creator", "xixi", "haha");log.info("tableDataItem1_ll {}",tableDataItem1_ll);String str1Hoho = haha.getStr("hoho");log.info("str1Hoho {}",str1Hoho);
//        TableDataItem tableDataItem2 = tableDataItem.get(k.creator).get("xixi").get("haha").get("hoho");
//        String str = tableDataItem.get(k.creator).get("xixi").get("haha").getStr("hoho");String str = tableDataItem.getNext(k.creator).getNext("xixi").getNext("haha").getStr("hoho");log.info("str {}",str);//        String str1 = tableDataItem.g("da").g("da").g("dada").g("313").getStr("3131");
//        log.info("tableDataItem2 {}",tableDataItem2);
//        log.info("tableDataItem2 {}",tableDataItem2);
//        TableDataItem tableDataItem1 = tableDataItem.get(k.modelPath).get("31").get("31");
//        log.info("tableDataItem1 {}",tableDataItem1);return tableDataItem;}
http://www.lryc.cn/news/128203.html

相关文章:

  • Azure如何调整虚拟机的大小
  • stm32F103R6实现流水灯参考源代码
  • blender 发射体粒子
  • 你真的掌握了 Python 的七种参数了吗?
  • 人大进仓数据库ksql命令基础
  • 网站上的网页,无法通过百度和bing搜索引擎来搜索
  • Redis与MySQL的比较:什么情况下使用Redis更合适?什么情况下使用MySQL更合适?
  • 34_windows环境debug Nginx 源码-配置WSL和CLion
  • 单词倒排(C语言详解)
  • 一、数学建模之线性规划篇
  • 【推荐】深入浅出学习Spring框架【中】
  • 使用 HTML、CSS 和 JavaScript 创建多步骤表单
  • C语言笔试训练【第九天】
  • 左邻右舍裂差法求和 以及 连续自然数的立方和公式
  • 阿里云故障洞察提效 50%,全栈可观测建设有哪些技术要点?
  • docker run 命令30个常用参数详解
  • [kali]kali linux镜像下载地址
  • 考研408 | 【操作系统】操作系统的概述
  • VM部署CentOS并且设置网络
  • 多维时序 | MATLAB实现KOA-CNN-BiGRU-Attention多变量时间序列预测
  • 深入Redis线程模型
  • idea cannot download sources 解决方法
  • CS:GO升级 Linux不再是“法外之地”
  • 手写spring笔记
  • shell的两种属性: 交互(interactive)与登录(login)
  • 实现简单的element-table的拖拽效果
  • Web网页浏览器远程访问jupyter notebook服务器【内网穿透】
  • 干翻Dubbo系列第十一篇:Dubbo常见协议与通信效率对比
  • 春秋云镜 CVE-2020-17530
  • 【java毕业设计】基于Spring Boot+Vue+mysql的论坛管理系统设计与实现(程序源码)-论坛管理系统