Package javax.persistence

Examples of javax.persistence.EntityListeners


   */
  private Collection<Object> getEntityListeners(final Object theObj) {
    Collection<Object> aListeners = mManagedEntityListeners.get(theObj);

    if (aListeners == null) {
      EntityListeners aEntityListeners = BeanReflectUtil.getAnnotation(theObj.getClass(), EntityListeners.class);
     
      if (aEntityListeners != null) {
        // if there are entity listeners, lets create them
        aListeners = new HashSet<Object>();
        for (Class<?> aClass : aEntityListeners.value()) {
          try {
            aListeners.add(Empire.get().instance(aClass));
          }
          catch (Exception e) {
            LOGGER.error("There was an error instantiating an EntityListener. ", e);
View Full Code Here


    }
    return callbacks.toArray( new Callback[ callbacks.size() ] );
  }

  private static void getListeners(XClass currentClazz, List<Class> orderedListeners) {
    EntityListeners entityListeners = (EntityListeners) currentClazz.getAnnotation( EntityListeners.class );
    if ( entityListeners != null ) {
      Class[] classes = entityListeners.value();
      int size = classes.length;
      for ( int index = size - 1; index >= 0 ; index-- ) {
        orderedListeners.add( classes[index] );
      }
    }
    if ( useAnnotationAnnotatedByListener ) {
      Annotation[] annotations = currentClazz.getAnnotations();
      for ( Annotation annot : annotations ) {
        entityListeners = annot.getClass().getAnnotation( EntityListeners.class );
        if ( entityListeners != null ) {
          Class[] classes = entityListeners.value();
          int size = classes.length;
          for ( int index = size - 1; index >= 0 ; index-- ) {
            orderedListeners.add( classes[index] );
          }
        }
View Full Code Here

    }
    return callbacks.toArray( new Callback[ callbacks.size() ] );
  }

  private static void getListeners(XClass currentClazz, List<Class> orderedListeners) {
    EntityListeners entityListeners = currentClazz.getAnnotation( EntityListeners.class );
    if ( entityListeners != null ) {
      Class[] classes = entityListeners.value();
      int size = classes.length;
      for ( int index = size - 1; index >= 0 ; index-- ) {
        orderedListeners.add( classes[index] );
      }
    }
    if ( useAnnotationAnnotatedByListener ) {
      Annotation[] annotations = currentClazz.getAnnotations();
      for ( Annotation annot : annotations ) {
        entityListeners = annot.getClass().getAnnotation( EntityListeners.class );
        if ( entityListeners != null ) {
          Class[] classes = entityListeners.value();
          int size = classes.length;
          for ( int index = size - 1; index >= 0 ; index-- ) {
            orderedListeners.add( classes[index] );
          }
        }
View Full Code Here

    @Override
    public final void process(final Class<?> entityClass, EntityMetadata metadata)
    {

        // list all external listeners first.
        EntityListeners entityListeners = (EntityListeners) entityClass.getAnnotation(EntityListeners.class);
        if (entityListeners != null)
        {
            Class<?>[] entityListenerClasses = entityListeners.value();
            if (entityListenerClasses != null)
            {
                // iterate through all EntityListeners
                for (Class<?> entityListener : entityListenerClasses)
                {
View Full Code Here

TOP

Related Classes of javax.persistence.EntityListeners

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.