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, "JsArrayNumber", false, string.Format("get{0}Raw", _prop.Name))); yield return(DtGenUtil.GenNativeSetMethod(_prop, "JsArrayNumber", false, genClass)); if (_prop.CanRead) { yield return (string.Format( "\t@Override public final IJsArrayNumber get{0}() {{ return new JsArrayNumberWrapper(get{0}Raw()); }}", _prop.Name)); } if (_prop.CanWrite) { yield return (string.Format( "\t@Override public final {1} set{0}(Iterable<Double> list) {{ get{0}Raw().setLength(0); for(double i : list) {{ get{0}Raw().push(i); }} return this; }}", _prop.Name, genClass.Name)); yield return (string.Format( "\t@Override public final {1} set{0}(IJsArrayNumber list) {{ set{0}(JsArrayNumberWrapper.unwrap(list)); return this; }}", _prop.Name, genClass.Name)); } }
public IEnumerable <string> GeneratePropertyMethods(string sourceNamespace, GenClass genClass) { yield return (DtGenUtil.GenNativeGetMethod(_prop, string.Format("JsArray<{0}>", _prop.PropType.GenericTypeArguments[0].Name), false, string.Format("get{0}Raw", _prop.Name))); yield return (DtGenUtil.GenNativeSetMethod(_prop, string.Format("JsArray<{0}>", _prop.PropType.GenericTypeArguments[0].Name), false, string.Format("set{0}", _prop.Name), genClass)); if (_prop.CanRead) { yield return (string.Format( "\t@Override public final IJsArray<I{1}> get{0}() {{ return new JsArrayWrapper<{1}, I{1}>(get{0}Raw()); }}", _prop.Name, _prop.PropType.GenericTypeArguments[0].Name)); } if (_prop.CanWrite) { yield return (string.Format( "\t@Override public final {2} set{0}(Iterable<I{1}> list) {{ get{0}Raw().setLength(0); for(I{1} item : list) {{ get{0}Raw().push(({1})item); }} return this; }}", _prop.Name, _prop.PropType.GenericTypeArguments[0].Name, genClass.Name)); yield return (string.Format( "\t@Override public final {2} set{0}(IJsArray<I{1}> list) {{ set{0}(JsArrayWrapper.<{1}, I{1}>unwrap(list)); 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)); 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 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)); } }
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)); } }
public IEnumerable <string> GeneratePropertyMethods(string sourceNamespace, GenClass genClass) { yield return(DtGenUtil.GenNativeGetMethod(_prop, _prop.PropType.Name)); yield return(DtGenUtil.GenNativeSetMethod(_prop, _prop.PropType.Name, false, string.Format("set{0}Raw", _prop.Name), genClass)); if (_prop.CanWrite) { yield return (string.Format( "\t@Override public final {2} set{0}(I{1} val) {{ set{0}Raw(({1})val); return this; }}", _prop.Name, _prop.PropType.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)); if (_prop.CanRead) { yield return (string.Format("\tpublic final {1} get{0}() {{ return {1}.fromValue(get{0}Raw()); }}", _prop.Name, _prop.PropType.Name)); } if (_prop.CanWrite) { yield return (string.Format("\tpublic final {2} set{0}({1} val) {{ set{0}Raw(val.getValue()); return this; }}", _prop.Name, _prop.PropType.Name, genClass.Name)); } }
public IEnumerable <string> GeneratePropertyMethods(string sourceNamespace, GenClass genClass) { yield return(DtGenUtil.GenNativeGetMethod(_prop, "String", false, "get" + _prop.Name + "Str")); yield return(DtGenUtil.GenNativeSetMethod(_prop, "String", false, "set" + _prop.Name + "Str", genClass)); if (_prop.CanRead) { yield return (string.Format( "\tpublic final Date get{0}() {{ return Utils.parseLosslessDateTime(get{0}Str()).getDate(); }}", _prop.Name)); } if (_prop.CanWrite) { yield return (string.Format( "\tpublic final {1} set{0}(Date d) {{ set{0}Str(Utils.formatLosslessDateTime(d)); return this; }}", _prop.Name, genClass.Name)); } }
public IEnumerable <string> GeneratePropertyMethods(string sourceNamespace, GenClass genClass) { yield return(DtGenUtil.GenNativeGetMethod(_prop, "JsArrayInteger", false, string.Format("get{0}Raw", _prop.Name))); yield return(DtGenUtil.GenNativeSetMethod(_prop, "JsArrayInteger", false, string.Format("set{0}Raw", _prop.Name), genClass)); if (_prop.CanRead) { yield return(string.Format("\tpublic final List<{0}> get{1}() {{ " + "\t\tArrayList<{0}> r = new ArrayList<{0}>(); " + "\t\tfor(int i : new JsArrayIntegerIterable(get{1}Raw())) {{ " + "\t\t\tr.add({0}.fromValue(i)); " + "\t\t}} " + "\t\treturn r; " + "\t}}", _prop.PropType.GenericTypeArguments[0].Name, _prop.Name)); } if (_prop.CanWrite) { yield return(string.Format("\tpublic final {2} set{1}(Iterable<{0}> val) {{ set{1}Raw(JsArrayIntegerWrapper.from(JavaOnlyUtils.select(val, new Func<{0}, Integer>() {{ @Override public Integer call({0} val) {{ return val.getValue(); }}}}))); return this; }}", _prop.PropType.GenericTypeArguments[0].Name, _prop.Name, genClass.Name)); } }
public IEnumerable <string> GeneratePropertyMethods(string sourceNamespace, GenClass genClass) { yield return(DtGenUtil.GenNativeGetMethod(_prop, "int")); // java bytes are signed yield return(DtGenUtil.GenNativeSetMethod(_prop, "int", genClass)); }
public IEnumerable <string> GeneratePropertyMethods(string sourceNamespace, GenClass genClass) { yield return(DtGenUtil.GenNativeGetMethod(_prop, "short")); yield return(DtGenUtil.GenNativeSetMethod(_prop, "short", genClass)); }