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)); } }
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)); if (_prop.CanRead) { yield return (string.Format( "\tpublic final NullableEnum<{1}> get{0}() {{ return get{0}IsNull() ? new NullableEnum<{1}>() : new NullableEnum<{1}>({1}.fromValue(get{0}Raw())); }}", _prop.Name, _prop.PropType.GenericTypeArguments[0].Name)); } if (_prop.CanWrite) { yield return (string.Format( "\tpublic final {2} set{0}(NullableEnum<{1}> val) {{ if (val.isNull()) {{ set{0}IsNull(); }} else {{ set{0}Raw(val.getValue().getValue()); }} return this; }}", _prop.Name, _prop.PropType.GenericTypeArguments[0].Name, genClass.Name)); yield return(string.Format("\tpublic final {2} set{0}({1} val) {{ set{0}Raw(val.getValue()); return this; }}", _prop.Name, _prop.PropType.GenericTypeArguments[0].Name, genClass.Name)); } }
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)); if (_prop.CanRead) { yield return (string.Format( "\tpublic final NullableInteger get{0}() {{ return get{0}IsNull() ? NullableInteger.getNull() : new NullableInteger(get{0}Raw()); }}", _prop.Name)); } if (_prop.CanWrite) { yield return (string.Format( "\tpublic final {1} set{0}(NullableInteger val) {{ if (val.isNull()) {{ set{0}IsNull(); }} else {{ set{0}Raw(val.getInt()); }} return this; }}", _prop.Name, genClass.Name)); } }