Returns the metadata of various registered listeners for the given entity class.

@param entityClass
the entity class to introspect
@return the metadata of various listeners.
325729
public static EntityListenersMetadata introspect(Class<?> entityClass) {
    EntityListenersIntrospector introspector = new EntityListenersIntrospector(entityClass);
    introspector.introspect();
    return introspector.metadata;
  }
1296974
public static List<EntityField> getAll(Class<?> entityClass) {
        List<EntityField> fields = fieldHelper.getFields(entityClass);
        List<EntityField> properties = fieldHelper.getProperties(entityClass);
        //拼到一起，名字相同的合并
        List<EntityField> all = new ArrayList<EntityField>();
        Set<EntityField> usedSet = new HashSet<EntityField>();
        for (EntityField field : fields) {
            for (EntityField property : properties) {
                if (!usedSet.contains(property) && field.getName().equals(property.getName())) {
                    field.copyFromPropertyDescriptor(property);
                    usedSet.add(property);
                    break;
                }
            }
            all.add(field);
        }
        for (EntityField property : properties) {
            if (!usedSet.contains(property)) {
                all.add(property);
            }
        }
        return all;
    }
578927
protected void generateEntityListener(EntityListenerDesc entityListenerDesc) {
    File javaFile =
        FileUtil.createJavaFile(entityConfig.getDestDir(), entityListenerDesc.getQualifiedName());
    GenerationContext context =
        new GenerationContext(
            entityListenerDesc,
            javaFile,
            entityListenerDesc.getTemplateName(),
            entityConfig.getEncoding(),
            entityConfig.isOverwriteListener());
    generator.generate(context);
  }
760555
public function detect($entityClass)
    {
        $meta = $this->metadataManager->getMetadata($entityClass);
        $config = $meta->getConfiguration();

        if (!empty($config['order_by'])) {
            return $config['order_by'];
        }

        $criteria = [];

        $treeConfig = $this->treeListener->getConfiguration($this->em, $entityClass);

        if (!empty($treeConfig)) {
            $criteria[$treeConfig['level']] = 'asc';
        }

        $sortableConfig = $this->sortableListener->getConfiguration($this->em, $entityClass);

        if (!empty($sortableConfig)) {
            $criteria[$sortableConfig['position']] = 'asc';
        }
        if (!empty($criteria)) {
            return $criteria;
        }

        return [
            $meta->getIdentifier() => 'desc',
        ];
    }
442208
public List<EntityListener<EntityListeners<T>>> getAllEntityListener()
   {
      List<EntityListener<EntityListeners<T>>> list = new ArrayList<EntityListener<EntityListeners<T>>>();
      List<Node> nodeList = childNode.get("entity-listener");
      for(Node node: nodeList)
      {
         EntityListener<EntityListeners<T>>  type = new EntityListenerImpl<EntityListeners<T>>(this, "entity-listener", childNode, node);
         list.add(type);
      }
      return list;
   }
262171
public List<String> listEntities(final String entityType) throws AtlasServiceException {
        JSONObject jsonResponse = callAPIWithRetries(API.LIST_ENTITIES, null, new ResourceCreator() {
            @Override
            public WebResource createResource() {
                WebResource resource = getResource(API.LIST_ENTITIES);
                resource = resource.queryParam(TYPE, entityType);
                return resource;
            }
        });
        return extractResults(jsonResponse, AtlasClient.RESULTS, new ExtractOperation<String, String>());
    }
548712
private function getNewObjectFlagMeta($entityClass)
    {
        $meta = $this->extendedMetadataFactory->getExtendedMetadata($entityClass);

        return isset($meta['newObjectFlag']) ? $meta['newObjectFlag'] : [];
    }
902753
@SuppressWarnings("unchecked")
	public <T extends EventListener> T[] getListeners(Class<T> type) {
		final Object[] iListeners = this.listeners;
		final int listenerCount = getListenerCount(iListeners, type);
		final T[] result = (T[]) Array.newInstance(type, listenerCount);
		int j = 0;
		for (int i = iListeners.length - 2; i >= 0; i -= 2) {
			if (iListeners[i] == type) {
				result[j++] = type.cast(iListeners[i + 1]);
			}
		}
		return result;
	}
534740
@Override
    public Object find(Class entityClass, Object key)
    {
        EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entityClass);

        MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                entityMetadata.getPersistenceUnit());

        AbstractManagedType managedType = (AbstractManagedType) metaModel.entity(entityMetadata.getEntityClazz());

        return managedType.hasLobAttribute() ? findGFSEntity(entityMetadata, entityClass, key) : find(entityClass, key,
                entityMetadata, metaModel, managedType);
    }
245428
public static ExternalListenerMetadata introspect(Class<?> listenerClass) {
    ExternalListenerMetadata cachedMetadata = cache.get(listenerClass);
    if (cachedMetadata != null) {
      return cachedMetadata;
    }
    synchronized (listenerClass) {
      cachedMetadata = cache.get(listenerClass);
      if (cachedMetadata != null) {
        return cachedMetadata;
      }
      ExternalListenerIntrospector introspector = new ExternalListenerIntrospector(listenerClass);
      introspector.introspect();
      cache.put(listenerClass, introspector.metadata);
      return introspector.metadata;
    }
  }
