Ejemplo n.º 1
0
        private static void append_interface_class_begin(StringBuilder sb, Type type, AopCoderDialect dialect, String interfaceFullName)
        {
            sb.AppendFormat("\tpublic class {0} : {1} ", dialect.GetClassFullName(type, interfaceFullName), interfaceFullName);
            sb.Append("{");
            sb.AppendLine();
            sb.AppendLine();

            sb.AppendFormat("\t\tprivate {0} _{1};", interfaceFullName, dialect.GetInvokeTargetBase());
            sb.AppendLine();

            sb.AppendFormat("\t\tpublic {0} {1} ", interfaceFullName, dialect.GetInvokeTargetBase());
            sb.Append("{");
            sb.AppendLine();

            sb.Append("\t\t\tget { return _" + dialect.GetInvokeTargetBase() + "; }");
            sb.AppendLine();

            sb.Append("\t\t\tset { _" + dialect.GetInvokeTargetBase() + " = value; }");
            sb.AppendLine();

            sb.Append("\t\t}");
            sb.AppendLine();

            sb.AppendLine();
        }
Ejemplo n.º 2
0
        private static void append_method_invoke(StringBuilder sb, ObservedMethod x, AopCoderDialect dialect)
        {
            sb.Append("\t\t\tObject returnValue = null;");
            sb.AppendLine();

            List <MethodObserver> osList = getMethodObserver(x.ObservedType.Type, x.Method.Name);

            String strReturn = getReturnString(x.Method);

            if (strReturn == "void")
            {
                strReturn = "";
            }
            else
            {
                strReturn = "returnValue = ";
            }

            int invokeObserverIndex = getInovkeObserverIndex(osList);

            if (invokeObserverIndex > -1)
            {
                append_invoke_object(sb, x, dialect);
                sb.AppendFormat("\t\t\t{0}observer{1}.Invoke( invocation );", strReturn, invokeObserverIndex);
                sb.AppendLine();
            }
            else
            {
                sb.AppendFormat("\t\t\t{0}{1}.{2}({3});", strReturn, dialect.GetInvokeTargetBase(), x.Method.Name, getArgBodyFromArray(x.Method));
                sb.AppendLine();
            }
        }
Ejemplo n.º 3
0
        private static void append_method_base_single(StringBuilder sb, ObservedMethod x, AopCoderDialect dialect)
        {
            String strReturn  = getReturnString(x.Method);
            String strArg     = getArgString(x.Method);
            String strArgBody = getArgBody(x.Method);

            sb.AppendFormat("\t\tpublic {0} {1}{2}({3}) ", strReturn, dialect.GetMethodBasePrefix(), x.Method.Name, strArg);
            sb.Append("{");
            sb.AppendLine();

            String strReturnLable = strReturn == "void" ? "" : "return ";

            sb.AppendFormat("\t\t\t{0}{1}.{2}( {3} );", strReturnLable, dialect.GetInvokeTargetBase(), x.Method.Name, strArgBody);
            sb.AppendLine();

            sb.Append("\t\t}");
            sb.AppendLine();
            sb.AppendLine();
        }
Ejemplo n.º 4
0
        private static void append_interface_class_begin( StringBuilder sb, Type type, AopCoderDialect dialect, String interfaceFullName )
        {
            sb.AppendFormat( "\tpublic class {0} : {1} ", dialect.GetClassFullName( type, interfaceFullName ), interfaceFullName );
            sb.Append( "{" );
            sb.AppendLine();
            sb.AppendLine();

            sb.AppendFormat( "\t\tprivate {0} _{1};", interfaceFullName, dialect.GetInvokeTargetBase() );
            sb.AppendLine();

            sb.AppendFormat( "\t\tpublic {0} {1} ", interfaceFullName, dialect.GetInvokeTargetBase() );
            sb.Append( "{" );
            sb.AppendLine();

            sb.Append( "\t\t\tget { return _" + dialect.GetInvokeTargetBase() + "; }" );
            sb.AppendLine();

            sb.Append( "\t\t\tset { _" + dialect.GetInvokeTargetBase() + " = value; }" );
            sb.AppendLine();

            sb.Append( "\t\t}" );
            sb.AppendLine();

            sb.AppendLine();
        }
Ejemplo n.º 5
0
        private static void append_method_invoke( StringBuilder sb, ObservedMethod x, AopCoderDialect dialect )
        {
            sb.Append( "\t\t\tObject returnValue = null;" );
            sb.AppendLine();

            List<MethodObserver> osList = getMethodObserver( x.ObservedType.Type, x.Method.Name );

            String strReturn = getReturnString( x.Method );
            if (strReturn == "void") {
                strReturn = "";
            }
            else {
                strReturn = "returnValue = ";
            }

            int invokeObserverIndex = getInovkeObserverIndex( osList );

            if (invokeObserverIndex > -1) {
                append_invoke_object( sb, x, dialect );
                sb.AppendFormat( "\t\t\t{0}observer{1}.Invoke( invocation );", strReturn, invokeObserverIndex );
                sb.AppendLine();
            }
            else {
                sb.AppendFormat( "\t\t\t{0}{1}.{2}({3});", strReturn, dialect.GetInvokeTargetBase(), x.Method.Name, getArgBodyFromArray( x.Method ) );
                sb.AppendLine();
            }
        }
Ejemplo n.º 6
0
        private static void append_method_base_single( StringBuilder sb, ObservedMethod x, AopCoderDialect dialect )
        {
            String strReturn = getReturnString( x.Method );
            String strArg = getArgString( x.Method );
            String strArgBody = getArgBody( x.Method );

            sb.AppendFormat( "\t\tpublic {0} {1}{2}({3}) ", strReturn, dialect.GetMethodBasePrefix(), x.Method.Name, strArg );
            sb.Append( "{" );
            sb.AppendLine();

            String strReturnLable = strReturn == "void" ? "" : "return ";

            sb.AppendFormat( "\t\t\t{0}{1}.{2}( {3} );", strReturnLable, dialect.GetInvokeTargetBase(), x.Method.Name, strArgBody );
            sb.AppendLine();

            sb.Append( "\t\t}" );
            sb.AppendLine();
            sb.AppendLine();
        }