public static LinkedHashSet<Entity> findEntites(LinkedHashSet<Entity> matches,HashSet<Entity> checked,Entity entity,Predicate predicate){
  if (!checked.add(entity)) {
    return matches;
  }
  if (predicate.matches(entity)) {
    matches.add(entity);
  }
  for (  RefNode refNode : entity.getChildren(RefNode.class)) {
    Entity e=refNode.getReference();
    if (e != null) {
      findEntites(matches,checked,e,predicate);
    }
  }
  for (  ToManyNode toManyNode : entity.getChildren(ToManyNode.class)) {
    for (    Entity e : toManyNode.getList()) {
      if (e != null) {
        findEntites(matches,checked,e,predicate);
      }
    }
  }
  return matches;
}

public static LinkedHashSet < Entity > findEntites ( LinkedHashSet < Entity > matches , HashSet < Entity > checked , Entity entity , Predicate predicate ) { if ( ! checked . add ( entity ) ) { return matches ; } if ( predicate . matches ( entity ) ) { matches . add ( entity ) ; } for ( RefNode refNode : entity . getChildren ( RefNode . class ) ) { Entity e = refNode . getReference ( ) ; if ( e != null ) { findEntites ( matches , checked , e , predicate ) ; } } for ( ToManyNode toManyNode : entity . getChildren ( ToManyNode . class ) ) { for ( Entity e : toManyNode . getList ( ) ) { if ( e != null ) { findEntites ( matches , checked , e , predicate ) ; } } } return matches ; }
finds all entities by navigating the object graph from entity which match the given predicate . < br / >