1157953
@SuppressWarnings("unchecked")
  @Override
  public <T> List<T> getCollection(Class<T> entityClass) {
    String collectionName = Util.determineCollectionName(entityClass);
    Map<Object, T> collection = (Map<Object, T>) collectionsRef.get().get(collectionName);
    if (null == collection) {
      createCollection(collectionName);
      collection = (Map<Object, T>) collectionsRef.get().get(collectionName);
    }

    CollectionMetaData cmd = cmdMap.get(collectionName);
    List<T> newCollection = new ArrayList<T>();
    try {
      for (T document : collection.values()) {
        Object obj = Util.deepCopy(document);
        if(encrypted && cmd.hasSecret() && null != obj) {
          CryptoUtil.decryptFields(obj, cmd, dbConfig.getCipher());
        }
        newCollection.add((T) obj);
      }
    } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
      logger.error("Error when decrypting value for a @Secret annotated field for entity: " + collectionName, e);
      throw new JsonDBException("Error when decrypting value for a @Secret annotated field for entity: " + collectionName, e);
    }
    return newCollection;
  }
1305819
private Object find(Class entityClass, Object key, List<String> columnsToSelect)
    {
        EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entityClass);
        MetamodelImpl metamodel = (MetamodelImpl) KunderaMetadataManager.getMetamodel(kunderaMetadata,
                entityMetadata.getPersistenceUnit());

        String idColumnName = ((AbstractAttribute) entityMetadata.getIdAttribute()).getJPAColumnName();
        Table schemaTable = tableAPI.getTable(entityMetadata.getTableName());

        PrimaryKey rowKey = schemaTable.createPrimaryKey();
        if (metamodel.isEmbeddable(entityMetadata.getIdAttribute().getBindableJavaType()))
        {
            readEmbeddable(key, columnsToSelect, entityMetadata, metamodel, schemaTable, rowKey,
                    entityMetadata.getIdAttribute());
        }
        else
        {
            if (eligibleToFetch(columnsToSelect, idColumnName))
            {
                NoSqlDBUtils.add(schemaTable.getField(idColumnName), rowKey, key, idColumnName);
            }
        }
        KunderaCoreUtils.printQuery("Fetch data from " + entityMetadata.getTableName() + " for PK " + key, showQuery);
        if (log.isDebugEnabled())
        {
            log.debug("Fetching data from " + entityMetadata.getTableName() + " for PK " + key);
        }

        // Object entity = null;
        List entities = new ArrayList();
        Map<String, Object> relationMap = initialize(entityMetadata);

        try
        {
            Iterator<Row> rowsIter = tableAPI.tableIterator(rowKey, null, null);
            // iterator and build entity
            entities = scrollAndPopulate(key, entityMetadata, metamodel, schemaTable, rowsIter, relationMap,
                    columnsToSelect);
        }
        catch (Exception e)
        {
            log.error("Error while finding data for Key " + key + ", Caused By :" + e + ".");
            throw new PersistenceException(e);
        }

        return entities.isEmpty() ? null : entities.get(0);
    }
110546
private static Collection<Class> scanEntityClasses(String... persistenceXmlFiles) {
        DDLGenerator.Profile profile = new DDLGenerator.Profile(null);
        profile.addPersistenceFile(persistenceXmlFiles);
        return profile.getEntityClasses();
    }
914824
public void fireEventListeners(EntityMetadata metadata, Object entity, Class<?> event)
    {

        // handle external listeners first
        List<? extends CallbackMethod> callBackMethods = metadata.getCallbackMethods(event);

        if (null != callBackMethods && !callBackMethods.isEmpty() && null != entity)
        {
            log.debug("Callback >> " + event.getSimpleName() + " on " + metadata.getEntityClazz().getName());
            for (CallbackMethod callback : callBackMethods)
            {
                log.debug("Firing >> " + callback);

                callback.invoke(entity);

            }
        }
    }
365566
private function getDoctrineMetadata($entityClass)
    {
        if (!isset($this->doctrineMetadata[$entityClass])) {
            try {
                $this->doctrineMetadata[$entityClass] = $this->em->getClassMetadata($entityClass);
            } catch (MappingException $ex) {
                throw new FiltererException(sprintf('Unable to get Doctrine metadata for class "%s".', $entityClass));
            }
        }

        return $this->doctrineMetadata[$entityClass];
    }
79481
private static Class<?> getIdClass(Class<?> entityClass) {
        Type[] genTypes = entityClass.getGenericInterfaces();

        for (int i = 0; i < genTypes.length; i++) {
            Type genType = genTypes[i];
            String s1 = genType.getClass().getName();
            String s2 = BaseEntity.class.getName();
            if (s1.startsWith(s2)) {
                Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
                // ID真实的class
                Class<?> mapperClass = (Class<?>) params[0];
                return mapperClass;
            }
        }

        return null;
    }
1275518
private function getSlugsMetadata($entityClass)
    {
        if (!isset($this->slugsMetadata[$entityClass])) {
            $meta = $this->extendedMetadataFactory->getExtendedMetadata($entityClass);

            if (!isset($meta['slugs']) || empty($meta['slugs'])) {
                $message = sprintf(
                    'At least one property of class "%s" must be annotated with "%s" annotation in order to generate slug.',
                    $entityClass,
                    Slug::class
                );

                throw new SluggableException($message);
            }

            $this->slugsMetadata[$entityClass] = $meta['slugs'];
        }

        return $this->slugsMetadata[$entityClass];
    }