コード例 #1
0
        internal ClassMetadata ProduceClassMetadata(IReflectClass reflectClazz)
        {
            ClassMetadata classMetadata = ClassMetadataForReflectClass(reflectClazz);

            if (classMetadata != null)
            {
                return(classMetadata);
            }
            ClassMetadata classBeingCreated = (ClassMetadata)_creating.Get(reflectClazz);

            if (classBeingCreated != null)
            {
                return(classBeingCreated);
            }
            ClassMetadata newClassMetadata = new ClassMetadata(Container(), reflectClazz);

            _creating.Put(reflectClazz, newClassMetadata);
            try
            {
                if (!CreateClassMetadata(newClassMetadata, reflectClazz))
                {
                    return(null);
                }
                // ObjectContainerBase#createClassMetadata may add the ClassMetadata already,
                // so we have to check again
                if (!IsRegistered(reflectClazz))
                {
                    AddClassMetadata(newClassMetadata);
                    _classInits.Process(newClassMetadata);
                }
                else
                {
                    RegisterClassMetadataById(newClassMetadata);
                    if (newClassMetadata.AspectsAreNull())
                    {
                        _classInits.Process(newClassMetadata);
                    }
                }
                Container().SetDirtyInSystemTransaction(this);
            }
            finally
            {
                _creating.Remove(reflectClazz);
            }
            return(newClassMetadata);
        }
コード例 #2
0
 public virtual void CheckClassHasFields(ClassMetadata classMetadata)
 {
     if (classMetadata.AspectsAreNull() || classMetadata.DeclaredAspectCount() == 0)
     {
         string   name            = classMetadata.GetName();
         string[] ignoredPackages = new string[] { "java.util." };
         for (int i = 0; i < ignoredPackages.Length; i++)
         {
             if (name.IndexOf(ignoredPackages[i]) == 0)
             {
                 return;
             }
         }
         if (IsDb4oClass(classMetadata))
         {
             return;
         }
         OnDiagnostic(new ClassHasNoFields(name));
     }
 }
コード例 #3
0
ファイル: DiagnosticProcessor.cs プロジェクト: masroore/db4o
 public virtual void CheckClassHasFields(ClassMetadata classMetadata)
 {
     if (classMetadata.AspectsAreNull() || classMetadata.DeclaredAspectCount() == 0)
     {
         var name = classMetadata.GetName();
         string[] ignoredPackages = {"java.util."};
         for (var i = 0; i < ignoredPackages.Length; i++)
         {
             if (name.IndexOf(ignoredPackages[i]) == 0)
             {
                 return;
             }
         }
         if (IsDb4oClass(classMetadata))
         {
             return;
         }
         OnDiagnostic(new ClassHasNoFields(name));
     }
 }