javax.persistence.EntityListeners.value()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(12.2k)|赞(0)|评价(0)|浏览(89)

本文整理了Java中javax.persistence.EntityListeners.value()方法的一些代码示例,展示了EntityListeners.value()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EntityListeners.value()方法的具体详情如下:
包路径:javax.persistence.EntityListeners
类名称:EntityListeners
方法名:value

EntityListeners.value介绍

暂无

代码示例

代码示例来源:origin: hibernate/hibernate-orm

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] );
          }
        }
      }
    }
  }
}

代码示例来源:origin: Impetus/Kundera

Class<?>[] entityListenerClasses = entityListeners.value();
if (entityListenerClasses != null)

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.ejb

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] );
          }
        }
      }
    }
  }
}

代码示例来源:origin: hibernate/hibernate-entitymanager

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] );
          }
        }
      }
    }
  }
}

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

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] );
          }
        }
      }
    }
  }
}

代码示例来源:origin: org.hibernate.orm/hibernate-core

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] );
          }
        }
      }
    }
  }
}

代码示例来源:origin: org.codehaus.castor/castor-jdo

.getAnnotation(EntityListeners.class);
if (entityListeners != null) {
  final Class<?>[] listeners = entityListeners.value();
  for (Class<?> listener : listeners) {
    invokeCallbacksFor(annotationClass, listener.newInstance());

代码示例来源:origin: org.apache.openjpa/com.springsource.org.apache.openjpa

/**
 * Parse @EntityListeners
 */
private Collection<LifecycleCallbacks>[] parseEntityListeners
  (ClassMetaData meta, EntityListeners listeners) {
  Class[] classes = listeners.value();
  Collection<LifecycleCallbacks>[] parsed = null;
  for (Class cls : classes)
    parsed = parseCallbackMethods(cls, parsed, true, true, 
      getRepository());
  return parsed;
}

代码示例来源:origin: appoxy/simplejpa

@SuppressWarnings("unchecked")
private void putEntityListeners(AnnotationInfo ai, EntityListeners entityListeners) {
  Class[] entityListenerClasses = entityListeners.value();
  if (entityListenerClasses == null) return;

代码示例来源:origin: org.streampipes/streampipes-empire-core

/**
 * Get or create the list of EntityListeners for an object.  If a list is created, it will be kept around and
 * re-used for later persistence operations.
 * @param theObj the object to get EntityLIsteners for
 * @return the list of EntityListeners for the object, or null if they do not exist
 */
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 LinkedHashSet<>();
      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);
        }
      }
      mManagedEntityListeners.put(theObj, aListeners);
    }
    else {
      aListeners = Collections.emptyList();
    }
  }
  return aListeners;
}

代码示例来源:origin: org.apache.openejb.patch/openjpa

/**
 * Parse @EntityListeners
 */
