29d4fc0499840561bd1610d8ed043dcd11bf99af
[ccsdk/features.git] /
1 package org.onap.ccsdk.features.sdnr.wt.yang.mapper.serialize;
2
3 import com.fasterxml.jackson.core.JsonGenerator;
4 import com.fasterxml.jackson.databind.JsonSerializer;
5 import com.fasterxml.jackson.databind.SerializerProvider;
6 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
7
8 import java.io.IOException;
9
10 public class BaseIdentitySerializer extends JsonSerializer<BaseIdentity> {
11
12     @Override
13     public void serialize(BaseIdentity value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
14         String clsName = value.getClass().getName();
15         int idx = clsName.indexOf("$");
16         if(idx>0){
17             clsName = clsName.substring(0,idx);
18         }
19         gen.writeString(clsName);
20     }
21 }