public static FlexCollection UnwrapEventBeans( EventBeanTypedEventFactory eventBeanTypedEventFactory, BeanEventType type, IEnumerable enumerable) { return FlexCollection.Of( enumerable .Cast<object>() .Select(value => eventBeanTypedEventFactory.AdapterForTypedObject(value, type)) .ToList()); }
public static FlexCollection EvaluateEnumMethodTakeLast( FlexCollection enumcoll, int size) { if (enumcoll.IsEventBeanCollection) { return FlexCollection.Of( EvaluateEnumMethodTakeLast(enumcoll.EventBeanCollection, size)); } return FlexCollection.Of( EvaluateEnumMethodTakeLast(enumcoll.ObjectCollection, size)); }
public static FlexCollection EnumExceptForgeEvalSet( FlexCollection other, FlexCollection enumcoll) { if (other.IsEventBeanCollection) { if (enumcoll.IsEventBeanCollection) { return FlexCollection.Of(EnumExceptForgeEvalSet( other.EventBeanCollection, enumcoll.EventBeanCollection)); } } else if (enumcoll.IsObjectCollection) { return FlexCollection.Of(EnumExceptForgeEvalSet( other.ObjectCollection, enumcoll.ObjectCollection)); } throw new ArgumentException("mismatch in FlexCollection types"); }
public static FlexCollection ConvertToCollection( string propertyName, object value) { if (value == null) { return null; } if (value is string stringValue) { // Convert to a collection of characters return FlexCollection.Of( stringValue .ToCharArray() .Cast<object>() .ToList()); } Log.Warn( "Expected string-type input from property '" + propertyName + "' but received " + value.GetType()); return null; }
/// <summary> /// NOTE: Code-generation-invoked method, method name and parameter order matters /// </summary> /// <param name="enumcoll">collection</param> /// <param name="size">size</param> /// <returns>collection</returns> public static FlexCollection EvaluateEnumTakeMethod( FlexCollection enumcoll, int size) { if (enumcoll.Count == 0) { return FlexCollection.Empty; } if (size <= 0) { return FlexCollection.Empty; } if (enumcoll.Count < size) { return enumcoll; } if (size == 1) { if (enumcoll.IsEventBeanCollection) { return FlexCollection.OfEvent( enumcoll.EventBeanCollection.First()); } else { return FlexCollection.OfObject( enumcoll.ObjectCollection.First()); } } if (enumcoll.IsEventBeanCollection) { return FlexCollection.Of( enumcoll.EventBeanCollection .Take(size) .ToList()); } return FlexCollection.Of( enumcoll.ObjectCollection .Take(size) .ToList()); }
public static FlexCollection AsFlexCollection(this object value) { return(FlexCollection.Of(value)); }