コード例 #1
0
ファイル: Encoder.cs プロジェクト: xj0229/gsf
        public virtual object invokeGetterMethodForField(PropertyInfo field, object obj, ElementInfo info)
        {
            MethodInfo method = null;

            if (info != null && info.hasPreparedInfo())
            {
                method = info.PreparedInfo.IsPresentMethod;
            }
            else
            {
                method = CoderUtils.findIsPresentMethodForField(field, obj.GetType());
            }
            if (method != null)
            {
                if ((bool)method.Invoke(obj, null))
                {
                    return(field.GetValue(obj, null));
                }
                else
                {
                    return(null);
                }
            }
            return(field.GetValue(obj, null));
        }
コード例 #2
0
        private void setupAccessors(Type objectClass, PropertyInfo field)
        {
            try
            {
                doSelectMethod = CoderUtils.findDoSelectMethodForField(field, objectClass);
            }
            catch (Exception)
            {
            }

            try
            {
                isSelectedMethod = CoderUtils.findIsSelectedMethodForField(field, objectClass);
            }
            catch (Exception)
            {
            }

            try
            {
                isPresentMethod = CoderUtils.findIsPresentMethodForField(field, objectClass);
            }
            catch (Exception)
            {
            }
        }