Examples of JavaClass


Examples of net.percederberg.grammatica.code.java.JavaClass

        if (gen.getPublicAccess()) {
            modifiers = JavaClass.PUBLIC;
        } else {
            modifiers = JavaClass.PACKAGE_LOCAL;
        }
        this.cls = new JavaClass(modifiers,
                                 gen.getBaseName() + "Tokenizer",
                                 "Tokenizer");
        this.initMethod = new JavaMethod(JavaMethod.PRIVATE,
                                         "createPatterns",
                                         "",
View Full Code Here

Examples of no.hal.jex.JavaClass

    return super.getImage(object);
  }
 
  @Override
  public String getImageName(Object object) {
    JavaClass javaClass = (JavaClass)object;
    if (javaClass.getClassKind() == ClassKind.INTERFACE_KIND) {
      return JDT_UI_IMAGE_PREFIX + "int_obj.gif";
    } else if (javaClass.getClassKind() == ClassKind.ENUM_KIND) {
      String modifierString = getAccessModifierString(javaClass, JexFactoryImpl.getModifier("public"), null);
      return JDT_UI_IMAGE_PREFIX + "enum_" + (modifierString != null ? modifierString + "_" : "") + "obj.gif";
    }
    return JDT_UI_IMAGE_PREFIX + "class_obj.gif";
  }
View Full Code Here

