1
2
3
4 package org.rcfaces.core.internal.component;
5
6 import java.util.Collection;
7 import java.util.Collections;
8 import java.util.Iterator;
9 import java.util.Map;
10
11 import org.rcfaces.core.internal.capability.IComponentEngine;
12
13
14
15
16
17
18 public abstract class AbstractComponentEngine implements IComponentEngine {
19 private static final String REVISION = "$Revision: 1.18 $";
20
21 static final Iterator EMPTY_ITERATOR = Collections.EMPTY_SET.iterator();
22
23 protected final IFactory factory;
24
25 AbstractComponentEngine(IFactory factory) {
26 if (factory == null) {
27 throw new NullPointerException("Factory is NULL !");
28 }
29 this.factory = factory;
30 }
31
32
33
34
35
36
37
38 protected static final boolean isListEmpty(Collection list) {
39 return (list == null) || (list.size() < 1);
40 }
41
42 protected static final boolean isMapEmpty(Map map) {
43 return (map == null) || (map.size() < 1);
44 }
45
46 protected static final Iterator iteratorList(Collection list) {
47 if (isListEmpty(list)) {
48 return EMPTY_ITERATOR;
49 }
50
51 return list.iterator();
52 }
53 }