public IObjectClass ObjectClass(object clazz)
        {
            string className = null;

            if (clazz is string)
            {
                className = (string)clazz;
            }
            else
            {
                IReflectClass claxx = ReflectorFor(clazz);
                if (claxx == null)
                {
                    return(null);
                }
                className = claxx.GetName();
            }
            if (ReflectPlatform.FullyQualifiedName(typeof(object)).Equals(className))
            {
                throw new ArgumentException("Configuration of the Object class is not supported."
                                            );
            }
            Hashtable4   xClasses = ExceptionalClasses();
            Config4Class c4c      = (Config4Class)xClasses.Get(className);

            if (c4c == null)
            {
                c4c = new Config4Class(this, className);
                xClasses.Put(className, c4c);
            }
            return(c4c);
        }
 public ConfigurationIntrospector(Type type, Config4Class classConfig, IConfiguration config)
 {
     if (null == type) throw new ArgumentNullException("type");
     if (null == config) throw new ArgumentNullException("config");
     _type = type;
     _classConfig = classConfig;
     _config = config;
 }
        internal void InitConfiguration(string name)
        {
            Config4Class containingClassConfig = _containingClass.Config();

            if (containingClassConfig == null)
            {
                return;
            }
            _config = containingClassConfig.ConfigField(name);
        }
Beispiel #4
0
        internal static Config4Class ExtendConfiguration(IReflectClass clazz, IConfiguration config,
                                                         Config4Class classConfig)
        {
            var t = GetNetType(clazz);

            if (t == null)
            {
                return(classConfig);
            }
            var a = new ConfigurationIntrospector(t, classConfig, config);

            a.Apply();
            return(a.ClassConfiguration);
        }
        internal static bool IsCollectionTranslator(Config4Class config4class)
        {
            if (config4class != null)
            {
                IObjectTranslator ot = config4class.GetTranslator();
                if (ot != null)
                {
#if SILVERLIGHT
                    return(false);
#else
                    return(ot is TList || ot is TDictionary || ot is TQueue || ot is TStack);
#endif
                }
            }
            return(false);
        }
Beispiel #6
0
        private TernaryBool CallConstructorSpecialized(IReflectClass clazz)
        {
            Config4Class clazzConfig = _config.ConfigClass(clazz.GetName());

            if (clazzConfig != null)
            {
                TernaryBool res = clazzConfig.CallConstructor();
                if (!res.IsUnspecified())
                {
                    return(res);
                }
            }
            if (Platform4.IsEnum(_config.Reflector(), clazz))
            {
                return(TernaryBool.No);
            }
            IReflectClass ancestor = clazz.GetSuperclass();

            if (ancestor != null)
            {
                return(CallConstructorSpecialized(ancestor));
            }
            return(TernaryBool.Unspecified);
        }
		public IObjectClass ObjectClass(object clazz)
		{
			string className = null;
			if (clazz is string)
			{
				className = (string)clazz;
			}
			else
			{
				IReflectClass claxx = ReflectorFor(clazz);
				if (claxx == null)
				{
					return null;
				}
				className = claxx.GetName();
			}
			if (ReflectPlatform.FullyQualifiedName(typeof(object)).Equals(className))
			{
				throw new ArgumentException("Configuration of the Object class is not supported."
					);
			}
			Hashtable4 xClasses = ExceptionalClasses();
			Config4Class c4c = (Config4Class)xClasses.Get(className);
			if (c4c == null)
			{
				c4c = new Config4Class(this, className);
				xClasses.Put(className, c4c);
			}
			return c4c;
		}
        public Config4Class ConfigClass(string className)
        {
            Config4Class config = (Config4Class)ExceptionalClasses().Get(className);

            return(config);
        }
		private bool CascadeOnUpdate(Config4Class parentClassConfiguration)
		{
			return ((parentClassConfiguration != null && (parentClassConfiguration.CascadeOnUpdate
				().DefiniteYes())) || (_config != null && (_config.CascadeOnUpdate().DefiniteYes
				())));
		}
