BrightSide Workbench Full Report + Source Code
org.turro.jpa.entity.EntityCollectionUtil Class Reference

Static Public Member Functions

static boolean remove (Collection c, IDaoEntity o)
 
static boolean contains (Collection c, IDaoEntity o)
 
static boolean replace (Collection c, IDaoEntity o)
 
static void removeEmpties (Collection c)
 
static void removeNews (Collection c)
 
static void iterate (Collection c, IFilter filter)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 28 of file EntityCollectionUtil.java.

Member Function Documentation

◆ contains()

static boolean org.turro.jpa.entity.EntityCollectionUtil.contains ( Collection  c,
IDaoEntity  o 
)
static

Definition at line 42 of file EntityCollectionUtil.java.

42  {
43  Iterator it = c.iterator();
44  while(it.hasNext()) {
45  Object entity = it.next();
46  if((entity instanceof IDaoEntity) && Objects.equals(((IDaoEntity) entity).entityId(), o.entityId())) {
47  return true;
48  }
49  }
50  return false;
51  }
Here is the call graph for this function:

◆ iterate()

static void org.turro.jpa.entity.EntityCollectionUtil.iterate ( Collection  c,
IFilter  filter 
)
static

Definition at line 80 of file EntityCollectionUtil.java.

80  {
81  Iterator it = c.iterator();
82  while(it.hasNext()) {
83  Object o = it.next();
84  if(filter.match(o)) {
85  filter.perform(it, o);
86  }
87  }
88  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove()

static boolean org.turro.jpa.entity.EntityCollectionUtil.remove ( Collection  c,
IDaoEntity  o 
)
static

Definition at line 30 of file EntityCollectionUtil.java.

30  {
31  Iterator it = c.iterator();
32  while(it.hasNext()) {
33  Object entity = it.next();
34  if((entity instanceof IDaoEntity) && Objects.equals(((IDaoEntity) entity).entityId(), o.entityId())) {
35  it.remove();
36  return true;
37  }
38  }
39  return false;
40  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeEmpties()

static void org.turro.jpa.entity.EntityCollectionUtil.removeEmpties ( Collection  c)
static

Definition at line 60 of file EntityCollectionUtil.java.

60  {
61  Iterator it = c.iterator();
62  while(it.hasNext()) {
63  Object obj = it.next();
64  if((obj instanceof IDaoEntity) && ((IDaoEntity) obj).isEmpty()) {
65  it.remove();
66  }
67  }
68  }
Here is the caller graph for this function:

◆ removeNews()

static void org.turro.jpa.entity.EntityCollectionUtil.removeNews ( Collection  c)
static

Definition at line 70 of file EntityCollectionUtil.java.

70  {
71  Iterator it = c.iterator();
72  while(it.hasNext()) {
73  Object obj = it.next();
74  if((obj instanceof IDaoEntity) && ((IDaoEntity) obj).isNew()) {
75  it.remove();
76  }
77  }
78  }
Here is the caller graph for this function:

◆ replace()

static boolean org.turro.jpa.entity.EntityCollectionUtil.replace ( Collection  c,
IDaoEntity  o 
)
static

Definition at line 53 of file EntityCollectionUtil.java.

53  {
54  if(remove(c, o)) {
55  return c.add(o);
56  }
57  return false;
58  }
Here is the caller graph for this function:

The documentation for this class was generated from the following file: