private void write( final Object value, final JsonGenerator jgen, final SerializerProvider provider) throws IOException { Class<?> type = value.getClass(); if (ClassUtils.isAssignable(type, _handledType)) { jgen.writeStartObject(); for (String fname : FluentBeanUtils.metadata(type).fieldNames()) { jgen.writeFieldName(fname); write(FluentBeanUtils.get(fname, value), jgen, provider); } jgen.writeEndObject(); } else { jgen.writeObject(value); } }
@SuppressWarnings({"unchecked"}) public FluentBeanSerializer(final Class<?> t) { super(t); if (!FluentBeanUtils.isFluentBean(t)) { throw new IllegalArgumentException("Class of type " + t + " is not a FluentBean"); } }