Examples of org.ajax4jsf.builder.model.JavaClass

  public JavaClass build(ComponentBean componentBean, JSFGeneratorConfiguration configuration) {
   
    String superclassname =
      componentBean.getSuperclass();
   
    JavaClass javaClass =
      new JavaClass(componentBean.getSimpleClassName(),
          new JavaPackage(componentBean.getPackageName()));
   
    try {
      Class<?> superClass =
        Class.forName(superclassname, false, configuration.getClassLoader());
     
      javaClass.setSuperClass(superClass);
     
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
      javaClass.setSuperClass(UIComponentBase.class);
    }
   
    javaClass.addModifier(JavaModifier.PUBLIC);
   
    javaClass.addField(getComponentFamily(componentBean));
    javaClass.addField(getComponentType(componentBean));
   
    javaClass.addMethod(getConstructor(componentBean, javaClass));
   
    Collection<PropertyBean> properties = componentBean.getProperties();
   
    for (PropertyBean propertyBean : properties) {
      PropertyProcessor proc = null;
     
      for (int i = 0; i < propertyProcessors.length && proc == null; i++) {
       
        PropertyProcessor processor =
          propertyProcessors[i];
       
        if (processor.accept(propertyBean, javaClass, configuration)) {
          proc = processor;
        }
      }
     
      if (proc != null) {
        proc.process(propertyBean, javaClass, configuration);
      }
    }

    javaClass.addMethod(getComponentFamilyMethod(componentBean));
   
    ComponentStateManager stateManager = new ComponentStateManager(javaClass);
   
    JavaMethod saveState = getSaveStateTemplate();
    try {
      saveState.setMethodBody(stateManager.getSaveStateMethodBody(configuration));
    } catch (GeneratorException e) {
      e.printStackTrace();
    }
    javaClass.addMethod(saveState);
   
    JavaMethod restoreState = getRestoreStateTemplate();
    try {
      restoreState.setMethodBody(stateManager.getRestoreStateMethodBody(configuration));
    } catch (GeneratorException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    javaClass.addMethod(restoreState);
   
   
   
    return javaClass;
   
View Full Code Here

Examples of org.apache.axis.utils.cache.JavaClass

    }

    public synchronized void registerClass( String name, Class cls ) {
        /* And finally register it */
        /***************************/
        JavaClass oldClass = (JavaClass)classCache.get(name);
        if (oldClass!=null && oldClass.getJavaClass()==cls) return;
        classCache.put( name, new JavaClass(cls) );
    }
View Full Code Here

Examples of org.apache.bcel.classfile.JavaClass

     */
    private void defineFields(ClassFile cf, ContainerElementBase contain)
        throws JiBXException {
       
        // process all non-final/non-static/non-transient fields of class
        JavaClass clas = cf.getRawClass();
        Field[] fields = clas.getFields();
        for (int i = 0; i < fields.length; i++) {
            Field field = fields[i];
            if (!field.isFinal() && !field.isStatic() && !field.isTransient()) {
               
                // find type of handling needed for field type
View Full Code Here

Examples of org.apache.bcel.classfile.JavaClass

     * @param fname name of field supplying reference
     * @throws JiBXException on error in binding generation
     */
    private StructureElement createStructure(ClassFile cf, String fname)
        throws JiBXException {
        JavaClass clas = cf.getRawClass();
        if (m_verbose) {
            nestingIndent(System.out);
            System.out.println("creating nested structure definition for " +
                clas.getClassName());
        }
        String cname = clas.getClassName();
        for (int i = 0; i < m_structureStack.size(); i++) {
            if (cname.equals(m_structureStack.peek(i))) {
                StringBuffer buff =
                    new StringBuffer("Error: recursive use of ");
                buff.append(cname);
                buff.append(" requires <mapping>:\n ");
                while (i >= 0) {
                    buff.append(m_structureStack.peek(i--));
                    buff.append(" -> ");
                }
                buff.append(cname);
                throw new JiBXException(buff.toString());
            }
        }
        if (cname.startsWith("java.")) {
            nestingIndent(System.err);
            System.err.println("Warning: trying to create structure for " +
                cname);
        } else if (m_structureNames.contains(cname)) {
            nestingIndent(System.err);
            System.err.println("Warning: repeated usage of class " +
                cname + "; consider adding to mapping list");
        } else {
            m_structureNames.add(cname);
        }
        m_structureStack.push(cname);
        StructureElement element = new StructureElement();
        element.setFieldName(fname);
        element.setName(valueName(fname));
        defineStructure(cf, element);
        if (element.children().isEmpty()) {
            throw new JiBXException("No content found for class " + cname);
        }
        m_structureStack.pop();
        if (m_verbose) {
            nestingIndent(System.out);
            System.out.println("completed nested structure definition for " +
                clas.getClassName());
        }
        return element;
    }
View Full Code Here

Examples of org.apache.bcel.classfile.JavaClass

     * @param abstr force abstract mapping flag
     * @throws JiBXException on error in binding generation
     */
    private MappingElementBase createMapping(ClassFile cf, boolean abstr)
        throws JiBXException {
        JavaClass clas = cf.getRawClass();
        if (m_verbose) {
            System.out.println("\nBuilding mapping definition for " +
                clas.getClassName());
        }
        MappingElementBase element = new MappingElement();
        element.setAbstract(abstr || clas.isAbstract() || clas.isInterface());
        String name = clas.getClassName();
        element.setClassName(name);
        if (abstr) {
            element.setAbstract(true);
        } else {
            element.setName((String)m_mappedNames.get(name));
View Full Code Here

Examples of org.apache.bcel.classfile.JavaClass

            if (!org.jibx.runtime.Utility.isEqual(getPackage(),
                comp.getPackage()) || getSuperFile() != comp.getSuperFile() ||
                !Arrays.equals(getInterfaces(), comp.getInterfaces())) {
                return false;
            }
            JavaClass tjc = m_curClass;
            JavaClass cjc = comp.m_curClass;
            if (tjc.getAccessFlags() != cjc.getAccessFlags()) {
                return false;
            }
           
            // compare the defined fields
            Field[] tfields = tjc.getFields();
            Field[] cfields = cjc.getFields();
            if (tfields.length != cfields.length) {
                return false;
            }
            for (int i = 0; i < tfields.length; i++) {
                if (!equalFieldOrMethods(tfields[i], cfields[i])) {
                    return false;
                }
            }
           
            // compare the defined methods
            Method[] tmethods = tjc.getMethods();
            Method[] cmethods = cjc.getMethods();
            if (tmethods.length != cmethods.length) {
                return false;
            }
            for (int i = 0; i < tmethods.length; i++) {
                Method tmethod = tmethods[i];
                Method cmethod = cmethods[i];
                if (!equalFieldOrMethods(tmethod, cmethod) ||
                    !equalMethods(tmethod, cmethod)) {
                    return false;
                }
            }
       
            // finish with constant table values (correcting name and signature)
            Constant[] tcnsts = tjc.getConstantPool().getConstantPool();
            Constant[] ccnsts = cjc.getConstantPool().getConstantPool();
            if (tcnsts.length != ccnsts.length) {
                return false;
            }
            for (int i = tjc.getClassNameIndex()+1; i < tcnsts.length; i++) {
                Constant tcnst = tcnsts[i];
View Full Code Here

Examples of org.apache.bcel.classfile.JavaClass

  /*
   * Test for JavaClass speedup(JavaClass)
   */
  public void testSpeedupJavaClass() throws IOException {
    //System.out.println(before);
    JavaClass beforeClass = getJavaClassForSource(getFilename(), getBefore());
    new Class2HTML(beforeClass, tempdir.getPath()+File.separator+"before"+File.separator);
    JavaClass afterClass = getJavaClassForSource(getFilename(), getAfter());
    new Class2HTML(afterClass, tempdir.getPath()+File.separator+"after"+File.separator);
    JavaClass justLogClass = Transform.speedup(beforeClass);
    new Class2HTML(justLogClass, tempdir.getPath()+File.separator+"modified"+File.separator);
    //assertNotSame(beforeClass.getBytes(),justLog.getBytes());
   
    //justLog.dump(new File(tempdir, "justlog.class"));
   
View Full Code Here

Examples of org.apache.bcel.classfile.JavaClass

    InputStream in,
    String filename,
    OutputStream out)
    throws ClassFormatException, IOException {
    input.setInput(in);
    JavaClass source = (new ClassParser(input, filename)).parse();
    logger.info("Source size:" + source.getBytes().length);
    JavaClass target = Transform.speedup(source);
    logger.info("after optimization: " + target.getBytes().length);
    byte[] tmp = target.getBytes();
    out.write(tmp);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.