Ollama4j
A Java library (wrapper/binding) for Ollama server.
Loading...
Searching...
No Matches
BooleanToJsonFormatFlagSerializer.java
Go to the documentation of this file.
1package io.github.ollama4j.utils;
2
3import java.io.IOException;
4
5import com.fasterxml.jackson.core.JsonGenerator;
6import com.fasterxml.jackson.databind.JsonSerializer;
7import com.fasterxml.jackson.databind.SerializerProvider;
8
9public class BooleanToJsonFormatFlagSerializer extends JsonSerializer<Boolean>{
10
11 @Override
12 public void serialize(Boolean value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
13 gen.writeString("json");
14 }
15
16 @Override
17 public boolean isEmpty(SerializerProvider provider,Boolean value){
18 return !value;
19 }
20
21}
void serialize(Boolean value, JsonGenerator gen, SerializerProvider serializers)