### Eclipse Workspace Patch 1.0
#P magnolia-core
Index: src/main/java/info/magnolia/cms/core/search/QueryResult.java
===================================================================
--- src/main/java/info/magnolia/cms/core/search/QueryResult.java	(revision 28782)
+++ src/main/java/info/magnolia/cms/core/search/QueryResult.java	(working copy)
@@ -33,6 +33,8 @@
  */
 package info.magnolia.cms.core.search;
 
+import info.magnolia.cms.core.Content;
+
 import java.util.Collection;
 
 
@@ -45,11 +47,11 @@
     /**
      * Gets a collection of Content objects for mgnl:content NodeType
      */
-    Collection getContent();
+    Collection<Content> getContent();
 
     /**
      * Gets a collection of Content objects for specified NodeType
      */
-    Collection getContent(String nodeType);
+    Collection<Content> getContent(String nodeType);
 
 }
Index: src/main/java/info/magnolia/cms/util/QueryUtil.java
===================================================================
--- src/main/java/info/magnolia/cms/util/QueryUtil.java	(revision 29339)
+++ src/main/java/info/magnolia/cms/util/QueryUtil.java	(working copy)
@@ -33,6 +33,7 @@
  */
 package info.magnolia.cms.util;
 
+import info.magnolia.cms.core.Content;
 import info.magnolia.cms.core.ItemType;
 import info.magnolia.cms.core.search.Query;
 import info.magnolia.cms.core.search.QueryManager;
@@ -63,7 +64,7 @@
      * @param statement
      * @return
      */
