示例#1
0
 public object Get(
     EventBean eventBean,
     int index)
 {
     var record = (GenericRecord) eventBean.Underlying;
     var values = record.Get(_pos);
     return AvroEventBeanGetterIndexed.GetAvroIndexedValue(values, index);
 }
        public object Get(EventBean eventBean)
        {
            var record = (GenericRecord) eventBean.Underlying;
            var inner = (GenericRecord) record.Get(_top);
            if (inner == null) {
                return null;
            }

            var collection = inner.Get(_pos);
            return AvroEventBeanGetterIndexed.GetAvroIndexedValue(collection, _index);
        }
 private Object Navigate(EventBean eventBean)
 {
     var record = (GenericRecord) eventBean.Underlying;
     var values = (ICollection<object>) record.Get(_posTop);
     Object value = AvroEventBeanGetterIndexed.GetIndexedValue(values, _index);
     if (value == null || !(value is GenericRecord))
     {
         return null;
     }
     for (int i = 0; i < _nested.Length - 1; i++)
     {
         value = _nested[i].GetAvroFieldValue((GenericRecord) value);
         if (value == null || !(value is GenericRecord))
         {
             return null;
         }
     }
     return value;
 }
        public static Object GetAvroFieldValue(GenericRecord record, String propertyName, int index)
        {
            var value = record.Get(propertyName);

            if (value is Array valueArray)
            {
                return(AvroEventBeanGetterIndexed.GetIndexedValue(valueArray, index));
            }

            if (value is IEnumerable <object> valueGenericEnum)
            {
                return(AvroEventBeanGetterIndexed.GetIndexedValue(valueGenericEnum, index));
            }

            if (value is IEnumerable valueEnum)
            {
                return(AvroEventBeanGetterIndexed.GetIndexedValue(valueEnum.Cast <object>(), index));
            }

            return(null);
        }
 public Object Get(EventBean eventBean, int index)
 {
     var record = (GenericRecord) eventBean.Underlying;
     var values = (ICollection<object>) record.Get(_pos);
     return AvroEventBeanGetterIndexed.GetIndexedValue(values, index);
 }