Merge pull request #15 from skaba/master

Java5 compatibility
This commit is contained in:
Michael Bayne
2012-04-13 09:24:43 -07:00
2 changed files with 4 additions and 6 deletions
@@ -11,7 +11,6 @@ import java.util.Map;
*/ */
public class BasicCollector implements Mustache.Collector public class BasicCollector implements Mustache.Collector
{ {
@Override
public Iterator<?> toIterator (final Object value) { public Iterator<?> toIterator (final Object value) {
if (value instanceof Iterable<?>) { if (value instanceof Iterable<?>) {
return ((Iterable<?>)value).iterator(); return ((Iterable<?>)value).iterator();
@@ -22,7 +21,6 @@ public class BasicCollector implements Mustache.Collector
return null; return null;
} }
@Override
public Mustache.VariableFetcher createFetcher (Object ctx, String name) public Mustache.VariableFetcher createFetcher (Object ctx, String name)
{ {
// support both .name and this.name to fetch members // support both .name and this.name to fetch members
@@ -38,13 +36,13 @@ public class BasicCollector implements Mustache.Collector
} }
protected static final Mustache.VariableFetcher MAP_FETCHER = new Mustache.VariableFetcher() { protected static final Mustache.VariableFetcher MAP_FETCHER = new Mustache.VariableFetcher() {
@Override public Object get (Object ctx, String name) throws Exception { public Object get (Object ctx, String name) throws Exception {
return ((Map<?,?>)ctx).get(name); return ((Map<?,?>)ctx).get(name);
} }
}; };
protected static final Mustache.VariableFetcher THIS_FETCHER = new Mustache.VariableFetcher() { protected static final Mustache.VariableFetcher THIS_FETCHER = new Mustache.VariableFetcher() {
@Override public Object get (Object ctx, String name) throws Exception { public Object get (Object ctx, String name) throws Exception {
return ctx; return ctx;
} }
}; };
@@ -43,7 +43,7 @@ public class DefaultCollector extends BasicCollector
final Method m = getMethod(cclass, name); final Method m = getMethod(cclass, name);
if (m != null) { if (m != null) {
return new Mustache.VariableFetcher() { return new Mustache.VariableFetcher() {
@Override public Object get (Object ctx, String name) throws Exception { public Object get (Object ctx, String name) throws Exception {
return m.invoke(ctx); return m.invoke(ctx);
} }
}; };
@@ -52,7 +52,7 @@ public class DefaultCollector extends BasicCollector
final Field f = getField(cclass, name); final Field f = getField(cclass, name);
if (f != null) { if (f != null) {
return new Mustache.VariableFetcher() { return new Mustache.VariableFetcher() {
@Override public Object get (Object ctx, String name) throws Exception { public Object get (Object ctx, String name) throws Exception {
return f.get(ctx); return f.get(ctx);
} }
}; };