コード例 #1
0
        /// <param name="uri">            The uri to identify the component with. </param>
        /// <param name="type">           The type to create the metadata for </param>
        /// <param name="factory">        A reflection library to provide class construction and field get/set functionality </param>
        /// <param name="copyStrategies"> A copy strategy library </param>
        /// <exception cref="NoSuchMethodException"> If the component has no default constructor </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public ComponentMetadata(org.terasology.engine.SimpleUri uri, Class type, org.terasology.reflection.reflect.ReflectFactory factory, org.terasology.reflection.copy.CopyStrategyLibrary copyStrategies) throws NoSuchMethodException
        public ComponentMetadata(SimpleUri uri, Type type, ReflectFactory factory, CopyStrategyLibrary copyStrategies) : base(uri, type, factory, copyStrategies, Predicates.alwaysTrue())
        {
            replicated = type.getAnnotation(typeof(Replicate)) != null;
            blockLifecycleEventsRequired = type.getAnnotation(typeof(RequiresBlockLifecycleEvents)) != null;
            ForceBlockActive forceBlockActiveAnnotation = type.getAnnotation(typeof(ForceBlockActive));

            if (forceBlockActiveAnnotation != null)
            {
                forceBlockActive             = true;
                retainUnalteredOnBlockChange = forceBlockActiveAnnotation.retainUnalteredOnBlockChange();
            }

//JAVA TO C# CONVERTER TODO TASK: Java wildcard generics are not converted to .NET:
//ORIGINAL LINE: for (ComponentFieldMetadata<T, ?> field : getFields())
            foreach (ComponentFieldMetadata <T, ?> field in Fields)
            {
                if (field.Replicated)
                {
                    replicated = true;
                    if (field.ReplicationInfo.value().ReplicateFromOwner)
                    {
                        replicatedFromOwner = true;
                    }
                }
                if (field.OwnedReference)
                {
                    referenceOwner = true;
                }
            }
        }
コード例 #2
0
        public static BaseJob CreateJob(TableConfig item)
        {
            BaseJob baseJob = null;

            if (item == null)
            {
                throw new Exception("配置对象为空!");
            }
            if (item.RefreshCycle == 0)
            {
                throw new Exception("配置刷新频率不能为零!");
            }
            if (item.RefreshCycle == 0)
            {
                throw new Exception("配置刷新频率不能为零!");
            }
            if (string.IsNullOrEmpty(item.S_DBConnstr) || string.IsNullOrEmpty(item.S_DBConnstr))
            {
                throw new Exception("连接字符串不能为空!");
            }
            if (string.IsNullOrEmpty(item.SelectSql))
            {
                throw new Exception("表字段配置错误!");
            }
            switch (item.JobType)
            {
            case JobType.FullCopy:
                //baseJob = new Plugin.Job_FullCopy();
                break;

            case JobType.FilterInsert:
                //baseJob = new Plugin.Job_FilterInsert();
                break;

            case JobType.FilterInsertByDel:
                //baseJob = new Plugin.Job_FilterInsertByDel();
                break;

            ///定制的需要反射出来
            case JobType.CustomJob:
                baseJob = (BaseJob)ReflectFactory.CreateFullNameObject(item.DllName, item.ClassName);
                break;

            default:
                throw new Exception("未知类型的任务");
            }
            baseJob.Task_Fre         = item.RefreshCycle;
            baseJob.Task_DelayedTime = item.DelayedTime;
            baseJob.S_DBSource       = new DatabaseSource {
                Connstr = item.S_DBConnstr, DBType = item.s_DBType
            };
            baseJob.T_DBSource = new DatabaseSource {
                Connstr = item.T_DBConnstr, DBType = item.t_DBType
            };
            baseJob.SelectSql   = item.SelectSql;
            baseJob.Columns     = item.columnNames;
            baseJob.tableConfig = item;
            return(baseJob);
        }
コード例 #3
0
ファイル: EventMetadata.cs プロジェクト: xposure/zSprite_Old
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public EventMetadata(Class simpleClass, org.terasology.reflection.copy.CopyStrategyLibrary copyStrategies, org.terasology.reflection.reflect.ReflectFactory factory, org.terasology.engine.SimpleUri uri) throws NoSuchMethodException
        public EventMetadata(Type simpleClass, CopyStrategyLibrary copyStrategies, ReflectFactory factory, SimpleUri uri) : base(uri, simpleClass, factory, copyStrategies, Predicates.alwaysTrue())
        {
            if (simpleClass.getAnnotation(typeof(ServerEvent)) != null)
            {
                networkEventType = NetworkEventType.SERVER;
                lagCompensated   = simpleClass.getAnnotation(typeof(ServerEvent)).lagCompensate();
            }
            else if (simpleClass.getAnnotation(typeof(OwnerEvent)) != null)
            {
                networkEventType = NetworkEventType.OWNER;
            }
            else if (simpleClass.getAnnotation(typeof(BroadcastEvent)) != null)
            {
                networkEventType = NetworkEventType.BROADCAST;
                skipInstigator   = simpleClass.getAnnotation(typeof(BroadcastEvent)).skipInstigator();
            }
        }
コード例 #4
0
 public EventLibrary(ReflectFactory reflectFactory, CopyStrategyLibrary copyStrategies) : base(reflectFactory, copyStrategies)
 {
 }
コード例 #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected <U> ComponentFieldMetadata<T, U> createField(Field field, org.terasology.reflection.copy.CopyStrategy<U> copyStrategy, org.terasology.reflection.reflect.ReflectFactory factory) throws org.terasology.reflection.reflect.InaccessibleFieldException
        protected internal virtual ComponentFieldMetadata <T, U> createField <U>(Field field, CopyStrategy <U> copyStrategy, ReflectFactory factory)
        {
            return(new ComponentFieldMetadata <>(this, field, copyStrategy, factory, false));
        }
コード例 #6
0
 public ComponentLibrary(ReflectFactory factory, CopyStrategyLibrary copyStrategies) : base(factory, copyStrategies)
 {
 }