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> GenerateImports(string sourceNamespace, List <string> myNamespaceList, string destPackage) { yield return("com.google.gwt.core.client.JsArrayInteger"); yield return("java.util.ArrayList"); yield return("tickbox.web.shared.util.JsArrayIntegerIterable"); yield return("tickbox.web.shared.util.Utils"); var myNamespace = sourceNamespace + string.Join("", myNamespaceList.Select(n => "." + n)); if ((_prop.PropType.GenericTypeArguments[0].Namespace ?? "") != myNamespace) { yield return(string.Format("{0}.{1}", destPackage + string.Join("", DtGenUtil.CalculateRelativeNamespace((_prop.PropType.GenericTypeArguments[0].Namespace ?? ""), sourceNamespace).Select(n => "." + n.ToLowerInvariant())), _prop.PropType.GenericTypeArguments[0].Name)); } if (_prop.CanWrite) { yield return("tickbox.web.shared.util.JsArrayIntegerWrapper"); yield return("tickbox.web.shared.util.JavaOnlyUtils"); yield return("tickbox.web.shared.util.Func"); yield return("java.util.List"); } }
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> GenerateTModelConstructorStatements(string sourceNamespace, GenClass genClass, List <string> constructorParams) { yield return(string.Format("\t\tthis.{0} = {0};", DtGenUtil.ToJavaMemberName(_prop.Name))); constructorParams.Add(string.Format("{0}Tm {1}", _prop.PropType.Name, DtGenUtil.ToJavaMemberName(_prop.Name))); // yield return string.Format("{0}.addRule(new Required(\"required field\"));", DtGenUtil.ToJavaMemberName(_prop.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 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)); 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> GenerateImports(string sourceNamespace, List <string> myNamespaceList, string destPackage) { yield return("tickbox.web.shared.util.IJsArray"); yield return("tickbox.web.shared.util.JsArrayWrapper"); var myNamespace = sourceNamespace + string.Join("", myNamespaceList.Select(n => "." + n)); if ((_prop.PropType.GenericTypeArguments[0].Namespace ?? "") != myNamespace) { yield return (string.Format("{0}.{1}", destPackage + string.Join("", DtGenUtil.CalculateRelativeNamespace((_prop.PropType.GenericTypeArguments[0].Namespace ?? ""), sourceNamespace).Select(n => "." + n.ToLowerInvariant())), _prop.PropType.GenericTypeArguments[0].Name)); yield return (string.Format("{0}.{1}", destPackage + string.Join("", DtGenUtil.CalculateRelativeNamespace((_prop.PropType.GenericTypeArguments[0].Namespace ?? ""), sourceNamespace).Select(n => "." + n.ToLowerInvariant())), "I" + _prop.PropType.GenericTypeArguments[0].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, "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> GenerateStubPropertyMethods(string sourceNamespace, GenClass genClass) { yield return(DtGenUtil.GenStubPrivateMember(_prop, string.Format("NullableEnum<{0}>", _prop.PropType.GenericTypeArguments[0].Name), string.Format("new NullableEnum<{0}>()", _prop.PropType.GenericTypeArguments[0].Name))); yield return(DtGenUtil.GenStubGetMethod(_prop, string.Format("NullableEnum<{0}>", _prop.PropType.GenericTypeArguments[0].Name))); yield return(DtGenUtil.GenStubSetMethod(_prop, string.Format("NullableEnum<{0}>", _prop.PropType.GenericTypeArguments[0].Name), genClass)); }
public IEnumerable <string> GenerateInterfacePropertyMethods(string sourceNamespace, GenClass genClass) { yield return(DtGenUtil.GenInterfaceGetMethod(_prop, "IJsArrayNumber")); yield return(DtGenUtil.GenInterfaceSetMethod(_prop, "Iterable<Double>", genClass)); yield return(DtGenUtil.GenInterfaceSetMethod(_prop, "IJsArrayNumber", genClass)); }
public IEnumerable <string> GenerateStubPropertyMethods(string sourceNamespace, GenClass genClass) { yield return(DtGenUtil.GenStubPrivateMember(_prop, "int", "0")); yield return(DtGenUtil.GenStubGetMethod(_prop, "int")); yield return(DtGenUtil.GenStubSetMethod(_prop, "int", genClass)); }
public IEnumerable <string> GenerateInterfacePropertyMethods(string sourceNamespace, GenClass genClass) { yield return(DtGenUtil.GenInterfaceGetMethod(_prop, string.Format("IJsArray<I{0}>", _prop.PropType.GenericTypeArguments[0].Name))); yield return(DtGenUtil.GenInterfaceSetMethod(_prop, string.Format("Iterable<I{0}>", _prop.PropType.GenericTypeArguments[0].Name), genClass)); yield return(DtGenUtil.GenInterfaceSetMethod(_prop, string.Format("IJsArray<I{0}>", _prop.PropType.GenericTypeArguments[0].Name), genClass)); }
public IEnumerable <string> GenerateTModelImports(string sourceNamespace, List <string> relativeNamespace, string dtoPackage, string destTModelPackage) { yield return("static org.tessell.model.properties.NewProperty.listProperty"); yield return("org.tessell.model.properties.ListProperty"); // yield return "org.tessell.model.validation.rules.Required"; yield return(string.Format("{0}.{1}", dtoPackage + string.Join("", DtGenUtil.CalculateRelativeNamespace((_prop.PropType.GenericTypeArguments[0].Namespace ?? ""), sourceNamespace).Select(n => "." + n.ToLowerInvariant())), _prop.PropType.GenericTypeArguments[0].Name)); }
public IEnumerable <string> GenerateStubPropertyMethods(string sourceNamespace, GenClass genClass) { yield return(DtGenUtil.GenStubPrivateMember(_prop, string.Format("List<{0}>", _prop.PropType.GenericTypeArguments[0].Name), string.Format("new ArrayList<{0}>()", _prop.PropType.GenericTypeArguments[0].Name))); yield return(DtGenUtil.GenStubGetMethod(_prop, string.Format("List<{0}>", _prop.PropType.GenericTypeArguments[0].Name))); //yield return DtGenUtil.GenStubSetMethod(_prop, string.Format("ArrayList<{0}>", _prop.PropType.GenericTypeArguments[0].Name), genClass); yield return(string.Format("\t@Override public I{2} set{0}(Iterable<{1}> val) {{ this._{0} = JavaOnlyUtils.toList(val); return this; }}", _prop.Name, _prop.PropType.GenericTypeArguments[0].Name, genClass.Name)); }
public IEnumerable <string> GenerateStubPropertyMethods(string sourceNamespace, GenClass genClass) { var val = Convert.ChangeType(Enum.GetValues(_prop.PropType).GetValue(0), Enum.GetUnderlyingType(Enum.GetValues(_prop.PropType).GetValue(0).GetType())); yield return(DtGenUtil.GenStubPrivateMember(_prop, _prop.PropType.Name, string.Format("{0}.fromValue({1})", _prop.PropType.Name, val))); yield return(DtGenUtil.GenStubGetMethod(_prop, _prop.PropType.Name)); yield return(DtGenUtil.GenStubSetMethod(_prop, _prop.PropType.Name, genClass)); }
public IEnumerable <string> GenerateInterfacePropertyMethods(string sourceNamespace, GenClass genClass) { if (_prop.CanRead) { yield return(DtGenUtil.GenInterfaceGetMethod(_prop, string.Format("List<{0}>", _prop.PropType.GenericTypeArguments[0].Name))); } if (_prop.CanWrite) { yield return(DtGenUtil.GenInterfaceSetMethod(_prop, string.Format("Iterable<{0}>", _prop.PropType.GenericTypeArguments[0].Name), genClass)); } }
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))); 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)); } }
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> GenerateImports(string sourceNamespace, List <string> myNamespaceList, string destPackage) { var myNamespace = sourceNamespace + string.Join("", myNamespaceList.Select(n => "." + n)); if ((_prop.PropType.Namespace ?? "") != myNamespace) { yield return (string.Format("{0}.{1}", destPackage + string.Join("", DtGenUtil.CalculateRelativeNamespace((_prop.PropType.Namespace ?? ""), sourceNamespace) .Select(n => "." + n.ToLowerInvariant())), _prop.PropType.Name)); } }
public IEnumerable <string> GenerateInterfaceImports(string sourceNamespace, List <string> relativeNamespace, string destPackage) { var myNamespace = sourceNamespace + string.Join("", relativeNamespace.Select(n => "." + n)); if ((_prop.PropType.GenericTypeArguments[0].Namespace ?? "") != myNamespace) { yield return(string.Format("{0}.{1}", destPackage + string.Join("", DtGenUtil.CalculateRelativeNamespace((_prop.PropType.GenericTypeArguments[0].Namespace ?? ""), sourceNamespace).Select(n => "." + n.ToLowerInvariant())), _prop.PropType.GenericTypeArguments[0].Name)); } if (_prop.CanRead) { yield return("java.util.List"); } }
public IEnumerable <string> GenerateStubPropertyMethods(string sourceNamespace, GenClass genClass) { var nameWoKey = _prop.Name.Length > 3 ? _prop.Name.Substring(0, _prop.Name.Length - 3) : ""; yield return(DtGenUtil.GenStubPrivateMember(_prop, "NullableDate", "new NullableDate()")); if (_prop.CanRead) { yield return(string.Format("\t@Override public NullableDate get{0}() {{ return _{1}; }}", nameWoKey, _prop.Name)); } if (_prop.CanWrite) { yield return(string.Format("\t@Override public I{1} set{0}(NullableDate d) {{ _{2} = d; return this; }}", nameWoKey, genClass.Name, _prop.Name)); } }
public IEnumerable <string> GenerateStubPropertyMethods(string sourceNamespace, GenClass genClass) { yield return(DtGenUtil.GenStubPrivateMember(_prop, "Stub" + _prop.PropType.Name, "null")); yield return(DtGenUtil.GenStubGetMethod(_prop, "Stub" + _prop.PropType.Name)); if (_prop.CanWrite) { yield return (string.Format( "\t@Override public I{1} set{0}(I{2} val) {{ this._{0} = (Stub{2}) val; return this; }}", _prop.Name, genClass.Name, _prop.PropType.Name)); } }
public IEnumerable <string> GenerateStubPropertyMethods(string sourceNamespace, GenClass genClass) { yield return(DtGenUtil.GenStubPrivateMember(_prop, "StubJsArrayNumber", "new StubJsArrayNumber()")); yield return(DtGenUtil.GenStubGetMethod(_prop, "StubJsArrayNumber")); if (_prop.CanWrite) { yield return (string.Format( "\t@Override public I{1} set{0}(IJsArrayNumber val) {{ this._{0} = (StubJsArrayNumber)val; return this; }}", _prop.Name, genClass.Name)); yield return (string.Format( "\t@Override public I{1} set{0}(Iterable<Double> list) {{ _{0}.setLength(0); for(double i : list) {{ _{0}.push(i); }} return this; }}", _prop.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> GenerateStubPropertyMethods(string sourceNamespace, GenClass genClass) { yield return(DtGenUtil.GenStubPrivateMember(_prop, string.Format("StubJsArray<I{0}>", _prop.PropType.GenericTypeArguments[0].Name), string.Format("new StubJsArray<I{0}>()", _prop.PropType.GenericTypeArguments[0].Name))); yield return(DtGenUtil.GenStubGetMethod(_prop, string.Format("StubJsArray<I{0}>", _prop.PropType.GenericTypeArguments[0].Name))); //yield return DtGenUtil.GenStubSetMethod(_prop, string.Format("StubJsArray<I{0}>", _prop.PropType.GenericTypeArguments[0].Name), genClass); if (_prop.CanWrite) { yield return (string.Format( "\t@Override public I{1} set{0}(IJsArray<I{2}> val) {{ this._{0} = (StubJsArray<I{2}>)val; return this; }}", _prop.Name, genClass.Name, _prop.PropType.GenericTypeArguments[0].Name)); yield return (string.Format( "\t@Override public I{1} set{0}(Iterable<I{2}> list) {{ _{0}.setLength(0); for(I{2} i : list) {{ _{0}.push(i); }} return this; }}", _prop.Name, genClass.Name, _prop.PropType.GenericTypeArguments[0].Name)); } }
public IEnumerable <string> GenerateTModelToDtoStatements(string sourceNamespace, GenClass genClass) { yield return(string.Format("\t\tresult.set{1}({0}.get());", DtGenUtil.ToJavaMemberName(_prop.Name), _prop.Name)); }
public IEnumerable <string> GenerateTModelFromDtoStatements(string sourceNamespace, GenClass genClass, List <string> constructorParams) { yield return(string.Format("\t\tto.{0}.set(from.get{1}());", DtGenUtil.ToJavaMemberName(_prop.Name), _prop.Name)); }