Search in sources :

Example 1 with NullConverter

use of org.talend.components.netsuite.avro.converter.NullConverter in project components by Talend.

the class NsObjectTransducer method getValueConverter.

/**
 * Get value converter for given field descriptor.
 *
 * @param fieldDesc field descriptor
 * @return value converter
 */
public AvroConverter<?, ?> getValueConverter(FieldDesc fieldDesc) {
    Class<?> valueClass;
    if (fieldDesc instanceof CustomFieldDesc) {
        CustomFieldDesc customFieldDesc = (CustomFieldDesc) fieldDesc;
        CustomFieldRefType customFieldRefType = customFieldDesc.getCustomFieldType();
        valueClass = getCustomFieldValueConverterTargetClass(customFieldRefType);
    } else {
        valueClass = fieldDesc.getValueType();
    }
    AvroConverter<?, ?> converter = null;
    if (valueClass != null) {
        converter = getValueConverter(valueClass);
    }
    if (converter == null) {
        converter = new NullConverter(valueClass, null);
    }
    return converter;
}
Also used : NullConverter(org.talend.components.netsuite.avro.converter.NullConverter) CustomFieldRefType(org.talend.components.netsuite.client.model.customfield.CustomFieldRefType) CustomFieldDesc(org.talend.components.netsuite.client.model.CustomFieldDesc)

Aggregations

NullConverter (org.talend.components.netsuite.avro.converter.NullConverter)1 CustomFieldDesc (org.talend.components.netsuite.client.model.CustomFieldDesc)1 CustomFieldRefType (org.talend.components.netsuite.client.model.customfield.CustomFieldRefType)1