Examples of EntityListeners


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

Examples of javax.persistence.EntityListeners

    }
    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

Examples of javax.persistence.EntityListeners

    }
    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

Examples of javax.persistence.EntityListeners

    @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

Examples of net.sourceforge.jpaxjc.ns.persistence.orm.EntityListeners

                    entity.setExcludeSuperclassListeners( e );
                    acknowledge = true;
                }
                else if ( c.element.getLocalName().equals( "entity-listeners" ) )
                {
                    final EntityListeners e = JAXB.unmarshal( new DOMSource( c.element ), EntityListeners.class );
                    entity.setEntityListeners( e );
                    acknowledge = true;
                }
                else if ( c.element.getLocalName().equals( "pre-persist" ) )
                {
View Full Code Here

Examples of net.sourceforge.jpaxjc.ns.persistence.orm.EntityListeners

                    ms.setExcludeSuperclassListeners( e );
                    acknowledge = true;
                }
                else if ( c.element.getLocalName().equals( "entity-listeners" ) )
                {
                    final EntityListeners e = JAXB.unmarshal( new DOMSource( c.element ), EntityListeners.class );
                    ms.setEntityListeners( e );
                    acknowledge = true;
                }
                else if ( c.element.getLocalName().equals( "pre-persist" ) )
                {
View Full Code Here

Examples of org.mongodb.morphia.annotations.EntityListeners

        }

        final List<Class<?>> lifecycleClasses = new ArrayList<Class<?>>();
        lifecycleClasses.add(clazz);

        final EntityListeners entityLisAnn = (EntityListeners) getAnnotation(EntityListeners.class);
        if (entityLisAnn != null && entityLisAnn.value() != null && entityLisAnn.value().length != 0) {
            Collections.addAll(lifecycleClasses, entityLisAnn.value());
        }

        for (final Class<?> cls : lifecycleClasses) {
            for (final Method m : ReflectionUtils.getDeclaredAndInheritedMethods(cls)) {
                for (final Class<? extends Annotation> c : LIFECYCLE_ANNOTATIONS) {
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.