private Collection<LifecycleCallbacks>[] parseEntityListeners
  (ClassMetaData meta, EntityListeners listeners) {
  Class<?>[] classes = listeners.value();
  Collection<Class<?>> listenerColl = null;
  Collection<LifecycleCallbacks>[] parsed = null;
  for (Class<?> cls : classes) {
    if (!_conf.getCallbackOptionsInstance().getAllowsDuplicateListener()) {
      if (listenerColl == null)
        listenerColl = new ArrayList<Class<?>>();
      if (listenerColl.contains(cls)) 
        continue;
      listenerColl.add(cls);
    }
    
    parsed = parseCallbackMethods(cls, parsed, true, true,
      getRepository());
  }
  return parsed;
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

/**
 * Parse @EntityListeners
 */
private Collection<LifecycleCallbacks>[] parseEntityListeners
  (ClassMetaData meta, EntityListeners listeners) {
  Class<?>[] classes = listeners.value();
  Collection<Class<?>> listenerColl = null;
  Collection<LifecycleCallbacks>[] parsed = null;
  for (Class<?> cls : classes) {
    if (!_conf.getCallbackOptionsInstance().getAllowsDuplicateListener()) {
      if (listenerColl == null)
        listenerColl = new ArrayList<Class<?>>();
      if (listenerColl.contains(cls)) 
        continue;
      listenerColl.add(cls);
    }
    
    parsed = parseCallbackMethods(cls, parsed, true, true,
      getRepository());
  }
  return parsed;
}

代码示例来源:origin: org.apache.openjpa/openjpa-persistence

/**
 * Parse @EntityListeners
 */
private Collection<LifecycleCallbacks>[] parseEntityListeners
  (ClassMetaData meta, EntityListeners listeners) {
  Class<?>[] classes = listeners.value();
  Collection<Class<?>> listenerColl = null;
  Collection<LifecycleCallbacks>[] parsed = null;
  for (Class<?> cls : classes) {
    if (!_conf.getCallbackOptionsInstance().getAllowsDuplicateListener()) {
      if (listenerColl == null)
        listenerColl = new ArrayList<Class<?>>();
      if (listenerColl.contains(cls)) 
        continue;
      listenerColl.add(cls);
    }
    
    parsed = parseCallbackMethods(cls, parsed, true, true,
      getRepository());
  }
  return parsed;
}

代码示例来源:origin: org.apache.openejb.patch/openjpa-persistence

/**
 * Parse @EntityListeners
 */
private Collection<LifecycleCallbacks>[] parseEntityListeners
  (ClassMetaData meta, EntityListeners listeners) {
  Class<?>[] classes = listeners.value();
  Collection<Class<?>> listenerColl = null;
  Collection<LifecycleCallbacks>[] parsed = null;
  for (Class<?> cls : classes) {
    if (!_conf.getCallbackOptionsInstance().getAllowsDuplicateListener()) {
      if (listenerColl == null)
        listenerColl = new ArrayList<Class<?>>();
      if (listenerColl.contains(cls)) 
        continue;
      listenerColl.add(cls);
    }
    
    parsed = parseCallbackMethods(cls, parsed, true, true,
      getRepository());
  }
  return parsed;
}

代码示例来源:origin: org.batoo.jpa/batoo-jpa

/**
 * Handles the entity listeners.
 * 
 * @param metadata
 *            the metadata
 * 
 * @since 2.0.0
 */
private void handleEntityListeners(IdentifiableTypeMetadata metadata) {
  if ((metadata != null) && (metadata.getListeners().size() > 0)) {
    for (final EntityListenerMetadata listener : metadata.getListeners()) {
      new EntityListenerMetadataImpl(metadata.getLocator(), listener);
    }
    this.listeners.addAll(metadata.getListeners());
  }
  else {
    final EntityListeners entityListeners = this.getClazz().getAnnotation(EntityListeners.class);
    if (entityListeners != null) {
      this.getAnnotationsParsed().add(EntityListeners.class);
      for (final Class<?> clazz : entityListeners.value()) {
        this.listeners.add(new EntityListenerMetadataImpl(this.getLocator(), clazz));
      }
    }
  }
}

代码示例来源:origin: org.batoo.jpa/parser

/**
 * Handles the entity listeners.
 * 
 * @param metadata
 *            the metadata
 * 
 * @since 2.0.0
 */
private void handleEntityListeners(IdentifiableTypeMetadata metadata) {
  if ((metadata != null) && (metadata.getListeners().size() > 0)) {
    for (final EntityListenerMetadata listener : metadata.getListeners()) {
      new EntityListenerMetadataImpl(metadata.getLocator(), listener);
    }
    this.listeners.addAll(metadata.getListeners());
  }
  else {
    final EntityListeners entityListeners = this.getClazz().getAnnotation(EntityListeners.class);
    if (entityListeners != null) {
      this.getAnnotationsParsed().add(EntityListeners.class);
      for (final Class<?> clazz : entityListeners.value()) {
        this.listeners.add(new EntityListenerMetadataImpl(this.getLocator(), clazz));
      }
    }
  }
}

代码示例来源:origin: BatooOrg/BatooJPA

/**
 * Handles the entity listeners.
 * 
 * @param metadata
 *            the metadata
 * 
 * @since 2.0.0
 */
private void handleEntityListeners(IdentifiableTypeMetadata metadata) {
  if ((metadata != null) && (metadata.getListeners().size() > 0)) {
    for (final EntityListenerMetadata listener : metadata.getListeners()) {
      new EntityListenerMetadataImpl(metadata.getLocator(), listener);
    }
    this.listeners.addAll(metadata.getListeners());
  }
  else {
    final EntityListeners entityListeners = this.getClazz().getAnnotation(EntityListeners.class);
    if (entityListeners != null) {
      this.getAnnotationsParsed().add(EntityListeners.class);
      for (final Class<?> clazz : entityListeners.value()) {
        this.listeners.add(new EntityListenerMetadataImpl(this.getLocator(), clazz));
      }
    }
  }
}

代码示例来源:origin: toplink.essentials/toplink-essentials

/**
 * INTERNAL: (Overridden in XMLClassAccessor)
 * Process the @EntityListeners for this class accessor.
 */
public void processEntityListeners(Class entityClass, ClassLoader loader) {
  EntityListeners entityListeners = getAnnotation(EntityListeners.class);
  
  if (entityListeners != null) {
    for (Class entityListener : entityListeners.value()) {
      MetadataEntityListener listener = new MetadataEntityListener(entityListener, entityClass);
      
      // Process the candidate callback methods for this listener ...
      processCallbackMethods(MetadataHelper.getCandidateCallbackMethodsForEntityListener(listener), listener);
      
      // Add the entity listener to the descriptor event manager.    
      m_descriptor.addEntityListenerEventListener(listener);
    }
  }
}

代码示例来源:origin: org.apache.olingo/olingo-odata2-jpa-processor-core

EntityListeners entityListners = currentJPAEntityType.getJavaType().getAnnotation(EntityListeners.class);
if (entityListners != null) {
 for (Class<EntityListeners> entityListner : entityListners.value()) {
  if (ODataJPATombstoneEntityListener.class.isAssignableFrom(entityListner)) {
   jpaEdmMapping

代码示例来源:origin: io.cronapp/olingo-odata2-jpa-processor-core

EntityListeners entityListners = currentJPAEntityType.getJavaType().getAnnotation(EntityListeners.class);
if (entityListners != null) {
 for (Class<EntityListeners> entityListner : entityListners.value()) {
  if (ODataJPATombstoneEntityListener.class.isAssignableFrom(entityListner)) {
   jpaEdmMapping

相关文章