public TypeWidenerSPI WidenerFor( string columnName, Type columnType, Type writeablePropertyType, string writeablePropertyName, string statementName) { TypeWidenerSPI widener; try { var context = new ObjectValueTypeWidenerFactoryContext( columnType, writeablePropertyName, _eventType, statementName); widener = _factory.Make(context); } catch (Exception ex) { throw new TypeWidenerException("Widener not available: " + ex.Message, ex); } if (widener != null) { return widener; } return AvroTypeWidenerCustomizerDefault.INSTANCE.WidenerFor( columnName, columnType, writeablePropertyType, writeablePropertyName, statementName); // default behavior applies otherwise }
public TypeWidener Make(ObjectValueTypeWidenerFactoryContext context) { _context = context; if (context.GetClazz() == typeof(DateTimeEx)) { return(MyDTXTypeWidener.INSTANCE.Widen); } if (context.GetClazz() == typeof(SupportBean)) { return((new MySupportBeanWidener()).Widen); } return(null); }
public TypeWidenerSPI Make(ObjectValueTypeWidenerFactoryContext context) { Context = context; var contextClazz = context.Clazz.GetBoxedType(); if (contextClazz == typeof(DateTimeOffset?)) { return MyDateTimeOffsetTypeWidener.INSTANCE; } if (contextClazz == typeof(SupportBean)) { return new MySupportBeanWidener(); } return null; }