Package org.apache.bcel.classfile

Examples of org.apache.bcel.classfile.Method


                // ----------------------------------------------------------------
                // methods
                Arrays.sort(methods, FIELD_OR_METHOD_COMPARATOR);
                for (int i = 0; i < methods.length; i++)
                {
                    Method method = methods[i];
                    int mods = method.getAccessFlags();
                    if ((mods & Modifier.PRIVATE) == 0)
                    {
                        dout.writeUTF(method.getName());
                        dout.writeInt(mods);
                        dout.writeUTF(method.getSignature().replace('/', '.'));
                    }
                }
                // ----------------------------------------------------------------
                // closing
                dout.flush();
View Full Code Here


    {
        if (methodGen != null)
        {
            methodGen.setMaxStack();
            methodGen.setMaxLocals();
            Method m = methodGen.getMethod();
            classGen.addMethod(m);
            if (synthetic)
            {
                BCELUtils.addSynthetic(m, classGen.getConstantPool());
            }
View Full Code Here

        {
            // BCEL Field for use in enhancement process.
            Field field = null;

            // BCEL Method for use in enhancement process.
            Method method = null;
           
            // If the field is for this class, save the field for use in BCEL enhancing later
            method = BCELUtils.getGetterByName(name,((BCELClassMetaData)parent).getClassGen());
            if (method == null)
            {
View Full Code Here

    public static Method findMethod(
        final ClassGen targetClasGen,
        final String name,
        final String signature)
    {
        Method f[] = targetClasGen.getMethods();
        for (int i = 0; i < f.length; i++)
        {
            Method m = f[i];
            if (name.equals(m.getName()))
            {
                String methodSignature = m.getSignature();
                if (signature.equals(methodSignature))
                {
                    return m;
                }
            }
View Full Code Here

     * @param classGen class gen
     * @return field object. return null if field not found.
     */
    public static Method getGetterByName(final String fieldName, final ClassGen classGen)
    {
        Method m[] = classGen.getMethods();
        if( classGen == null )
        {
            return null;
        }
        String booleanGetterName = ClassUtils.getJavaBeanGetterName(fieldName, true);
View Full Code Here

        if (methodGen != null)
        {
            methodGen.setMaxStack();
            methodGen.setMaxLocals();
            Method m = methodGen.getMethod();
            classGen.replaceMethod(originalMethod, m);
            if (synthetic)
            {
                BCELUtils.addSynthetic(m, classGen.getConstantPool());
            }
View Full Code Here

      // next look at the types used in the method signatures
      Method[] aoMethods = _oJavaClass.getMethods();
      for ( int i = 0; i < aoMethods.length; i++ )
      {
         Method oMethod = aoMethods[ i ];

         // look at the type of the method return type
         addReference( oReferences, oMethod.getReturnType() );

         // look at the types of the method arguments
         Type[] oTypes = oMethod.getArgumentTypes();
         for ( int j = 0; j < oTypes.length; j++ )
         {
            addReference( oReferences, oTypes[ j ] );
         }
      }
View Full Code Here

            null, cpg.getConstantPool()));
    dups.add(varRef);
      }
  }

  Method init = compileInit(sortObjects, sortRecord,
           cpg, className);
  Method extract = compileExtract(sortObjects, sortRecord,
          cpg, className);
  sortRecord.addMethod(init);
  sortRecord.addMethod(extract);

  xsltc.dumpClass(sortRecord.getJavaClass());
View Full Code Here

        // methods
        List methodList = new ArrayList();
        Method[] methods = javaClass.getMethods();
        for (int i = 0; i < methods.length; i++) {
            Method method = methods[i];
            methodList.add(createMethodMetaData(method));
        }
        classMetaData.setMethods(methodList);

        // fields
View Full Code Here

          new String[] {},
          classGen.getStylesheet());
 
  final ConstantPoolGen cpg = sortRecord.getConstantPool()
 
  Method clinit = compileClassInit(sortObjects, sortRecord,
           cpg, className);
  Method extract = compileExtract(sortObjects, sortRecord,
          cpg, className);
  sortRecord.addMethod(clinit);
  sortRecord.addEmptyConstructor(ACC_PUBLIC);
  sortRecord.addMethod(extract);
View Full Code Here

TOP

Related Classes of org.apache.bcel.classfile.Method

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.