1   /*
2    * SPDX-FileCopyrightText: none
3    * SPDX-License-Identifier: CC0-1.0
4    */
5   
6   package gov.nist.secauto.metaschema.schemagen.json.impl;
7   
8   import com.fasterxml.jackson.databind.node.ObjectNode;
9   
10  import gov.nist.secauto.metaschema.core.model.IInstanceAbsolute;
11  import gov.nist.secauto.metaschema.core.model.INamedInstance;
12  import gov.nist.secauto.metaschema.schemagen.json.IJsonGenerationState;
13  
14  import org.apache.commons.lang3.tuple.Pair;
15  
16  import edu.umd.cs.findbugs.annotations.NonNull;
17  import edu.umd.cs.findbugs.annotations.Nullable;
18  
19  public abstract class AbstractNamedInstanceJsonProperty<I extends IInstanceAbsolute & INamedInstance>
20      extends AbstractJsonProperty<I> {
21  
22    protected AbstractNamedInstanceJsonProperty(@NonNull I instance) {
23      super(instance);
24    }
25  
26    @Override
27    public String getName() {
28      return getInstance().getJsonName();
29    }
30  
31    @Nullable
32    protected String getJsonKeyFlagName() {
33      return null;
34    }
35  
36    @Nullable
37    protected Pair<String, String> getDiscriminator() {
38      return null;
39    }
40  
41    @Override
42    protected abstract void generateBody(
43        ObjectNode obj,
44        IJsonGenerationState state);
45  }