Package javassist

Examples of javassist.CtClass$DelayedFileOutputStream


            try {
                if (cache == null)
                    cache = cp.get(oldName);
   
                CtClass cache2 = cp.get(typeName);
                if (cache2.subtypeOf(cache)) {
                    cache = cache2;
                    return true;
                }
                else
                    return false;
View Full Code Here


   }
  
   @Override
   public CtClass createCtClass(String classname, boolean useCache)
   {
      CtClass clazz = super.createCtClass(classname, useCache);
      if (clazz != null)
      {
         lockInCache(clazz);
      }
      return clazz;
View Full Code Here

   public final CtClass get(String classname) throws NotFoundException
   {
      boolean trace = logger.isTraceEnabled();
      if (trace) logger.trace(this + " initiating get of " + classname);

      CtClass clazz = super.get(classname);
      if (trace)
      {
         logger.trace(this + " completed get of " + classname + " " + getClassPoolLogStringForClass(clazz));
      }
      return clazz;
View Full Code Here

    }
  }

  private void processClassFile(File javaClassFile) {
    try {
      final CtClass ctClass = classPool.makeClass( new FileInputStream( javaClassFile ) );
      if ( ! shouldInclude( ctClass ) ) {
        return;
      }

      final byte[] enhancedBytecode;
      try {
        enhancedBytecode = enhancer.enhance( ctClass.getName(), ctClass.toBytecode() );
      }
      catch (Exception e) {
        log( "Unable to enhance class [" + ctClass.getName() + "]", e, Project.MSG_WARN );
        return;
      }

      if ( javaClassFile.delete() ) {
        if ( ! javaClassFile.createNewFile() ) {
          log( "Unable to recreate class file [" + ctClass.getName() + "]", Project.MSG_INFO );
        }
      }
      else {
        log( "Unable to delete class file [" + ctClass.getName() + "]", Project.MSG_INFO );
      }

      FileOutputStream outputStream = new FileOutputStream( javaClassFile, false );
      try {
        outputStream.write( enhancedBytecode );
View Full Code Here

     * Atm only process files annotated with either @Entity or @Embeddable
     * @param javaClassFile
     */
    private void processClassFile(File javaClassFile) {
    try {
      final CtClass ctClass = classPool.makeClass( new FileInputStream( javaClassFile ) );
            if(this.isEntityClass(ctClass))
                processEntityClassFile(javaClassFile, ctClass);
            else if(this.isCompositeClass(ctClass))
                processCompositeClassFile(javaClassFile, ctClass);

View Full Code Here

         if (stream == null)
            throw new IllegalArgumentException("Null resource input stream: " + resource);

         try
         {
            CtClass ctClass = pool.makeClass(stream);
            try
            {
               List<CommitElement> commit = createCommitList();
               handleCtClass(ctClass, commit);
               if (commit.isEmpty() == false)
               {
                  for (CommitElement ce : commit)
                  {
                     env.putAnnotation(ce.getAnnotation(), ce.getType(), ce.getClassName(), ce.getSignature());
                  }
               }
            }
            finally
            {
               ctClass.detach();
            }
         }
         finally
         {
            try
View Full Code Here

      }
      try
      {
         //This will check the parents
         if (trace) logger.trace(this + " get cached or create " + classname + " from non-BaseClassPool pool " + pool);
         CtClass clazz = pool.get(classname);
         if (trace) logger.trace(this + " got cached or create " + classname + " from non-BaseClassPool pool " + clazz.getClassPool());
         return clazz;
      }
      catch(NotFoundException e)
      {
         return null;
View Full Code Here

      {
         if (trace) logger.trace(this + " get cached or create " + classname + " from BaseClassPool - no pool");
         return null;
      }
     
      CtClass clazz = null;
     
      if (clazz == null)
      {
         //We can use the exposed methods directly to avoid the overhead of NotFoundException
         if (trace) logger.trace(this + " get cached or create " + classname + " from BaseClassPool - checking cache");
View Full Code Here

   @Override
   public CtClass createCtClass(String classname, boolean useCache)
   {
      boolean trace = logger.isTraceEnabled();
      CtClass clazz = null;
      if (!childFirstLookup)
      {
         if (trace)logger.trace(this + " attempting to create " + classname + " in parent pool (parentFirst)");
         clazz = createParentCtClass(classname, useCache, trace);
      }
View Full Code Here

      if (parentBlacklist.contains(classname))
         return null;

      try
      {
         CtClass clazz = parent.get(classname);
         parentWhitelist.add(classname);
         return clazz;
      }
      catch (NotFoundException e)
      {
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.