Beispiel #10
0
 internal static Config4Class ExtendConfiguration(IReflectClass clazz, IConfiguration config, Config4Class classConfig)
 {
     Type t = GetNetType(clazz);
     if (t == null)
     {
         return classConfig;
     }
     ConfigurationIntrospector a = new ConfigurationIntrospector(t, classConfig, config);
     a.Apply();
     return a.ClassConfiguration;
 }
Beispiel #11
0
 internal virtual void SetConfig(Config4Class config)
 {
     if (config == null)
     {
         return;
     }
     // The configuration can be set by a ObjectClass#readAs setting
     // from YapClassCollection, right after reading the meta information
     // for the first time. In that case we never change the setting
     if (_config == null)
     {
         _config = config;
     }
 }
Beispiel #12
0
 private void CheckAllConfiguredFieldsExist(Config4Class config)
 {
     var exceptionalFields = config.ExceptionalFieldsOrNull();
     if (exceptionalFields == null)
     {
         return;
     }
     var i = exceptionalFields.ValuesIterator();
     while (i.MoveNext())
     {
         var fieldConfig = (Config4Field) i.Current;
         if (!fieldConfig.Used())
         {
             ConfigImpl().DiagnosticProcessor().ObjectFieldDoesNotExist(GetName(), fieldConfig
                 .GetName());
         }
     }
 }
Beispiel #13
0
 private void InitializeFieldsConfiguration(Transaction systemTrans, Config4Class
     extendedConfig)
 {
     if (_aspects == null)
     {
         return;
     }
     for (var i = 0; i < _aspects.Length; i++)
     {
         if (_aspects[i] is FieldMetadata)
         {
             var field = (FieldMetadata) _aspects[i];
             var fieldName = field.GetName();
             if (!field.HasConfig() && extendedConfig != null && extendedConfig.ConfigField(fieldName
                 ) != null)
             {
                 field.InitConfiguration(fieldName);
             }
             field.InitConfigOnUp(systemTrans);
         }
     }
 }
Beispiel #14
0
 internal void InitConfigOnUp(Transaction systemTrans)
 {
     var extendedConfig = Platform4.ExtendConfiguration(_classReflector, _container
         .Configure(), _config);
     if (extendedConfig != null)
     {
         _config = extendedConfig;
     }
     if (_config == null)
     {
         return;
     }
     if (!StateOK())
     {
         return;
     }
     InitializeFieldsConfiguration(systemTrans, extendedConfig);
     CheckAllConfiguredFieldsExist(extendedConfig);
 }
 private bool CascadeOnUpdate(Config4Class parentClassConfiguration)
 {
     return((parentClassConfiguration != null && (parentClassConfiguration.CascadeOnUpdate
                                                      ().DefiniteYes())) || (_config != null && (_config.CascadeOnUpdate().DefiniteYes
                                                                                                     ())));
 }
Beispiel #16
0
		protected Config4Field(Config4Class a_class, KeySpecHashtable4 config) : base(config
			)
		{
			_configClass = a_class;
		}
Beispiel #17
0
		internal Config4Field(Config4Class a_class, string a_name)
		{
			_configClass = a_class;
			SetName(a_name);
		}
 protected Config4Field(Config4Class a_class, KeySpecHashtable4 config) : base(config
                                                                               )
 {
     _configClass = a_class;
 }
Beispiel #19
0
        internal static bool IsCollectionTranslator(Config4Class config4class)
        {
            if (config4class != null)
            {
                IObjectTranslator ot = config4class.GetTranslator();
                if (ot != null)
                {
#if SILVERLIGHT
					return false;
#else
					return ot is TList || ot is TDictionary || ot is TQueue || ot is TStack;
#endif
				}
            }
            return false;
        }
 internal Config4Field(Config4Class a_class, string a_name)
 {
     _configClass = a_class;
     SetName(a_name);
 }