コード例 #1
0
        private ClassBridgeMapping BuildClassBridge(IClassBridgeDefinition ann, Analyzer parentAnalyzer)
        {
            var classAnalyzer = GetAnalyzerByType(ann.Analyzer) ?? parentAnalyzer;

            return(new ClassBridgeMapping(ann.Name, BridgeFactory.ExtractType(ann))
            {
                Boost = ann.Boost,
                Analyzer = classAnalyzer,
                Index = ann.Index,
                Store = ann.Store
            });
        }
コード例 #2
0
        public static IFieldBridge ExtractType(IClassBridgeDefinition cb)
        {
            IFieldBridge bridge = null;

            if (cb != null)
            {
                System.Type impl = cb.Impl;

                if (impl != null)
                {
                    try
                    {
                        object instance = Activator.CreateInstance(impl);
                        if (instance is IFieldBridge)
                        {
                            bridge = (IFieldBridge) instance;
                        }

                        if (cb.Parameters.Count > 0 && instance is IParameterizedBridge)
                        {
                            // Already converted the parameters by this stage
                            ((IParameterizedBridge) instance).SetParameterValues(cb.Parameters);
                        }
                    }
                    catch (Exception e)
                    {
                        // TODO add classname
                        throw new HibernateException("Unable to instantiate IFieldBridge for " + cb.Name, e);
                    }
                }
            }
            // TODO add classname
            if (bridge == null)
            {
                throw new HibernateException("Unable to guess IFieldBridge ");
            }

            return bridge;
        }
コード例 #3
0
        public static IFieldBridge ExtractType(IClassBridgeDefinition cb)
        {
            IFieldBridge bridge = null;

            if (cb != null)
            {
                System.Type impl = cb.Impl;

                if (impl != null)
                {
                    try
                    {
                        object instance = Activator.CreateInstance(impl);
                        if (instance is IFieldBridge)
                        {
                            bridge = (IFieldBridge)instance;
                        }

                        if (cb.Parameters.Count > 0 && instance is IParameterizedBridge)
                        {
                            // Already converted the parameters by this stage
                            ((IParameterizedBridge)instance).SetParameterValues(cb.Parameters);
                        }
                    }
                    catch (Exception e)
                    {
                        // TODO add classname
                        throw new HibernateException("Unable to instantiate IFieldBridge for " + cb.Name, e);
                    }
                }
            }
            // TODO add classname
            if (bridge == null)
            {
                throw new HibernateException("Unable to guess IFieldBridge ");
            }

            return(bridge);
        }
コード例 #4
0
 private ClassBridgeMapping BuildClassBridge(IClassBridgeDefinition ann, Analyzer parentAnalyzer)
 {
     var classAnalyzer = GetAnalyzerByType(ann.Analyzer) ?? parentAnalyzer;
     return new ClassBridgeMapping(ann.Name, BridgeFactory.ExtractType(ann))
     {
         Boost = ann.Boost,
         Analyzer = classAnalyzer,
         Index = ann.Index,
         Store = ann.Store
     };
 }