Package javassist

Examples of javassist.CtClass$DelayedFileOutputStream


        _source = new CtClassSource(pool);
    }

    private ClassFab newClassFab(String className, Class superClass)
    {
        CtClass ctClass = _source.newClass(className, superClass);

        return new ClassFabImpl(_source, ctClass);
    }
View Full Code Here


        ClassPool pool = new ClassPool();
        // Inside Maven Surefire, the system classpath is not sufficient to find all
        // the necessary files.
        pool.appendClassPath(new LoaderClassPath(_extraLoader));

        CtClass ctClass = pool.makeClass(SYNTH_COMPONENT_CLASSNAME);

        ctClass.setSuperclass(pool.get(BasicComponent.class.getName()));

        // Implement method getName()

        CtMethod method = CtNewMethod.make(
                "public String getName() { return \"" + name + "\"; }",
                ctClass);
        ctClass.addMethod(method);

        ctClass.addInterface(pool.get(Named.class.getName()));

        ctClass.writeFile(_extraClasspath.getAbsolutePath());
    }
View Full Code Here

        }
    }

    public CtClass newClass(String name, Class superClass)
    {
        CtClass ctSuperClass = getCtClass(superClass);

        return _pool.makeClass(name, ctSuperClass);
    }
View Full Code Here

    public String toString()
    {
        StringBuffer buffer = new StringBuffer("InterfaceFabImpl[\npublic interface ");

        CtClass ctClass = getCtClass();

        buffer.append(ctClass.getName());

        try
        {
            CtClass[] interfaces = ctClass.getInterfaces();

            for (int i = 0; i < interfaces.length; i++)
            {
                buffer.append(i == 0 ? " extends " : ", ");
                buffer.append(interfaces[i].getName());
View Full Code Here

        return buffer.toString();
    }

    public void addMethod(MethodSignature ms)
    {
        CtClass ctReturnType = convertClass(ms.getReturnType());
        CtClass[] ctParameters = convertClasses(ms.getParameterTypes());
        CtClass[] ctExceptions = convertClasses(ms.getExceptionTypes());

        CtMethod method = new CtMethod(ctReturnType, ms.getName(), ctParameters, getCtClass());
View Full Code Here

    public ClassFab newClass(String name, Class superClass)
    {
        try
        {
            CtClass ctNewClass = _classSource.newClass(name, superClass);

            return new ClassFabImpl(_classSource, ctNewClass);
        }
        catch (Exception ex)
        {
View Full Code Here

    public InterfaceFab newInterface(String name)
    {
        try
        {
            CtClass ctNewClass = _classSource.newInterface(name);

            return new InterfaceFabImpl(_classSource, ctNewClass);
        }
        catch (Exception ex)
        {
View Full Code Here

        return getCtClass().getName();
    }

    public void addField(String name, Class type)
    {
        CtClass ctType = convertClass(type);

        try
        {
            CtField field = new CtField(ctType, name, getCtClass());
            field.setModifiers(Modifier.PRIVATE);
View Full Code Here

    public MethodFab addMethod(int modifiers, MethodSignature ms, String body)
    {
        if (_methods.get(ms) != null)
            throw new ApplicationRuntimeException(ServiceMessages.duplicateMethodInClass(ms, this));

        CtClass ctReturnType = convertClass(ms.getReturnType());

        CtClass[] ctParameters = convertClasses(ms.getParameterTypes());
        CtClass[] ctExceptions = convertClasses(ms.getExceptionTypes());

        CtMethod method = new CtMethod(ctReturnType, ms.getName(), ctParameters, getCtClass());
View Full Code Here

     */
    private Map _ctClassCache = new HashMap();

    public void addInterface(Class interfaceClass)
    {
        CtClass ctInterfaceClass = _source.getCtClass(interfaceClass);

        _ctClass.addInterface(ctInterfaceClass);
    }
View Full Code Here

TOP

Related Classes of javassist.CtClass$DelayedFileOutputStream

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.