public override System.Collections.Generic.IEnumerable <System.Type> ToIterable(object context) { System.Collections.Generic.IList <Net.Vpc.Upa.Config.ScanFilter> _filters = new System.Collections.Generic.List <Net.Vpc.Upa.Config.ScanFilter>(); if (context is Net.Vpc.Upa.UPAContext) { Net.Vpc.Upa.UPAContext pg = (Net.Vpc.Upa.UPAContext)context; Net.Vpc.Upa.Impl.FwkConvertUtils.ListAddRange(_filters, new System.Collections.Generic.List <Net.Vpc.Upa.Config.ScanFilter>(pg.GetContextAnnotationStrategyFilters())); } else if (context is Net.Vpc.Upa.PersistenceGroup) { Net.Vpc.Upa.PersistenceGroup pg = (Net.Vpc.Upa.PersistenceGroup)context; foreach (Net.Vpc.Upa.Config.ScanFilter filter in pg.GetContext().GetContextAnnotationStrategyFilters()) { if (filter.IsPropagate()) { _filters.Add(filter); } } Net.Vpc.Upa.Impl.FwkConvertUtils.ListAddRange(_filters, new System.Collections.Generic.List <Net.Vpc.Upa.Config.ScanFilter>(pg.GetContextAnnotationStrategyFilters())); } else if (context is Net.Vpc.Upa.PersistenceUnit) { Net.Vpc.Upa.PersistenceUnit pu = (Net.Vpc.Upa.PersistenceUnit)context; foreach (Net.Vpc.Upa.Config.ScanFilter filter in pu.GetPersistenceGroup().GetContext().GetContextAnnotationStrategyFilters()) { if (filter.IsPropagate()) { _filters.Add(filter); } } foreach (Net.Vpc.Upa.Config.ScanFilter filter in pu.GetPersistenceGroup().GetContextAnnotationStrategyFilters()) { if (filter.IsPropagate()) { _filters.Add(filter); } } foreach (Net.Vpc.Upa.Config.ScanFilter filter in pu.GetContextAnnotationStrategyFilters()) { _filters.Add(filter); } } else { throw new System.ArgumentException("Unsupported context " + context); } return(new Net.Vpc.Upa.Impl.Util.Classpath.URLClassIterable(Net.Vpc.Upa.Impl.Util.Classpath.ClassPathUtils.ResolveClassPathLibs(), new Net.Vpc.Upa.Impl.Util.Classpath.DefaultConfigFilter(_filters.ToArray()), null)); }
public virtual Net.Vpc.Upa.EntityDescriptor Resolve(object source) /* throws Net.Vpc.Upa.Exceptions.UPAException */ { if (source == null) { throw new System.ArgumentException("null entity descriptor"); } if (source is Net.Vpc.Upa.EntityDescriptor) { return((Net.Vpc.Upa.EntityDescriptor)source); } if (source is System.Type) { System.Collections.Generic.List <System.Type> classesColl = new System.Collections.Generic.List <System.Type>(); classesColl.Add((System.Type)source); source = classesColl; } else if (source is System.Type[]) { System.Collections.Generic.List <System.Type> classesColl = new System.Collections.Generic.List <System.Type>(); foreach (object o in (System.Type[])source) { if (o is System.Type) { classesColl.Add((System.Type)o); } else { classesColl = null; break; } } source = classesColl; } else if (IsCollection(source)) { System.Collections.Generic.List <System.Type> classesColl = new System.Collections.Generic.List <System.Type>(); foreach (object o in (System.Collections.Generic.ICollection <object>)source) { if (o is System.Type) { classesColl.Add((System.Type)o); } else { throw new Net.Vpc.Upa.Exceptions.UPAException(new Net.Vpc.Upa.Types.I18NString("ExpectedEntityDescriptorOrAnnotatedClass")); } } } if (IsCollection(source)) { System.Collections.Generic.ICollection <System.Type> classesColl = (System.Collections.Generic.ICollection <System.Type>)source; if ((classesColl.Count == 0)) { throw new Net.Vpc.Upa.Exceptions.UPAException(new Net.Vpc.Upa.Types.I18NString("ExpectedEntityDescriptorOrAnnotatedClass")); } System.Type[] classes = classesColl.ToArray(); persistenceUnit.Scan(persistenceUnit.GetPersistenceGroup().GetContext().GetFactory().CreateClassScanSource(classes, true), null, false); return(annotationParser.Resolve(classes)); } throw new Net.Vpc.Upa.Exceptions.UPAException(new Net.Vpc.Upa.Types.I18NString("ExpectedEntityDescriptorOrAnnotatedClass")); }