// EventPropertyGetterAndMapped public override EventPropertyGetterSPI GetGetter( BeanEventType eventType, EventBeanTypedEventFactory eventBeanTypedEventFactory, BeanEventTypeFactory beanEventTypeFactory) { var propertyDesc = eventType.GetMappedProperty(PropertyNameAtomic); if (propertyDesc == null) { return null; } if (propertyDesc.IsMappedReadMethod) { return new KeyedMethodPropertyGetter( propertyDesc.ReadMethod, Key, eventBeanTypedEventFactory, beanEventTypeFactory); } // Try the as a simple property if (!propertyDesc.PropertyType.IsSimple()) { return null; } var returnType = propertyDesc.ReturnType; if (returnType.IsGenericStringDictionary()) { return GetGetterFromDictionary( eventBeanTypedEventFactory, beanEventTypeFactory, propertyDesc); } return null; }
public override EventPropertyGetter GetGetter(BeanEventType eventType, EventAdapterService eventAdapterService) { InternalEventPropDescriptor propertyDesc = eventType.GetMappedProperty(PropertyNameAtomic); if (propertyDesc != null) { var method = propertyDesc.ReadMethod; var fastClass = eventType.FastClass; if (fastClass != null) { var fastMethod = fastClass.GetMethod(method); return(new KeyedFastPropertyGetter(fastMethod, _key, eventAdapterService)); } else { return(new KeyedMethodPropertyGetter(method, _key, eventAdapterService)); } } // Try the array as a simple property propertyDesc = eventType.GetSimpleProperty(PropertyNameAtomic); if (propertyDesc == null) { return(null); } var returnType = propertyDesc.ReturnType; // Unlike Java, CLR based maps are strongly typed ... the mechanics // for identifying and extracting the map contents are also different. if (!returnType.IsGenericStringDictionary()) { return(null); } if (propertyDesc.ReadMethod != null) { var fastClass = eventType.FastClass; var method = propertyDesc.ReadMethod; if (fastClass != null) { var fastMethod = fastClass.GetMethod(method); return(new KeyedMapFastPropertyGetter(method, fastMethod, _key, eventAdapterService)); } else { return(new KeyedMapMethodPropertyGetter(method, _key, eventAdapterService)); } } else { var field = propertyDesc.AccessorField; return(new KeyedMapFieldPropertyGetter(field, _key, eventAdapterService)); } }
public override GenericPropertyDesc GetPropertyTypeGeneric(BeanEventType eventType, EventAdapterService eventAdapterService) { var propertyDesc = eventType.GetMappedProperty(PropertyNameAtomic); if (propertyDesc != null) { return(new GenericPropertyDesc(propertyDesc.ReadMethod.ReturnType)); } // Check if this is an method returning array which is a type of simple property var descriptor = eventType.GetSimpleProperty(PropertyNameAtomic); if (descriptor == null) { return(null); } var returnType = descriptor.ReturnType; if (!returnType.IsGenericStringDictionary()) { return(null); } if (descriptor.ReadMethod != null) { var genericType = TypeHelper.GetGenericReturnTypeMap(descriptor.ReadMethod, false); return(new GenericPropertyDesc(genericType)); } else if (descriptor.AccessorField != null) { var genericType = TypeHelper.GetGenericFieldTypeMap(descriptor.AccessorField, false); return(new GenericPropertyDesc(genericType)); } else { return(null); } }
public override GenericPropertyDesc GetPropertyTypeGeneric( BeanEventType eventType, BeanEventTypeFactory beanEventTypeFactory) { var propertyDesc = eventType.GetMappedProperty(PropertyNameAtomic); if (propertyDesc == null) { return null; } if (propertyDesc.IsMappedReadMethod) { return new GenericPropertyDesc(propertyDesc.ReadMethod.ReturnType); } if (!propertyDesc.PropertyType.IsSimple()) { return null; } var returnType = propertyDesc.ReturnType; if (returnType.IsGenericStringDictionary()) { if (propertyDesc.AccessorProp != null) { var genericType = TypeHelper.GetGenericPropertyTypeMap(propertyDesc.AccessorProp, false); return new GenericPropertyDesc(genericType); } if (propertyDesc.ReadMethod != null) { var genericType = TypeHelper.GetGenericReturnTypeMap(propertyDesc.ReadMethod, false); return new GenericPropertyDesc(genericType); } if (propertyDesc.AccessorField != null) { var genericType = TypeHelper.GetGenericFieldTypeMap(propertyDesc.AccessorField, false); return new GenericPropertyDesc(genericType); } } return null; }
public override Type GetPropertyType( BeanEventType eventType, BeanEventTypeFactory beanEventTypeFactory) { var propertyDesc = eventType.GetMappedProperty(PropertyNameAtomic); if (propertyDesc == null) { return null; } if (propertyDesc.IsMappedReadMethod) { return propertyDesc.ReadMethod.ReturnType; } if (!propertyDesc.PropertyType.IsSimple()) { return null; } if (propertyDesc.AccessorProp != null) { var accessorPropType = propertyDesc.AccessorProp.PropertyType; AssertGenericDictionary(accessorPropType); return accessorPropType.GetDictionaryValueType(); } if (propertyDesc.IsSimpleReadMethod) { var accessorPropType = propertyDesc.ReadMethod.ReturnType; AssertGenericDictionary(accessorPropType); return accessorPropType.GetDictionaryValueType(); } if (propertyDesc.AccessorField != null) { var accessorFieldType = propertyDesc.AccessorField.FieldType; AssertGenericDictionary(accessorFieldType); return accessorFieldType.GetDictionaryValueType(); } throw new IllegalStateException($"invalid property descriptor: {propertyDesc}"); }