@Override
    public void serialize(T object, String fieldName, boolean writeFieldNameForObject, JsonGenerator jsonGenerator) throws IOException {
        if (fieldName != null) {
            jsonGenerator.writeNumberField(fieldName, convertToInt(object));
        } else {
            jsonGenerator.writeNumber(convertToInt(object));
        }
    }
Called to convert a an object of type T into an int.

@param object The object being converted.
core/src/main/java/com/bluelinelabs/logansquare/typeconverters/IntBasedTypeConverter.java