CustomField: PropertyConverter

I’m getting confused with the PropertyConverter<PC, FC> class in CustomField add-on. Shouldn’t the getType() return a Class instead of a Class since both getValue() and setValue() return and receive FC values?

What I’m attempting to do is an editor for joda.time.Partial where I store month/year values, here’s my code:

public class PartialEditor extends PopupDateField {
    private static class DateFieldConverter extends PropertyConverter<Partial, Date> {
	public DateFieldConverter(Property propertyDataSource) {
	    super(propertyDataSource);
	}

	@Override
	public Partial parse(Date date) throws ConversionException {
	    if (date == null) {
		return null;
	    }
	    Calendar cal = Calendar.getInstance();
	    cal.setTime(date);
	    return new Partial().with(DateTimeFieldType.year(), cal.get(Calendar.YEAR)).with(DateTimeFieldType.monthOfYear(),
		    cal.get(Calendar.MONTH));
	}

	@Override
	public Date format(Partial partial) {
	    return partial == null ? null : partial.toDateTime(new DateTime()).toDate();
	}
    }

    public PartialEditor() {
	setResolution(DateField.RESOLUTION_MONTH);
    }

    @Override
    public void setPropertyDataSource(Property newDataSource) {
	super.setPropertyDataSource(new DateFieldConverter(newDataSource));
    }
}

This blows up in the PopupDateField that is expecting a property of Date.class and gets a Partial.class one.

The
documentation
says:

It seems to me you are doing things the wrong way around. Try to declare that your class
extends PropertyConverter<Date, Partial>
(instead of
<Partial, Date>
) and adjust your
parse(…)
and
format(…)
methods accordingly.
Does that help?

I think this is an issue.

I opened a defect here:
https://code.google.com/p/customfield/issues/detail?id=6

I put my reasoning in that ticket.