/// <summary> /// Looks up and returns a cached mapped property's descriptor. /// </summary> /// <param name="propertyName">to look up</param> /// <returns>property descriptor</returns> public PropertyStem GetMappedProperty(string propertyName) { if (PropertyResolutionStyle.Equals(PropertyResolutionStyle.CASE_SENSITIVE)) { return Stem.MappedPropertyDescriptors.Get(propertyName); } if (PropertyResolutionStyle.Equals(PropertyResolutionStyle.CASE_INSENSITIVE)) { var propertyInfos = Stem.MappedSmartPropertyTable.Get(propertyName.ToLowerInvariant()); return propertyInfos?[0].Descriptor; } if (PropertyResolutionStyle.Equals(PropertyResolutionStyle.DISTINCT_CASE_INSENSITIVE)) { var propertyInfos = Stem.MappedSmartPropertyTable.Get(propertyName.ToLowerInvariant()); if (propertyInfos != null) { if (propertyInfos.Count != 1) { throw new EPException( "Unable to determine which property to use for \"" + propertyName + "\" because more than one property matched"); } return propertyInfos[0].Descriptor; } } return null; }
/// <summary> /// Looks up and returns a cached indexed property's descriptor. /// </summary> /// <param name="propertyName">to look up</param> /// <returns>property descriptor</returns> public InternalEventPropDescriptor GetIndexedProperty(string propertyName) { if (PropertyResolutionStyle.Equals(PropertyResolutionStyle.CASE_SENSITIVE)) { return _indexedPropertyDescriptors.Get(propertyName); } if (PropertyResolutionStyle.Equals(PropertyResolutionStyle.CASE_INSENSITIVE)) { IList<SimplePropertyInfo> propertyInfos = _indexedSmartPropertyTable.Get(propertyName.ToLowerInvariant()); return propertyInfos != null ? propertyInfos[0].Descriptor : null; } if (PropertyResolutionStyle.Equals(PropertyResolutionStyle.DISTINCT_CASE_INSENSITIVE)) { IList<SimplePropertyInfo> propertyInfos = _indexedSmartPropertyTable.Get(propertyName.ToLowerInvariant()); if (propertyInfos != null) { if (propertyInfos.Count != 1) { throw new EPException( "Unable to determine which property to use for \"" + propertyName + "\" because more than one property matched"); } return propertyInfos[0].Descriptor; } } return null; }
public BeanEventTypeStemBuilder( ConfigurationCommonEventTypeBean optionalConfig, PropertyResolutionStyle defaultPropertyResolutionStyle) { _optionalConfig = optionalConfig; if (optionalConfig != null) { _propertyResolutionStyle = optionalConfig.PropertyResolutionStyle; } else { _propertyResolutionStyle = defaultPropertyResolutionStyle; } _smartResolutionStyle = _propertyResolutionStyle.Equals(PropertyResolutionStyle.CASE_INSENSITIVE) || _propertyResolutionStyle.Equals(PropertyResolutionStyle.DISTINCT_CASE_INSENSITIVE); }
private SimplePropertyInfo GetSimplePropertyInfo(string propertyName) { SimplePropertyInfo propertyInfo; IList<SimplePropertyInfo> simplePropertyInfoList; if (PropertyResolutionStyle.Equals(PropertyResolutionStyle.CASE_SENSITIVE)) { return _simpleProperties.Get(propertyName); } if (PropertyResolutionStyle.Equals(PropertyResolutionStyle.CASE_INSENSITIVE)) { propertyInfo = _simpleProperties.Get(propertyName); if (propertyInfo != null) { return propertyInfo; } simplePropertyInfoList = _simpleSmartPropertyTable.Get(propertyName.ToLowerInvariant()); return simplePropertyInfoList != null ? simplePropertyInfoList[0] : null; } if (PropertyResolutionStyle.Equals(PropertyResolutionStyle.DISTINCT_CASE_INSENSITIVE)) { propertyInfo = _simpleProperties.Get(propertyName); if (propertyInfo != null) { return propertyInfo; } simplePropertyInfoList = _simpleSmartPropertyTable.Get(propertyName.ToLowerInvariant()); if (simplePropertyInfoList != null) { if (simplePropertyInfoList.Count != 1) { throw new EPException( "Unable to determine which property to use for \"" + propertyName + "\" because more than one property matched"); } return simplePropertyInfoList[0]; } } return null; }