{
// [JACKSON-684]: serialize as index?
if (visitor.getProvider().isEnabled(SerializationFeature.WRITE_ENUMS_USING_INDEX)) {
visitor.expectIntegerFormat(typeHint);
} else {
JsonStringFormatVisitor stringVisitor = visitor.expectStringFormat(typeHint);
if (typeHint != null && visitor != null) {
if (typeHint.isEnumType()) {
// important: ensure that order is retained
Set<String> enums = new LinkedHashSet<String>();
for (SerializedString value : _values.values()) {
enums.add(value.getValue());
}
stringVisitor.enumTypes(enums);
}
}
}
}