自动化立体仓库 - WCS系统
Junjie
2023-05-18 5ac625f324a7bb1656b319348cabfd13467467ef
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.zy.common.utils;
 
import com.zy.common.model.QuotedString;
 
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.nodes.Node;
import org.yaml.snakeyaml.nodes.Tag;
import org.yaml.snakeyaml.representer.Represent;
import org.yaml.snakeyaml.representer.Representer;
 
public class MyRepresenter extends Representer {
 
    public MyRepresenter(){
        this.representers.put(QuotedString.class,new RepresenterQuotedString());
    }
    public class RepresenterQuotedString implements Represent {
        @Override
        public Node representData(Object o) {
            if (o instanceof QuotedString) {
                QuotedString str = (QuotedString) o;
                return representScalar(Tag.STR, str.value, DumperOptions.ScalarStyle.DOUBLE_QUOTED);
            }
            return null;
        }
    }
 
}