-    public static Collection query(String repository, String statement){
+    public static Collection<Content> query(String repository, String statement){
         return query(repository,statement, Query.SQL);
     }
 
@@ -74,14 +75,14 @@
      * @param language
      * @return
      */
-    public static Collection query(String repository, String statement, String language){
+    public static Collection<Content> query(String repository, String statement, String language){
         return query(repository,statement,language, ItemType.NT_BASE);
     }
 
     /**
      * Executes a query, throwing any exceptions that arise as a result.
      */
-    public static Collection exceptionThrowingQuery(String repository, String statement, String language, String returnItemType) throws RepositoryException {
+    public static Collection<Content> exceptionThrowingQuery(String repository, String statement, String language, String returnItemType) throws RepositoryException {
         QueryManager qm = MgnlContext.getQueryManager(repository);
         Query query= qm.createQuery(statement, language);
         QueryResult result = query.execute();
@@ -96,7 +97,8 @@
      * @param returnItemType
      * @return
      */
-    public static Collection query(String repository, String statement, String language, String returnItemType) {
+    @SuppressWarnings("unchecked")
+    public static Collection<Content> query(String repository, String statement, String language, String returnItemType) {
         try {
             return exceptionThrowingQuery(repository, statement, language, returnItemType);
         } catch (Exception e) {
@@ -150,7 +152,7 @@
         cal.set(year, month - 1, day, hour, minutes, seconds);
         return createDateTimeExpression(cal);
     }
-    
+
     /**
      * Do not consider the timezone.
      */
Index: src/main/java/info/magnolia/content2bean/TypeDescriptor.java
===================================================================
--- src/main/java/info/magnolia/content2bean/TypeDescriptor.java	(revision 28782)
+++ src/main/java/info/magnolia/content2bean/TypeDescriptor.java	(working copy)
@@ -50,7 +50,7 @@
  */
 public class TypeDescriptor {
 
-    private Class type;
+    private Class<?> type;
 
     private ItemType itemType;
 
@@ -60,7 +60,7 @@
 
     private boolean isCollection;
 
-    private Map descriptors;
+    private Map<String, PropertyTypeDescriptor> descriptors;
 
     public ItemType getItemType() {
         return this.itemType;
@@ -70,11 +70,11 @@
         this.itemType = itemType;
     }
 
-    public Class getType() {
+    public Class<?> getType() {
         return this.type;
     }
 
-    public void setType(Class type) {
+    public void setType(Class<?> type) {
         this.type = type;
     }
 
@@ -99,20 +99,20 @@
     }
 
     public PropertyTypeDescriptor getPropertyTypeDescriptor(String properyName) {
-        return (PropertyTypeDescriptor) getPropertyDescriptors().get(properyName);
+        return getPropertyDescriptors().get(properyName);
     }
 
     /**
-     * This method is not synchronized to avoid thread blockings but the method guaranties that the returned map is not mutated afterward.
+     * This method is not synchronized to avoid thread blocking, but the method guarantees that the returned map is not mutated afterward.
      */
-    public Map getPropertyDescriptors() {
+    public Map<String, PropertyTypeDescriptor> getPropertyDescriptors() {
         if(this.descriptors == null){
             // TODO this breaks the usage of a custom mapping
             TypeMapping mapping = TypeMapping.Factory.getDefaultMapping();
 
-            // for not miking this methos synchronized we crteate a local variable first
-            // this guaranties that the map you get is not changed after retu
-            final Map tmpDescriptors = new HashMap();
+            // for not making this method synchronized we create a local variable first
+            // this guarantees that the map you get is not changed after return
+            final Map<String, PropertyTypeDescriptor> tmpDescriptors = new HashMap<String, PropertyTypeDescriptor>();
             PropertyDescriptor[] dscrs = PropertyUtils.getPropertyDescriptors(this.getType());
             for (int i = 0; i < dscrs.length; i++) {
                 PropertyDescriptor descriptor = dscrs[i];
Index: src/main/java/info/magnolia/cms/util/DelayedExecutor.java
===================================================================
--- src/main/java/info/magnolia/cms/util/DelayedExecutor.java	(revision 29339)
+++ src/main/java/info/magnolia/cms/util/DelayedExecutor.java	(working copy)
@@ -83,7 +83,7 @@
         }
         if (taskId != null && (timestamp + maxDelay >= now)) {
             log.debug("execution canceled");
-            timer.cancel(taskId);
+            ClockDaemon.cancel(taskId);
         }
         taskId = timer.executeAfterDelay(delay, command);
     }
Index: src/main/java/info/magnolia/cms/util/FactoryUtil.java
===================================================================
--- src/main/java/info/magnolia/cms/util/FactoryUtil.java	(revision 29339)
+++ src/main/java/info/magnolia/cms/util/FactoryUtil.java	(working copy)
@@ -59,7 +59,7 @@
 
 
 /**
- * Central factory instanciating most Magnolia beans, managers, observers and so on.
+ * Central factory instantiating most Magnolia beans, managers, observers and so on.
  *
  * @author Philipp Bracher
  * @version $Revision$ ($Author$)
@@ -74,12 +74,12 @@
     /**
      * Registered singleton instances.
      */
-    private final static Map instances = new HashMap();
+    private final static Map<Class<?>, Object> instances = new HashMap<Class<?>, Object>();
 
     /**
      * Registered Prototypes used for new Instance.
      */
-    private final static Map factories = new HashMap();
+    private final static Map<Class<?>, InstanceFactory> factories = new HashMap<Class<?>, InstanceFactory>();
 
     private FactoryUtil() {
 
@@ -89,14 +89,14 @@
      * Creates a new instance of the passed interface / class by using the registered implementation. If this fails a {@link IllegalStateException} is thrown.
      * @throws IllegalStateException
      */
-    public static Object newInstance(Class interf) {
+    public static Object newInstance(Class<?> interf) {
         if(interf == null){
             log.error("interf can't be null", new Throwable());
             return null;
         }
         try {
             if (factories.containsKey(interf)) {
-                return ((InstanceFactory) factories.get(interf)).newInstance();
+                return (factories.get(interf)).newInstance();
             }
 
             String className = StringUtils.defaultIfEmpty(SystemProperty.getProperty(interf.getName()), interf.getName());
@@ -109,16 +109,14 @@
                 }
                 return new ObservedObjectFactory(repository, path, interf);
             }
-            else{
-                Class clazz = ClassUtil.classForName(className);
-                Object instance = clazz.newInstance();
+            Class<?> clazz = ClassUtil.classForName(className);
+            Object instance = clazz.newInstance();
 
-                if(instance instanceof InstanceFactory){
-                    setInstanceFactory(interf, (InstanceFactory)instance);
-                    return ((InstanceFactory)instance).newInstance();
-                }
-                return instance;
+            if(instance instanceof InstanceFactory){
+                setInstanceFactory(interf, (InstanceFactory)instance);
+                return ((InstanceFactory)instance).newInstance();
             }
+            return instance;
         }
         catch (Exception e) {
             throw new IllegalStateException("Can't instantiate an implementation of this class [" + interf.getName() + "]: " + ExceptionUtils.getMessage(e), e);
@@ -129,14 +127,12 @@
         return className.startsWith("/") || className.indexOf(':') >= 0;
     }
 
-    public static Class getImplementation(Class interf) throws ClassNotFoundException {
+    public static Class<?> getImplementation(Class<?> interf) throws ClassNotFoundException {
         String className = StringUtils.defaultIfEmpty(SystemProperty.getProperty(interf.getName()), interf.getName());
         if(!isInRepositoryDefinition(className)){
             return ClassUtil.classForName(className);
         }
-        else{
-            return interf;
-        }
+        return interf;
     }
 
     /**
@@ -148,7 +144,7 @@
             return null;
         }
 
-        Class clazz;
+        Class<?> clazz;
         try {
             clazz = ClassUtil.classForName(className);
         }
@@ -169,7 +165,7 @@
         return newInstanceWithoutDiscovery(className, new Object[]{});
     }
 
-    public static synchronized Object getSingleton(Class interf) {
+    public static synchronized Object getSingleton(Class<?> interf) {
         Object instance = instances.get(interf);
         if (instance == null) {
             instance = newInstance(interf);
@@ -181,21 +177,21 @@
         return instance;
     }
 
-    public static void setDefaultImplementation(Class interf, Class impl) {
+    public static void setDefaultImplementation(Class<?> interf, Class<?> impl) {
         setDefaultImplementation(interf, impl.getName());
     }
 
-    public static void setDefaultImplementation(Class interf, String impl) {
+    public static void setDefaultImplementation(Class<?> interf, String impl) {
         if(!SystemProperty.getProperties().containsKey(interf.getName())){
             setImplementation(interf, impl);
         }
     }
 
-    public static void setImplementation(Class interf, Class impl) {
+    public static void setImplementation(Class<?> interf, Class<?> impl) {
         setImplementation(interf, impl.getName());
     }
 
-    public static void setImplementation(Class interf, String impl) {
+    public static void setImplementation(Class<?> interf, String impl) {
         SystemProperty.getProperties().setProperty(interf.getName(), impl);
     }
 
@@ -203,14 +199,14 @@
     /**
      * Register an instance which will be returned by getSingleton().
      */
-    public static void setInstance(Class interf, Object instance) {
+    public static void setInstance(Class<?> interf, Object instance) {
         instances.put(interf, instance);
     }
 
     /**
      * newInstance will use this prototype for cloning a new object.
      */
-    public static void setInstanceFactory(Class interf, InstanceFactory factory) {
+    public static void setInstanceFactory(Class<?> interf, InstanceFactory factory) {
         factories.put(interf, factory);
     }
 
@@ -241,14 +237,14 @@
          */
         private final String repository;
 
-        protected final Class interf;
+        protected final Class<?> interf;
 
         /**
          * The object delivered by this factory.
          */
         protected Object observedObject;
 
-        public ObservedObjectFactory(String repository, String path, Class interf) {
+        public ObservedObjectFactory(String repository, String path, Class<?> interf) {
             this.path = path;
             this.repository = repository;
             this.interf = interf;
Index: src/main/java/info/magnolia/content2bean/impl/Content2BeanTransformerImpl.java
===================================================================
--- src/main/java/info/magnolia/content2bean/impl/Content2BeanTransformerImpl.java	(revision 29858)
+++ src/main/java/info/magnolia/content2bean/impl/Content2BeanTransformerImpl.java	(working copy)
@@ -68,7 +68,7 @@
  * @version $Id$
  */
 public class Content2BeanTransformerImpl implements Content2BeanTransformer, Content.ContentFilter  {
-    
+
     private static final Logger log = LoggerFactory.getLogger(Content2BeanTransformerImpl.class);
 
     private final BeanUtilsBean beanUtilsBean;
@@ -103,7 +103,7 @@
                 if (StringUtils.isBlank(className)) {
                     throw new ClassNotFoundException("(no value for class property)");
                 }
-                Class clazz = ClassUtil.classForName(className);
+                Class<?> clazz = ClassUtil.classForName(className);
                 typeDscr = getTypeMapping().getTypeDescriptor(clazz);
             }
         }
@@ -147,7 +147,7 @@
                 // if no specific type has been provided by the
                 if(typeFoundByCustomTransformer != TypeMapping.MAP_TYPE){
                     // might be that the factory util defines a default implementation for interfaces
-                    Class implementation = FactoryUtil.getImplementation(typeFoundByCustomTransformer.getType());
+                    Class<?> implementation = FactoryUtil.getImplementation(typeFoundByCustomTransformer.getType());
                     typeDscr = getTypeMapping().getTypeDescriptor(implementation);
                 }
             }
@@ -175,7 +175,7 @@
         return resolvedType;
     }
 
-    public Collection getChildren(Content node) {
+    public Collection<Content> getChildren(Content node) {
         return node.getChildren(this);
     }
 
@@ -189,7 +189,7 @@
     /**
      * Do not set class property. In case of a map/collection try to use adder method.
      */
-    public void setProperty(TransformationState state, PropertyTypeDescriptor descriptor, Map values) {
+    public void setProperty(TransformationState state, PropertyTypeDescriptor descriptor, Map<String, Object> values) {
         TypeMapping mapping = getTypeMapping();
 
         String propertyName = descriptor.getName();
@@ -242,12 +242,12 @@
                                 log.debug("no clear method found on collection {}", propertyName);
                             }
 
-                            Class entryClass = dscr.getCollectionEntryType().getType();
+                            Class<?> entryClass = dscr.getCollectionEntryType().getType();
 
                             log.debug("will add values by using adder method {}", method.getName());
-                            for (Iterator iter = ((Map) value).keySet().iterator(); iter.hasNext();) {
+                            for (Iterator<Object> iter = ((Map<Object, Object>) value).keySet().iterator(); iter.hasNext();) {
                                 Object key = iter.next();
-                                Object entryValue = ((Map) value).get(key);
+                                Object entryValue = ((Map<Object, Object>) value).get(key);
                                 entryValue = convertPropertyValue(entryClass, entryValue);
                                 if (dscr.isCollection()) {
                                     log.debug("will add value {}", entryValue);
@@ -262,12 +262,10 @@
 
                             return;
                         }
-                        else{
-                            log.debug("no add method found for property {}", propertyName);
-                            if(dscr.isCollection()){
-                                log.debug("transform the valus to a collection", propertyName);
-                                value = ((Map)value).values();
-                            }
+                        log.debug("no add method found for property {}", propertyName);
+                        if(dscr.isCollection()){
+                            log.debug("transform the valus to a collection", propertyName);
+                            value = ((Map<Object, Object>)value).values();
                         }
                     }
                     else {
@@ -298,7 +296,7 @@
      * Most of the conversion is done by the BeanUtils.
      * TODO don't use bean utils converion since it can't be used for the adder methods
      */
-    public Object convertPropertyValue(Class propertyType, Object value) throws Content2BeanException {
+    public Object convertPropertyValue(Class<?> propertyType, Object value) throws Content2BeanException {
         if(propertyType == Locale.class){
             if(value instanceof String){
                 String localeStr = (String) value;
@@ -319,13 +317,13 @@
     }
 
     /**
-     * Use the factory util to instantiate. This is usefull to get default implementation of interfaces
+     * Use the factory util to instantiate. This is useful to get default implementation of interfaces
      */
     public Object newBeanInstance(TransformationState state, Map properties) throws Content2BeanException{
-        // we try first to use conversion (Map --> primitive tyoe)
+        // we try first to use conversion (Map --> primitive type)
         // this is the case when we flattening the hierarchy?
         Object bean = convertPropertyValue(state.getCurrentType().getType(), properties);
-        // were the propertis transformed?
+        // were the properties transformed?
         if(bean == properties){
             try{
                 bean = FactoryUtil.newInstance(state.getCurrentType().getType());
Index: src/main/java/info/magnolia/content2bean/Content2BeanTransformer.java
===================================================================
--- src/main/java/info/magnolia/content2bean/Content2BeanTransformer.java	(revision 28782)
+++ src/main/java/info/magnolia/content2bean/Content2BeanTransformer.java	(working copy)
@@ -57,9 +57,9 @@
     public TypeDescriptor resolveType(TransformationState state) throws ClassNotFoundException;
 
     /**
-     * Returns the children of the node to be transformed. This are normaly the direct children but might differ
+     * Returns the children of the node to be transformed. Those are normally the direct children but might differ
      */
-    public Collection getChildren(Content node);
+    public Collection<Content> getChildren(Content node);
 
     /**
      * Instantiates the bean
@@ -74,12 +74,12 @@
     /**
      * Set this property on that bean. Allows excluding of properties
      */
-    public void setProperty(TransformationState state, PropertyTypeDescriptor descriptor, Map values);
+    public void setProperty(TransformationState state, PropertyTypeDescriptor descriptor, Map<String, Object> values);
 
     /**
-     * Transforms the simple basic jcr property value objects to complexer properties
+     * Transforms the simple basic jcr property value objects to more complex properties
      */
-    public Object convertPropertyValue(Class propertyType, Object value) throws Content2BeanException;
+    public Object convertPropertyValue(Class<?> propertyType, Object value) throws Content2BeanException;
 
     /**
      * The mapping to use
Index: src/main/java/info/magnolia/cms/util/ClasspathResourcesUtil.java
===================================================================
--- src/main/java/info/magnolia/cms/util/ClasspathResourcesUtil.java	(revision 29339)
+++ src/main/java/info/magnolia/cms/util/ClasspathResourcesUtil.java	(working copy)
@@ -46,7 +46,6 @@
 import java.net.URLDecoder;
 import java.util.Collection;
 import java.util.Enumeration;
-import java.util.Iterator;
 import java.util.HashSet;
 import java.util.Set;
 import java.util.jar.JarEntry;
@@ -110,7 +109,7 @@
      * @return string array of found resources TODO : (lazy) cache ?
      */
     public static String[] findResources(Filter filter) {
-        final Set resources = new HashSet();
+        final Set<String> resources = new HashSet<String>();
         final ClassLoader cl = getCurrentClassLoader();
 
         // if the classloader is an URLClassloader we have a better method for discovering resources
@@ -123,7 +122,7 @@
                 log.warn("Looks like we're in a JBoss 5 expanded war directory, will attempt to load resources from the file system instead; see MAGNOLIA-2577.");
             } else {
                 collectFromURLs(resources, urls, filter);
-                return (String[]) resources.toArray(new String[resources.size()]);
+                return resources.toArray(new String[resources.size()]);
             }
         }
 
@@ -137,7 +136,7 @@
 
             if (StringUtils.isNotEmpty(classpath)) {
                 collectFromClasspathString(resources, classpath, filter);
-                return (String[]) resources.toArray(new String[resources.size()]);
+                return resources.toArray(new String[resources.size()]);
             }
         }
         catch (Throwable e) {
@@ -147,10 +146,10 @@
         // no way, we have to assume a standard war structure and look in the WEB-INF/lib and WEB-INF/classes dirs
         // read the jars in the lib dir
         collectFromFileSystem(filter, resources);
-        return (String[]) resources.toArray(new String[resources.size()]);
+        return resources.toArray(new String[resources.size()]);
     }
 
-    protected static void collectFromURLs(Collection resources, URL[] urls, Filter filter) {
+    protected static void collectFromURLs(Collection<String> resources, URL[] urls, Filter filter) {
         // tomcat classloader is org.apache.catalina.loader.WebappClassLoader
         for (int j = 0; j < urls.length; j++) {
             final File tofile = sanitizeToFile(urls[j]);
@@ -158,7 +157,7 @@
         }
     }
 
-    protected static void collectFromClasspathString(Collection resources, String classpath, Filter filter) {
+    protected static void collectFromClasspathString(Collection<String> resources, String classpath, Filter filter) {
         String[] paths = classpath.split(File.pathSeparator);
         for (int j = 0; j < paths.length; j++) {
             final File tofile = new File(paths[j]);
@@ -169,7 +168,7 @@
         }
     }
 
-    protected static void collectFromFileSystem(Filter filter, Collection resources) {
+    protected static void collectFromFileSystem(Filter filter, Collection<String> resources) {
         File dir = new File(Path.getAbsoluteFileSystemPath("WEB-INF/lib")); //$NON-NLS-1$
         if (dir.exists()) {
             File[] files = dir.listFiles(new FilenameFilter() {
@@ -212,7 +211,7 @@
      * @param jarOrDir a File, can be a jar or a directory
      * @param filter used to filter resources
      */
-    private static void collectFiles(Collection resources, File jarOrDir, Filter filter) {
+    private static void collectFiles(Collection<String> resources, File jarOrDir, Filter filter) {
 
         if (!jarOrDir.exists()) {
             log.warn("missing file: {}", jarOrDir.getAbsolutePath());
@@ -222,9 +221,8 @@
         if (jarOrDir.isDirectory()) {
             log.debug("looking in dir {}", jarOrDir.getAbsolutePath());
 
-            Collection files = FileUtils.listFiles(jarOrDir, TrueFileFilter.TRUE, TrueFileFilter.TRUE);
-            for (Iterator iter = files.iterator(); iter.hasNext();) {
-                File file = (File) iter.next();
+            Collection<File> files = FileUtils.listFiles(jarOrDir, TrueFileFilter.TRUE, TrueFileFilter.TRUE);
+            for (File file : files) {
                 String name = StringUtils.substringAfter(file.getPath(), jarOrDir.getPath());
 
                 // please, be kind to Windows!!!
@@ -248,8 +246,8 @@
                 log.error("IOException opening file {}, skipping", jarOrDir.getAbsolutePath());
                 return;
             }
-            for (Enumeration em = jar.entries(); em.hasMoreElements();) {
-                JarEntry entry = (JarEntry) em.nextElement();
+            for (Enumeration<JarEntry> em = jar.entries(); em.hasMoreElements();) {
+                JarEntry entry = em.nextElement();
                 if (!entry.isDirectory()) {
                     if (filter.accept("/" + entry.getName())) {
                         resources.add("/" + entry.getName());
@@ -304,7 +302,7 @@
     }
 
     /**
-     * Get the resource using the current class laoder. The leading / is removed as the call to class.getResource()
+     * Get the resource using the current class loader. The leading / is removed as the call to class.getResource()
      * would do.
      * @param name
      * @return the resource
Index: src/main/java/info/magnolia/cms/util/ConfigUtil.java
===================================================================
--- src/main/java/info/magnolia/cms/util/ConfigUtil.java	(revision 29339)
+++ src/main/java/info/magnolia/cms/util/ConfigUtil.java	(working copy)
@@ -79,30 +79,26 @@
      */
     public static final class MapDTDEntityResolver implements EntityResolver {
 
-        private final Map dtds;
+        private final Map<String, String> dtds;
 
-        public MapDTDEntityResolver(Map dtds) {
+        public MapDTDEntityResolver(Map<String, String> dtds) {
             this.dtds = dtds;
         }
 
         public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
             String key = StringUtils.substringAfterLast(systemId, "/");
             if (dtds.containsKey(key)) {
-                Class clazz = getClass();
-                InputStream in = clazz.getResourceAsStream((String)dtds.get(key));
+                Class<? extends MapDTDEntityResolver> clazz = getClass();
+                InputStream in = clazz.getResourceAsStream(dtds.get(key));
                 if (in == null) {
                     log.error("Could not find [" + systemId + "]. Used ["
                         + clazz.getClassLoader()
                         + "] class loader in the search.");
                     return null;
                 }
-                else {
-                    return new InputSource(in);
-                }
+                return new InputSource(in);
             }
-            else {
-                return null;
-            }
+            return null;
         }
     }
 
@@ -182,7 +178,7 @@
      * @throws IOException
      */
     public static String replaceTokens(String config) throws IOException {
-        for (Iterator iter = SystemProperty.getProperties().keySet().iterator(); iter.hasNext();) {
+        for (Iterator<Object> iter = SystemProperty.getProperties().keySet().iterator(); iter.hasNext();) {
             String key = (String) iter.next();
             config = StringUtils.replace(config, "${" + key + "}", SystemProperty.getProperty(key, ""));
         }
@@ -223,7 +219,7 @@
      * @throws SAXException
      * @throws IOException
      */
-    public static Document string2DOM(String xml, final Map dtds) throws ParserConfigurationException, SAXException, IOException {
+    public static Document string2DOM(String xml, final Map<String, String> dtds) throws ParserConfigurationException, SAXException, IOException {
         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
         dbf.setValidating(true);
         DocumentBuilder builder;
Index: src/main/java/info/magnolia/cms/util/NodeDataUtil.java
===================================================================
--- src/main/java/info/magnolia/cms/util/NodeDataUtil.java	(revision 29339)
+++ src/main/java/info/magnolia/cms/util/NodeDataUtil.java	(working copy)
@@ -49,6 +49,7 @@
 import java.util.Calendar;
 import java.util.Date;
 import java.util.GregorianCalendar;
+import java.util.List;
 import java.util.TimeZone;
 
 import javax.jcr.PathNotFoundException;
@@ -568,8 +569,8 @@
         return PropertyType.UNDEFINED;
     }
 
-    public static ArrayList getValuesStringList(Value[] values) {
-        ArrayList list = new ArrayList();
+    public static List<String> getValuesStringList(Value[] values) {
+        ArrayList<String> list = new ArrayList<String>();
         try{
             Value value;
             for( int i = 0; i < values.length; i++) {
@@ -592,7 +593,7 @@
                         list.add(DateUtil.format(valueDate, NodeDataUtil.getDateFormat()));
                         break;
                     case (PropertyType.BINARY):
-                        // ???
+                        // for lack of better solution, fall through to the default - empty string
                     default:
                         list.add(StringUtils.EMPTY);
                 }
Index: src/main/java/info/magnolia/content2bean/impl/CollectionPropertyHidingTransformer.java
===================================================================
--- src/main/java/info/magnolia/content2bean/impl/CollectionPropertyHidingTransformer.java	(revision 28782)
+++ src/main/java/info/magnolia/content2bean/impl/CollectionPropertyHidingTransformer.java	(working copy)
@@ -40,7 +40,6 @@
 import org.slf4j.LoggerFactory;
 
 import java.lang.reflect.Method;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Map.Entry;
 
@@ -64,7 +63,7 @@
 
     protected TypeDescriptor propertyType;
 
-    public CollectionPropertyHidingTransformer(Class beanClass, String collectionName) {
+    public CollectionPropertyHidingTransformer(Class<?> beanClass, String collectionName) {
         this.collectionName = collectionName;
         type =  getTypeMapping().getTypeDescriptor(beanClass);
         propertyDescriptor = type.getPropertyTypeDescriptor(collectionName);
@@ -81,20 +80,19 @@
             // this is the case when we are transforming children nodes)
             if(state.getLevel()>1 && state.getCurrentType().equals(type)){
                 // make it the default
-                // use prop descr
+                // use property descriptor
                 resolvedType = propertyType;
             }
         }
         return resolvedType;
     }
 
-    public void setProperty(TransformationState state, PropertyTypeDescriptor descriptor, Map values) {
+    public void setProperty(TransformationState state, PropertyTypeDescriptor descriptor, Map<String, Object> values) {
         if(descriptor.getName().equals(collectionName)){
             Object bean = state.getCurrentBean();
 
-            for (Iterator iterator = values.entrySet().iterator(); iterator.hasNext();) {
-                Entry entry = (Entry) iterator.next();
-                String key = (String) entry.getKey();
+            for (Entry<String, Object> entry : values.entrySet()) {
+                String key = entry.getKey();
                 Object value = entry.getValue();
 
                 if(propertyType.getType().isInstance(value) ){
Index: src/main/java/info/magnolia/content2bean/impl/PropertiesBasedTypeMapping.java
===================================================================
--- src/main/java/info/magnolia/content2bean/impl/PropertiesBasedTypeMapping.java	(revision 28782)
+++ src/main/java/info/magnolia/content2bean/impl/PropertiesBasedTypeMapping.java	(working copy)
@@ -56,13 +56,13 @@
 
     public PropertiesBasedTypeMapping() {
         Properties properties = SystemProperty.getProperties();
-        for (Iterator iterator = properties.keySet().iterator(); iterator.hasNext();) {
+        for (Iterator<Object> iterator = properties.keySet().iterator(); iterator.hasNext();) {
             String key = (String) iterator.next();
             if(key.endsWith(".transformer")){
                 String className = StringUtils.removeEnd(key, ".transformer");
                 String transformerClassName = properties.getProperty(key);
                 try {
-                    Class beanClass = ClassUtil.classForName(className);
+                    Class<?> beanClass = ClassUtil.classForName(className);
                     Content2BeanTransformer transformer = (Content2BeanTransformer) ClassUtil.newInstance(transformerClassName);
                     getTypeDescriptor(beanClass).setTransformer(transformer);
                     log.debug("Registered custom transformer [{}] for [{}]", className, transformerClassName);
Index: src/main/java/info/magnolia/content2bean/impl/TransformationStateImpl.java
===================================================================
--- src/main/java/info/magnolia/content2bean/impl/TransformationStateImpl.java	(revision 28782)
+++ src/main/java/info/magnolia/content2bean/impl/TransformationStateImpl.java	(working copy)
@@ -38,17 +38,10 @@
 import info.magnolia.content2bean.TypeDescriptor;
 
 import org.apache.commons.collections.ArrayStack;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 public class TransformationStateImpl implements TransformationState {
 
-    /**
-     * Logger.
-     */
-    private static Logger log = LoggerFactory.getLogger(TransformationStateImpl.class);
-
     protected ArrayStack typeStack = new ArrayStack();
 
     protected ArrayStack beanStack = new ArrayStack();
Index: src/main/java/info/magnolia/content2bean/impl/Content2BeanProcessorImpl.java
===================================================================
--- src/main/java/info/magnolia/content2bean/impl/Content2BeanProcessorImpl.java	(revision 29858)
+++ src/main/java/info/magnolia/content2bean/impl/Content2BeanProcessorImpl.java	(working copy)
@@ -44,7 +44,6 @@
 import info.magnolia.content2bean.TypeDescriptor;
 
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
@@ -92,7 +91,7 @@
 
             transformer = resolveTransformer(type, transformer);
 
-            Map values = toMap(node, recursive, transformer, state);
+            Map<String, Object> values = toMap(node, recursive, transformer, state);
 
             try {
                 bean = transformer.newBeanInstance(state, values);
@@ -105,7 +104,7 @@
                     throw new Content2BeanException("Can't instantiate bean for " +  node.getHandle(), e);
                 }
             }
-            
+
             if(bean != null){
                 state.pushBean(bean);
 
@@ -142,7 +141,7 @@
 
         transformer = resolveTransformer(type, transformer);
 
-        Map values = toMap(node, recursive, transformer, state);
+        Map<String, Object> values = toMap(node, recursive, transformer, state);
 
         setProperties(values, transformer, state);
 
@@ -158,10 +157,9 @@
     /**
      * toBean() is used to build children
      */
-    protected Map toMap(Content node, boolean recursive, Content2BeanTransformer transformer, TransformationState state) throws Content2BeanException {
-        Map map = new LinkedHashMap();
-        for (Iterator iter = node.getNodeDataCollection().iterator(); iter.hasNext();) {
-            NodeData nd = (NodeData) iter.next();
+    protected Map<String, Object> toMap(Content node, boolean recursive, Content2BeanTransformer transformer, TransformationState state) throws Content2BeanException {
+        Map<String, Object> map = new LinkedHashMap<String, Object>();
+        for (NodeData nd : node.getNodeDataCollection()) {
             Object val = NodeDataUtil.getValueObject(nd);
             if (val != null) {
                 map.put(nd.getName(), val);
@@ -169,9 +167,8 @@
         }
 
         if(recursive){
-            Collection children = transformer.getChildren(node);
-            for (Iterator iter = children.iterator(); iter.hasNext();) {
-                final Content childNode = (Content) iter.next();
+            final Collection<Content> children = transformer.getChildren(node);
+            for (Content childNode : children) {
                 // in case the the class can not get resolved we can use now
                 // the parent bean to resolve the class
 
@@ -200,24 +197,23 @@
      * @todo in case the bean is a map / collection the transfomer.setProperty() method should be called too
      * @todo if the bean has not a certain property but a value is present, transformer.setProperty() should be called with a fake property descriptor
      */
-    protected void setProperties(Map values, final Content2BeanTransformer transformer, TransformationState state) throws Content2BeanException {
+    protected void setProperties(Map<String, Object> values, final Content2BeanTransformer transformer, TransformationState state) throws Content2BeanException {
         Object bean = state.getCurrentBean();
         log.debug("will populate bean {} with the values {}", bean.getClass().getName(), values);
 
         if(bean instanceof Map){
-            ((Map)bean).putAll(values);
+            ((Map<String, Object>)bean).putAll(values);
         }
 
         if(bean instanceof Collection){
-            ((Collection)bean).addAll(values.values());
+            ((Collection<Object>)bean).addAll(values.values());
         }
 
         else{
             TypeDescriptor beanTypeDescriptor = transformer.getTypeMapping().getTypeDescriptor(bean.getClass());
-            Collection dscrs = beanTypeDescriptor.getPropertyDescriptors().values();
+            final Collection<PropertyTypeDescriptor> dscrs = beanTypeDescriptor.getPropertyDescriptors().values();
 
-            for (Iterator iter = dscrs.iterator(); iter.hasNext();) {
-                PropertyTypeDescriptor descriptor = (PropertyTypeDescriptor) iter.next();
+            for (PropertyTypeDescriptor descriptor : dscrs) {
                 transformer.setProperty(state, descriptor, values);
             }
         }
Index: src/main/java/info/magnolia/content2bean/impl/TypeMappingImpl.java
===================================================================
--- src/main/java/info/magnolia/content2bean/impl/TypeMappingImpl.java	(revision 28782)
+++ src/main/java/info/magnolia/content2bean/impl/TypeMappingImpl.java	(working copy)
@@ -66,17 +66,17 @@
     /**
      * Property types already resolved
      */
-    protected static Map propertyTypes = new HashMap();
+    protected static Map<String, PropertyTypeDescriptor> propertyTypes = new HashMap<String, PropertyTypeDescriptor>();
 
     /**
      * Descriptors for types
      **/
-    protected static Map types = new HashMap();
+    protected static Map<Class<?>, TypeDescriptor> types = new HashMap<Class<?>, TypeDescriptor>();
 
     /**
      * Get a adder method. Transforms name to singular
      */
-    public Method getAddMethod(Class type, String name, int numberOfParameters) {
+    public Method getAddMethod(Class<?> type, String name, int numberOfParameters) {
         name = StringUtils.capitalize(name);
         Method method = getExactMethod(type, "add" + name, numberOfParameters);
         if (method == null) {
@@ -101,11 +101,11 @@
      * Cache the already resolved types
      *
      */
-    public PropertyTypeDescriptor getPropertyTypeDescriptor(Class beanClass, String propName) {
+    public PropertyTypeDescriptor getPropertyTypeDescriptor(Class<?> beanClass, String propName) {
         PropertyTypeDescriptor dscr;
         String key = beanClass.getName() + "." + propName;
 
-        dscr = (PropertyTypeDescriptor) propertyTypes.get(key);
+        dscr = propertyTypes.get(key);
         if(dscr != null){
             return dscr;
         }
@@ -125,7 +125,7 @@
         for (int i = 0; i < descriptors.length; i++) {
             PropertyDescriptor descriptor = descriptors[i];
             if (descriptor.getName().equals(propName)) {
-                Class propertytype = descriptor.getPropertyType(); // may be null for indexed properties
+                Class<?> propertytype = descriptor.getPropertyType(); // may be null for indexed properties
                 if (propertytype != null) {
                     dscr.setType(getTypeDescriptor(propertytype));
                 }
@@ -156,16 +156,16 @@
         return dscr;
     }
 
-    public void addPropertyTypeDescriptor(Class beanClass, String propName, PropertyTypeDescriptor dscr) {
+    public void addPropertyTypeDescriptor(Class<?> beanClass, String propName, PropertyTypeDescriptor dscr) {
         propertyTypes.put(beanClass.getName() + "." + propName, dscr);
     }
 
-    public void addTypeDescriptor(Class beanClass, TypeDescriptor dscr) {
+    public void addTypeDescriptor(Class<?> beanClass, TypeDescriptor dscr) {
         types.put(beanClass, dscr);
     }
 
-    public TypeDescriptor getTypeDescriptor(Class beanClass) {
-        TypeDescriptor dscr = (TypeDescriptor) types.get(beanClass);
+    public TypeDescriptor getTypeDescriptor(Class<?> beanClass) {
+        TypeDescriptor dscr = types.get(beanClass);
         if(dscr != null){
             return dscr;
         }
@@ -175,7 +175,7 @@
         dscr.setCollection(beanClass.isArray() || ClassUtil.isSubClass(beanClass, Collection.class));
         types.put(beanClass, dscr);
         try {
-            Class transformerClass = ClassUtil.classForName(beanClass.getName() + "Transformer");
+            Class<?> transformerClass = ClassUtil.classForName(beanClass.getName() + "Transformer");
 
             if(ClassUtil.isSubClass(transformerClass, Content2BeanTransformer.class)){
                 try {
@@ -198,7 +198,7 @@
      * Find a method
      * @param numberOfParameters
      */
-    protected Method getExactMethod(Class type, String name, int numberOfParameters) {
+    protected Method getExactMethod(Class<?> type, String name, int numberOfParameters) {
         Method[] methods = type.getMethods();
         for (int i = 0; i < methods.length; i++) {
             Method method = methods[i];
Index: src/main/java/info/magnolia/cms/util/ClassUtil.java
===================================================================
--- src/main/java/info/magnolia/cms/util/ClassUtil.java	(revision 29339)
+++ src/main/java/info/magnolia/cms/util/ClassUtil.java	(working copy)
@@ -38,8 +38,6 @@
 
 import org.apache.commons.collections.map.LRUMap;
 import org.apache.commons.lang.ClassUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 /**
@@ -49,12 +47,7 @@
  */
 public final class ClassUtil {
 
-    /**
-     * Logger.
-     */
-    private static Logger log = LoggerFactory.getLogger(ClassUtil.class);
-
-    private static Map subClassCache = Collections.synchronizedMap(new LRUMap(200));
+    private static Map<String, Boolean> subClassCache = Collections.synchronizedMap(new LRUMap(200));
 
     /**
      * Don't instantiate.
@@ -69,13 +62,16 @@
      * @return loaded class
      * @throws ClassNotFoundException if the given class can't be loaded by both classloaders.
      */
-    public static Class classForName(String className) throws ClassNotFoundException {
-        Class loadedClass;
+    @SuppressWarnings("unchecked")
+    public static <T> Class<? extends T> classForName(String className) throws ClassNotFoundException {
+        Class<? extends T> loadedClass;
         try {
-            loadedClass = Class.forName(className);
+            // dirty little details ... forName() always returns only Class<?> so we need to do the unchecked cast here
+            loadedClass = (Class<? extends T>) Class.forName(className);
         }
         catch (ClassNotFoundException e) {
-            loadedClass = Class.forName(className, true, Thread.currentThread().getContextClassLoader());
+            // and same again ... forName() always returns only Class<?> so we need to do the unchecked cast here
+            loadedClass = (Class<? extends T>) Class.forName(className, true, Thread.currentThread().getContextClassLoader());
         }
         return loadedClass;
     }
@@ -96,7 +92,7 @@
     /**
      * Checks if this class is a subclass
      */
-    public static boolean isSubClass(Class subClass, Class parentClass) {
+    public static boolean isSubClass(Class<?> subClass, Class<?> parentClass) {
         // TODO replace this with class.asSubclass as soon we compile with 1.5
         if(subClass.equals(parentClass)){
             return true;
@@ -104,7 +100,7 @@
         String key = subClass.getName() + "-" +parentClass.getName();
 
         // lru map
-        Boolean isSubClass = (Boolean) subClassCache.get(key);
+        Boolean isSubClass = subClassCache.get(key);
         if(isSubClass != null){
             return isSubClass.booleanValue();
         }
Index: src/main/java/info/magnolia/content2bean/impl/DescriptorFileBasedTypeMapping.java
===================================================================
--- src/main/java/info/magnolia/content2bean/impl/DescriptorFileBasedTypeMapping.java	(revision 28782)
+++ src/main/java/info/magnolia/content2bean/impl/DescriptorFileBasedTypeMapping.java	(working copy)
@@ -88,7 +88,7 @@
         className = StringUtils.removeStart(className, ".");
         className = StringUtils.removeEnd(className, ".content2bean");
         try {
-            Class typeClass = ClassUtil.classForName(className);
+            Class<?> typeClass = ClassUtil.classForName(className);
 
             TypeDescriptor typeDescriptor = processProperties(typeClass, props);
             addTypeDescriptor(typeClass, typeDescriptor);
@@ -97,10 +97,10 @@
         }
     }
 
-    protected TypeDescriptor processProperties(Class className, Properties props) throws Exception {
+    protected TypeDescriptor processProperties(Class<?> className, Properties props) throws Exception {
             String descriptorClassName = StringUtils.defaultIfEmpty(props.getProperty("descriptorClass"), PropertiesBasedTypeDescriptor.class.getName());
-            Class descriptorClass = ClassUtil.classForName(descriptorClassName);
-            Constructor constructor = descriptorClass.getConstructor(new Class[] {Properties.class});
-            return (TypeDescriptor) constructor.newInstance(new Object[]{props});
+            Class<? extends TypeDescriptor> descriptorClass = ClassUtil.classForName(descriptorClassName);
+            Constructor<? extends TypeDescriptor> constructor = descriptorClass.getConstructor(new Class[] {Properties.class});
+            return constructor.newInstance(new Object[]{props});
     }
 }
Index: src/main/java/info/magnolia/content2bean/TypeMapping.java
===================================================================
--- src/main/java/info/magnolia/content2bean/TypeMapping.java	(revision 28782)
+++ src/main/java/info/magnolia/content2bean/TypeMapping.java	(working copy)
@@ -49,13 +49,13 @@
 
     public static TypeDescriptor MAP_TYPE = Factory.getDefaultMapping().getTypeDescriptor(LinkedHashMap.class);
 
-    public PropertyTypeDescriptor getPropertyTypeDescriptor(Class beanClass, String propName);
+    public PropertyTypeDescriptor getPropertyTypeDescriptor(Class<?> beanClass, String propName);
 
-    public TypeDescriptor getTypeDescriptor(Class beanClass);
+    public TypeDescriptor getTypeDescriptor(Class<?> beanClass);
 
-    public void addPropertyTypeDescriptor(Class beanClass, String propName, PropertyTypeDescriptor dscr);
+    public void addPropertyTypeDescriptor(Class<?> beanClass, String propName, PropertyTypeDescriptor dscr);
 
-    public void addTypeDescriptor(Class beanClass, TypeDescriptor dscr);
+    public void addTypeDescriptor(Class<?> beanClass, TypeDescriptor dscr);
 
     /**
      * Get the default transformer.
Index: src/main/java/info/magnolia/context/AbstractContext.java
===================================================================
--- src/main/java/info/magnolia/context/AbstractContext.java	(revision 29118)
+++ src/main/java/info/magnolia/context/AbstractContext.java	(working copy)
@@ -151,7 +151,7 @@
      * @see Context#getLocale()
      */
     public Locale getLocale() {
-        if (locale == null) {            
+        if (locale == null) {
             locale = MgnlContext.getSystemContext().getLocale();
         }
         return locale;
@@ -199,17 +199,15 @@
      */
     public Object put(Object key, Object value) {
         this.setAttribute(key.toString(), value, Context.LOCAL_SCOPE);
-        return value;       
+        return value;
     }
 
     /**
      * Map implementation
      */
     public void clear() {
-        for (Iterator iter = this.getAttributes().keySet().iterator(); iter.hasNext();) {
-            String key = (String) iter.next();
+        for (String key : this.getAttributes().keySet()) {
             this.removeAttribute(key, Context.LOCAL_SCOPE);
-
         }
         throw new UnsupportedOperationException("you can not clear a magnolia context");
     }
Index: src/main/java/info/magnolia/cms/util/ContentUtil.java
===================================================================
--- src/main/java/info/magnolia/cms/util/ContentUtil.java	(revision 29339)
+++ src/main/java/info/magnolia/cms/util/ContentUtil.java	(working copy)
@@ -208,8 +208,7 @@
             return null;
         }
         name = name.toLowerCase();
-        for (Iterator iter = node.getChildren(ALL_NODES_CONTENT_FILTER).iterator(); iter.hasNext();) {
-            Content child = (Content) iter.next();
+        for (Content child : node.getChildren(ALL_NODES_CONTENT_FILTER)) {
             if (child.getName().toLowerCase().equals(name)) {
                 return child;
             }
@@ -220,8 +219,8 @@
     /**
      * Get all children recursively (content and contentnode)
      */
-    public static List collectAllChildren(Content node) {
-        List nodes = new ArrayList();
+    public static List<Content> collectAllChildren(Content node) {
+        List<Content> nodes = new ArrayList<Content>();
         return collectAllChildren(nodes, node, new ItemType[]{ItemType.CONTENT, ItemType.CONTENTNODE});
     }
 
@@ -231,8 +230,8 @@
      * @param filter
      * @return list of all found nodes
      */
-    public static List collectAllChildren(Content node, ContentFilter filter) {
-        List nodes = new ArrayList();
+    public static List<Content> collectAllChildren(Content node, ContentFilter filter) {
+        List<Content> nodes = new ArrayList<Content>();
         return collectAllChildren(nodes, node, filter);
     }
 
@@ -243,20 +242,18 @@
      * @param filter the filter to use
      * @return
      */
-    private static List collectAllChildren(List nodes, Content node, ContentFilter filter) {
+    private static List<Content> collectAllChildren(List<Content> nodes, Content node, ContentFilter filter) {
         // get filtered sub nodes first
-        Collection children = node.getChildren(filter);
-        for (Iterator iter = children.iterator(); iter.hasNext();) {
-            Content child = (Content) iter.next();
+        Collection<Content> children = node.getChildren(filter);
+        for (Content child : children) {
             nodes.add(child);
         }
 
         // get all children to find recursively
-        Collection allChildren = node.getChildren(EXCLUDE_META_DATA_CONTENT_FILTER);
+        Collection<Content> allChildren = node.getChildren(EXCLUDE_META_DATA_CONTENT_FILTER);
 
         // recursion
-        for (Iterator iter = allChildren.iterator(); iter.hasNext();) {
-            Content child = (Content) iter.next();
+        for (Content child : allChildren) {
             collectAllChildren(nodes, child, filter);
         }
 
@@ -269,22 +266,22 @@
      * @param type
      * @return
      */
-    public static List collectAllChildren(Content node, ItemType type) {
-        List nodes = new ArrayList();
+    public static List<Content> collectAllChildren(Content node, ItemType type) {
+        List<Content> nodes = new ArrayList<Content>();
         return collectAllChildren(nodes, node, new ItemType[]{type});
     }
 
     /**
      * Returns all children (not recursively) independent of there type
      */
-    public static Collection getAllChildren(Content node){
+    public static Collection<Content> getAllChildren(Content node){
         return node.getChildren(EXCLUDE_META_DATA_CONTENT_FILTER);
     }
 
     /**
      * Returns all children (not recursively) independent of there type
      */
-    public static Collection getAllChildren(Content node, Comparator comp){
+    public static Collection<Content> getAllChildren(Content node, Comparator<Content> comp){
         return node.getChildren(EXCLUDE_META_DATA_CONTENT_FILTER, comp);
     }
 
@@ -294,8 +291,8 @@
      * @param types
      * @return
      */
-    public static List collectAllChildren(Content node, ItemType[] types) {
-        List nodes = new ArrayList();
+    public static List<Content> collectAllChildren(Content node, ItemType[] types) {
+        List<Content> nodes = new ArrayList<Content>();
         return collectAllChildren(nodes, node, types);
     }
 
@@ -306,13 +303,12 @@
      * @param types
      * @return the list
      */
-    private static List collectAllChildren(List nodes, Content node, ItemType[] types) {
+    private static List<Content> collectAllChildren(List<Content> nodes, Content node, ItemType[] types) {
         for (int i = 0; i < types.length; i++) {
             ItemType type = types[i];
 
-            Collection children = node.getChildren(type);
-            for (Iterator iter = children.iterator(); iter.hasNext();) {
-                Content child = (Content) iter.next();
+            Collection<Content> children = node.getChildren(type);
+            for (Content child : children) {
                 nodes.add(child);
                 collectAllChildren(nodes, child, types);
             }
@@ -330,13 +326,12 @@
      * Uses the passed comparator to create the jcr ordering of the children
      * @throws RepositoryException
      */
-    public static void orderNodes(Content node, Comparator comparator) throws RepositoryException {
-        Collection children = ContentUtil.getAllChildren(node, comparator);
+    public static void orderNodes(Content node, Comparator<Content> comparator) throws RepositoryException {
+        Collection<Content> children = ContentUtil.getAllChildren(node, comparator);
         String[] names = new String[children.size()];
 
         int i = 0;
-        for (Iterator iter = children.iterator(); iter.hasNext();) {
-            Content childNode = (Content) iter.next();
+        for (Content childNode : children) {
             names[i] = childNode.getName();
             i++;
         }
@@ -349,8 +344,8 @@
 
     public static void visit(Content node, Visitor visitor, ContentFilter filter) throws Exception{
         visitor.visit(node);
-        for (Iterator iter = node.getChildren(filter).iterator(); iter.hasNext();) {
-            visit((Content) iter.next(), visitor, filter);
+        for (Content content : node.getChildren(filter)) {
+            visit(content, visitor, filter);
         }
         if(visitor instanceof PostVisitor){
             ((PostVisitor)visitor).postVisit(node);
@@ -504,11 +499,11 @@
     public static void rename(Content node, String newName) throws RepositoryException{
         Content parent = node.getParent();
         String placedBefore = null;
-        for (Iterator iter = parent.getChildren(node.getNodeTypeName()).iterator(); iter.hasNext();) {
-            Content child = (Content) iter.next();
+        for (Iterator<Content> iter = parent.getChildren(node.getNodeTypeName()).iterator(); iter.hasNext();) {
+            Content child = iter.next();
             if (child.getUUID().equals(node.getUUID())) {
                 if (iter.hasNext()) {
-                    child = (Content) iter.next();
+                    child = iter.next();
                     placedBefore = child.getName();
                 }
             }
