internal virtual Methods DescribeMethods()
 {
     Methods methods = new Methods();
     methods.Add(new Method("GetWorklistItems", MethodType.List, new MetaData("Get Worklist Items", "Returns a collection of worklist items."), GetRequiredProperties("GetWorklistItems"), GetMethodParameters("GetWorklistItems"), GetInputProperties("GetWorklistItems"), GetReturnProperties("GetWorklistItems")));
     methods.Add(new Method("LoadWorklistItem", MethodType.Read, new MetaData("Load Worklist Item", "Returns the specified worklist item."), GetRequiredProperties("LoadWorklistItem"), GetMethodParameters("LoadWorklistItem"), GetInputProperties("LoadWorklistItem"), GetReturnProperties("LoadWorklistItem")));
     return methods;
 }
예제 #2
0
        void GenerateInterfaceStubs(Type interfaceType)
        {
            WriteLine();
            /*
            WriteLine("public partial class {0}_", interfaceType.SimpleName);
            WriteLine("{");
            myIndent++;
            WriteLine("public static global::java.lang.Class _class");
            WriteLine("{");
            myIndent++;
            WriteLine("get {{ return __{0}.staticClass; }}", interfaceType.SimpleName);
            myIndent--;
            WriteLine("}");
            myIndent--;
            WriteLine("}");
            WriteLine();
            */
            
            Type wrapperType = new Type();
            wrapperType.WrappedInterface = interfaceType.Name;
            wrapperType.WrappedInterfaceType = interfaceType;
            //wrapperType.Name = interfaceType.Name.Insert(interfaceType.Name.LastIndexOf('.') + 1, "_");
            wrapperType.Name = interfaceType.Name + "_";
            wrapperType.Scope = interfaceType.Scope;
            wrapperType.IsSealed = true;
            if (interfaceType.IsInterface)
            {
                wrapperType.Parent = "java.lang.Object";
                wrapperType.ParentType = myModel.FindType("java.lang.Object");
                wrapperType.Interfaces.Add(interfaceType.Name);
                wrapperType.InterfaceTypes.Add(interfaceType);

                var h = new HashSet<Type>();
                AddAllInterfaces(interfaceType, h);
                foreach (var i in h)
                {
                    foreach (var m in i.Methods)
                    {
                        var mc = new Method();
                        mc.Type = wrapperType;
                        mc.Name = i.Name + "." + m.Name;
                        //mc.Scope = "public";
                        mc.Parameters.AddRange(m.Parameters);
                        mc.ParameterTypes.AddRange(m.ParameterTypes);
                        mc.Return = m.Return;
                        mc.ReturnType = m.ReturnType;
                        if (!wrapperType.Methods.Contains(mc))
                            wrapperType.Methods.Add(mc);
                    }
                }
            }
            else
            {
                wrapperType.Parent = interfaceType.Name;
                wrapperType.ParentType = interfaceType;

                var curType = interfaceType;
                var allImplementedMethods = new Methods();
                while (curType != null)
                {
                    foreach (var m in curType.Methods)
                    {
                        if (!m.Abstract)
                        {
                            if (!allImplementedMethods.Contains(m))
                                allImplementedMethods.Add(m);
                            continue;
                        }
                        if (allImplementedMethods.Contains(m))
                            continue;
                        var mc = new Method();
                        mc.Type = wrapperType;
                        mc.Name = m.Name;
                        mc.Scope = m.Scope;
                        mc.IsOverride = true;
                        mc.Parameters.AddRange(m.Parameters);
                        mc.ParameterTypes.AddRange(m.ParameterTypes);
                        mc.Return = m.Return;
                        mc.ReturnType = m.ReturnType;
                        if (!wrapperType.Methods.Contains(mc))
                            wrapperType.Methods.Add(mc);
                    }
                    curType = curType.ParentType;
                }
            }
            
            myTypesOfInterest.Add(wrapperType);
            myIndent--;
            GenerateType(wrapperType);
            myIndent++;
        }
