Ejemplo n.º 1
0
        public IEnumerable <string> GeneratePropertyMethods(string sourceNamespace, GenClass genClass)
        {
            yield return(DtGenUtil.GenNativeGetMethod(_prop, "int", false, string.Format("get{0}Raw", _prop.Name)));

            yield return(DtGenUtil.GenNativeSetMethod(_prop, "int", false, string.Format("set{0}Raw", _prop.Name), genClass));

            yield return(DtGenUtil.GenNativeGetIsNullMethod(_prop));

            yield return(DtGenUtil.GenNativeSetIsNullMethod(_prop));

            var nameWoKey = _prop.Name.Substring(0, _prop.Name.Length - 3);

            if (_prop.CanRead)
            {
                yield return
                    (string.Format(
                         "\tpublic final NullableDate get{0}() {{  return get{1}IsNull() ? new NullableDate() : new NullableDate(Utils.fromDateKey(get{1}Raw()));  }}",
                         nameWoKey, _prop.Name));
            }
            if (_prop.CanWrite)
            {
                yield return
                    (string.Format(
                         "\tpublic final {2} set{0}(NullableDate val) {{ if (val.isNull()) {{ set{1}IsNull(); }} else {{ set{1}Raw(Utils.toDateKey(val.getDate())); }} return this; }}",
                         nameWoKey, _prop.Name, genClass.Name));
            }

            if (_prop.DateTimeSisterProperty != null)
            {
                yield return(DtGenUtil.GenNativeDeleteMethod(_prop.DateTimeSisterProperty));
            }
        }
Ejemplo n.º 2
0
        public IEnumerable <string> GeneratePropertyMethods(string sourceNamespace, GenClass genClass)
        {
            yield return(DtGenUtil.GenNativeGetMethod(_prop, "int", false));

            yield return(DtGenUtil.GenNativeSetMethod(_prop, "int", false, genClass));

            var nameWoKey = _prop.Name.Length > 3 ? _prop.Name.Substring(0, _prop.Name.Length - 3) : "";

            if (_prop.CanRead)
            {
                yield return
                    (string.Format("\tpublic final Date get{0}() {{  return Utils.fromDateKey(get{1}());  }}",
                                   nameWoKey, _prop.Name));
            }
            if (_prop.CanWrite)
            {
                yield return
                    (string.Format("\tpublic final {2} set{0}(Date d) {{ set{1}(Utils.toDateKey(d)); return this; }}",
                                   nameWoKey, _prop.Name, genClass.Name));
            }

            if (_prop.DateTimeSisterProperty != null)
            {
                yield return(DtGenUtil.GenNativeDeleteMethod(_prop.DateTimeSisterProperty));
            }
        }