org.opentripplanner.model.json_serialization.BitSetSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of otp Show documentation
Show all versions of otp Show documentation
The OpenTripPlanner multimodal journey planning system
package org.opentripplanner.model.json_serialization;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
import java.util.BitSet;
/**
* Serialize a BitSet to an array [true, false . . .].
*/
public class BitSetSerializer extends JsonSerializer {
@Override public void serialize(BitSet bitSet, JsonGenerator jsonGenerator,
SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
jsonGenerator.writeStartArray();
for (int i = 0; i < bitSet.length(); i++) {
jsonGenerator.writeBoolean(bitSet.get(i));
}
jsonGenerator.writeEndArray();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy