2 Replies Latest reply on Feb 17, 2009 6:25 PM by Vladimir Kovalyuk

    Inner classes are not scanned by deployment strategy

    Vladimir Kovalyuk Apprentice

      Inner classes are not scanned by the standard deployment strategy.
      However inner entity classes are understood by for instance JPA.

        • 1. Re: Inner classes are not scanned by deployment strategy
          Norman Richards Expert

          Are you sure?  I'm pretty sure we have inner classes as components in the test suite.

          • 2. Re: Inner classes are not scanned by deployment strategy
            Vladimir Kovalyuk Apprentice

            Yep, I'm sure.
            I didn't investigate this deeply though.


            public class MyDeploymentHandler extends AbstractClassDeploymentHandler {
            
                 private static final LogProvider log = Logging.getLogProvider(MyDeploymentHandler.class);
                 public static final String NAME = MyDeploymentHandler.class.getName();
            
                 private static Set<Class<? extends Annotation>> classAnnotations = new HashSet<Class<? extends Annotation>>();
            
                 private static ClassDeploymentMetadata metadata;
            
                 static {
                      classAnnotations.add(Entity.class);
                      classAnnotations.add(MappedSuperclass.class);
                      classAnnotations.add(Embeddable.class);
                      metadata = new ClassDeploymentMetadata() {
            
                           @Override
                           public Set<Class<? extends Annotation>> getClassAnnotatedWith() {
                                return classAnnotations;
                           }
            
                           @Override
                           public String getFileNameSuffix() {
                                return null;
                           }
            
                      };
            
                 }
            
                    @Override
                 public ClassDeploymentMetadata getMetadata() {
                      return metadata;
                 }
                 
                 @Override
                 public String getName() {
                      return NAME;
                 }
            
                 @Override
                 public void postProcess(ClassLoader classLoader) {
                      for (ClassDescriptor classDescriptor : getClasses()) {
                           Class<?> klass = classDescriptor.getClazz();
                           ... inner classes don't come here ...
                      }
                 }
            
            }