예제 #3
0
        void GenerateInterfaceStubs(Type interfaceType)
        {
            WriteLine();

            Type wrapperType = new Type();
            wrapperType.WrappedInterface = interfaceType.Name;
            wrapperType.WrappedInterfaceType = interfaceType;
            wrapperType.Name = interfaceType.Name + "_";
            wrapperType.Scope = interfaceType.Scope;
            wrapperType.IsSealed = true;
            if (interfaceType.IsInterface)
            {
                wrapperType.Parent = "java.lang.Object";
                wrapperType.ParentType = myModel.FindType("java.lang.Object");
                wrapperType.Interfaces.Add(interfaceType.Name);
                wrapperType.InterfaceTypes.Add(interfaceType);
                wrapperType.Scope = "internal";

                var h = new HashSet<Type>();
                AddAllInterfaces(interfaceType, h);
                foreach (var i in h)
                {
                    foreach (var m in i.Methods)
                    {
                        var mc = new Method();
                        mc.Type = wrapperType;
                        mc.Name = i.Name + "." + m.Name;
                        mc.Parameters.AddRange(m.Parameters);
                        mc.ParameterTypes.AddRange(m.ParameterTypes);
                        mc.Return = m.Return;
                        mc.ReturnType = m.ReturnType;
                        if (!wrapperType.Methods.Contains(mc))
                            wrapperType.Methods.Add(mc);
                    }
                }
            }
            else
            {
                wrapperType.Scope = "internal";
                wrapperType.Parent = interfaceType.Name;
                wrapperType.ParentType = interfaceType;

                var curType = interfaceType;
                var allImplementedMethods = new Methods();
                while (curType != null)
                {
                    foreach (var m in curType.Methods)
                    {
                        if (!m.Abstract)
                        {
                            if (!allImplementedMethods.Contains(m))
                                allImplementedMethods.Add(m);
                            continue;
                        }
                        if (allImplementedMethods.Contains(m))
                            continue;
                        var mc = new Method();
                        mc.Type = wrapperType;
                        mc.Name = m.Name;
                        mc.Scope = m.Scope;
                        mc.IsOverride = true;
                        mc.Parameters.AddRange(m.Parameters);
                        mc.ParameterTypes.AddRange(m.ParameterTypes);
                        mc.Return = m.Return;
                        mc.ReturnType = m.ReturnType;
                        if (!wrapperType.Methods.Contains(mc))
                            wrapperType.Methods.Add(mc);
                    }
                    curType = curType.ParentType;
                }
            }

            myIndent--;
            myTypesOfInterest.Add(wrapperType);
            GenerateType(wrapperType);
            myIndent++;

            if (interfaceType.IsDelegate)
            {
                WriteLine();
                var delegateMethod = interfaceType.Methods.First();
                Write("public delegate {0} {1}Delegate(", false, delegateMethod.Return, interfaceType.SimpleName);
                WriteDelimited(delegateMethod.Parameters, (v, i) => string.Format("{0} arg{1}", v, i), ",");
                WriteLine(");");
                WriteLine();
                var delegateWrapper = new Type();
                myTypesOfInterest.Add(delegateWrapper);
                delegateWrapper.Name = interfaceType.Name + "DelegateWrapper";
                delegateWrapper.NativeName = interfaceType.NativeName.Replace('$', '_') + "DelegateWrapper";
                if (delegateWrapper.NativeName.StartsWith("java."))
                    delegateWrapper.NativeName = delegateWrapper.NativeName.Replace("java.", "internal.java.");
                delegateWrapper.HasEmptyConstructor = true;
                delegateWrapper.Scope = "internal";
                delegateWrapper.Parent = "java.lang.Object";
                delegateWrapper.ParentType = myModel.FindType("java.lang.Object");
                delegateWrapper.NoAttributes = true;
                var constructor = new Method();
                constructor.IsConstructor = true;
                constructor.Scope = "public";
                constructor.Type = delegateWrapper;
                constructor.Name = delegateWrapper.SimpleName;
                delegateWrapper.Methods.Add(constructor);
                delegateWrapper.Interfaces.Add(interfaceType.Name);
                delegateWrapper.InterfaceTypes.Add(interfaceType);
                myIndent--;
                GenerateType(delegateWrapper);
                myIndent++;

                //WriteLine("[global::MonoJavaBridge.JavaDelegateProxy]");
                WriteLine("internal partial class {0}", delegateWrapper.SimpleName);
                WriteLine("{");
                myIndent++;
                WriteLine("private {0}Delegate myDelegate;", interfaceType.SimpleName);
                Write("public {0} {1}(", false, delegateMethod.Return, delegateMethod.Name);
                WriteDelimited(delegateMethod.Parameters, (v, i) => string.Format("{0} arg{1}", v, i), ",");
                WriteLine(")");
                WriteLine("{");
                myIndent++;
                if (delegateMethod.Return != "void")
                    Write("return myDelegate(", false);
                else
                    Write("myDelegate(", false);
                WriteDelimited(delegateMethod.Parameters, (v, i) => string.Format("arg{0}", i), ",");
                WriteLine(");");
                myIndent--;
                WriteLine("}");
                WriteLine("public static implicit operator {0}({1}Delegate d)", delegateWrapper.SimpleName, interfaceType.SimpleName);
                WriteLine("{");
                myIndent++;
                WriteLine("global::{0} ret = new global::{0}();", delegateWrapper.Name);
                WriteLine("ret.myDelegate = d;");
                WriteLine("global::MonoJavaBridge.JavaBridge.SetGCHandle(global::MonoJavaBridge.JNIEnv.ThreadEnv, ret);");
                WriteLine("return ret;");
                myIndent--;
                WriteLine("}");
                myIndent--;
                WriteLine("}");
            }
        }
 private SourceCode.SmartObjects.Services.ServiceSDK.Objects.Methods DescribeMethods()
 {
     SourceCode.SmartObjects.Services.ServiceSDK.Objects.Methods methods = new Methods();
     methods.Add(new Method("GetWorklistItems", MethodType.List, new MetaData("Get Worklist Items", "Returns a collection of worklist items."), GetRequiredProperties("GetWorklistItems"), GetMethodParameters("GetWorklistItems"), GetInputProperties("GetWorklistItems"), GetReturnProperties("GetWorklistItems")));
     methods.Add(new Method("LoadWorklistItem", MethodType.Read, new MetaData("Load Worklist Item", "Returns the specified worklist item."), GetRequiredProperties("LoadWorklistItem"), GetMethodParameters("LoadWorklistItem"), GetInputProperties("LoadWorklistItem"), GetReturnProperties("LoadWorklistItem")));
     return methods;
 }
 private SourceCode.SmartObjects.Services.ServiceSDK.Objects.Methods DescribeMethods()
 {
     SourceCode.SmartObjects.Services.ServiceSDK.Objects.Methods methods = new Methods();
     methods.Add(new Method("GetWorklistItemActions", MethodType.List, new MetaData("Get Worklist Item Actions", "Returns a collection of worklist item actions."), GetRequiredProperties("GetWorklistItemActions"), GetMethodParameters("GetWorklistItemActions"), GetInputProperties("GetWorklistItemActions"), GetReturnProperties("GetWorklistItemActions")));
     methods.Add(new Method("RedirectWorklistItem", MethodType.Execute, new MetaData("Redirect Worklist Item", ""), GetRequiredProperties("RedirectWorklistItem"), GetMethodParameters("RedirectWorklistItem"), GetInputProperties("RedirectWorklistItem"), GetReturnProperties("RedirectWorklistItem")));
     methods.Add(new Method("RedirectManagedUserWorklistItem", MethodType.Execute, new MetaData("Redirect Managed User Worklist Item", ""), GetRequiredProperties("RedirectManagedUserWorklistItem"), GetMethodParameters("RedirectManagedUserWorklistItem"), GetInputProperties("RedirectManagedUserWorklistItem"), GetReturnProperties("RedirectManagedUserWorklistItem")));
     methods.Add(new Method("ActionWorklistItem", MethodType.Execute, new MetaData("Action Worklist Item", ""), GetRequiredProperties("ActionWorklistItem"), GetMethodParameters("ActionWorklistItem"), GetInputProperties("ActionWorklistItem"), GetReturnProperties("ActionWorklistItem")));
     methods.Add(new Method("OpenWorklistItem", MethodType.Execute, new MetaData("Open Worklist Item", ""), GetRequiredProperties("OpenWorklistItem"), GetMethodParameters("OpenWorklistItem"), GetInputProperties("OpenWorklistItem"), GetReturnProperties("OpenWorklistItem")));
     methods.Add(new Method("ReleaseWorklistItem", MethodType.Execute, new MetaData("Release Worklist Item", ""), GetRequiredProperties("ReleaseWorklistItem"), GetMethodParameters("ReleaseWorklistItem"), GetInputProperties("ReleaseWorklistItem"), GetReturnProperties("ReleaseWorklistItem")));
     return methods;
 }