Update year in copyright lines
[Sone.git] / src / main / java / net / pterodactylus / sone / template / CollectionAccessor.java
index 10e3ea3..8ce97ad 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sone - CollectionAccessor.java - Copyright © 2010 David Roden
+ * Sone - CollectionAccessor.java - Copyright © 2010–2019 David Roden
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -24,8 +24,8 @@ import java.util.List;
 
 import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.util.template.Accessor;
-import net.pterodactylus.util.template.DataProvider;
 import net.pterodactylus.util.template.ReflectionAccessor;
+import net.pterodactylus.util.template.TemplateContext;
 
 /**
  * {@link Accessor} for {@link Collection}s that adds a couple of specialized
@@ -35,8 +35,6 @@ import net.pterodactylus.util.template.ReflectionAccessor;
  * <dt>Returns the nice names of all {@link Sone}s in the collection, sorted
  * ascending by their nice names.</dt>
  * </dl>
- *
- * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
  */
 public class CollectionAccessor extends ReflectionAccessor {
 
@@ -44,13 +42,10 @@ public class CollectionAccessor extends ReflectionAccessor {
         * {@inheritDoc}
         */
        @Override
-       public Object get(DataProvider dataProvider, Object object, String member) {
-               if (object == null) {
-                       return null;
-               }
+       public Object get(TemplateContext templateContext, Object object, String member) {
                Collection<?> collection = (Collection<?>) object;
                if (member.equals("soneNames")) {
-                       List<Sone> sones = new ArrayList<Sone>();
+                       List<Sone> sones = new ArrayList<>();
                        for (Object sone : collection) {
                                if (!(sone instanceof Sone)) {
                                        continue;
@@ -67,7 +62,7 @@ public class CollectionAccessor extends ReflectionAccessor {
                        }
                        return soneNames.toString();
                }
-               return super.get(dataProvider, object, member);
+               return super.get(templateContext, object, member);
        }
 
 }