@ExportAsService({TwoInputValue.class})
public class TwoInputValue extends AbstractMultiCFType {
private static final Logger log = LoggerFactory.getLogger(TwoInputValue.class);
@ComponentImport
private CustomFieldValuePersister customFieldValuePersister;
@ComponentImport
private GenericConfigManager genericConfigManager;
protected TwoInputValue(CustomFieldValuePersister customFieldValuePersister, GenericConfigManager genericConfigManager) {
super(customFieldValuePersister, genericConfigManager);
this.genericConfigManager = genericConfigManager;
this.customFieldValuePersister = customFieldValuePersister;
}
@Nullable
protected Comparator<Carrier> getTypeComparator() {
return null;
}
@Nullable
protected Object convertTypeToDbValue(@Nullable Carrier carrier) {
return null;
}
@Nullable
protected Carrier convertDbValueToType(@Nullable Object o) {
return null;
}
@Nonnull
protected PersistenceFieldType getDatabaseType() {
return PersistenceFieldType.TYPE_UNLIMITED_TEXT;
}
public String getStringFromSingularObject(Carrier carrier) {
System.out.println("getStringFromSingularObject0000");
if (carrier==null){
return null;
}
return carrier.toString();
}
/**
* This method converts a string taken from the database such as “42.0###The answer” into a Carrier object.
* 数据库里的值如42.0###The answer 转化到carrier中
* @return
* @throws FieldValidationException
*/
public Carrier getSingularObjectFromString(String s) throws FieldValidationException {
System.out.println("getSingularObjectFromString````111"+s);
/*String[] ss=s.split("###");*/
Carrier carrier= new Carrier();
carrier.setAmount(Double.parseDouble(s));
carrier.setNote(s);
return carrier;
}
public void validateFromParams(CustomFieldParams customFieldParams, ErrorCollection errorCollection, FieldConfig fieldConfig) {
try {
this.getValueFromCustomFieldParams(customFieldParams);
} catch (FieldValidationException var5) {
System.out.println("错了");
errorCollection.addError(fieldConfig.getCustomField().getId(), var5.getMessage(), ErrorCollection.Reason.VALIDATION_FAILED);
}
}
public Collection<Carrier> getValueFromCustomFieldParams(CustomFieldParams customFieldParams) throws FieldValidationException {
System.out.println("我被处罚啦~~");
Collection normalParams = customFieldParams.getAllValues();
ArrayList<Carrier> list= Lists.newArrayList(normalParams.iterator());
return null;
}
public Object getStringValueFromCustomFieldParams(CustomFieldParams customFieldParams) {
System.out.println(customFieldParams.getCustomField().getName());
return null;
}
}
I don’t know how to complete the method after extends the AbstractMultiCFType class