- java.lang.Object
-
- com.samskivert.mustache.BasicCollector
-
- All Implemented Interfaces:
Mustache.Collector
- Direct Known Subclasses:
DefaultCollector
public abstract class BasicCollector extends java.lang.Object implements Mustache.Collector
A collector that does not use reflection and can be used with GWT.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
BasicCollector.ArrayHelper
-
Field Summary
Fields Modifier and Type Field Description protected static BasicCollector.ArrayHelper
BOOLEAN_ARRAY_HELPER
protected static BasicCollector.ArrayHelper
BYTE_ARRAY_HELPER
protected static BasicCollector.ArrayHelper
CHAR_ARRAY_HELPER
protected static Mustache.VariableFetcher
CUSTOM_FETCHER
protected static BasicCollector.ArrayHelper
DOUBLE_ARRAY_HELPER
protected static BasicCollector.ArrayHelper
FLOAT_ARRAY_HELPER
protected static BasicCollector.ArrayHelper
INT_ARRAY_HELPER
protected static Mustache.VariableFetcher
ITER_FETCHER
protected static Mustache.VariableFetcher
LIST_FETCHER
protected static BasicCollector.ArrayHelper
LONG_ARRAY_HELPER
protected static Mustache.VariableFetcher
MAP_FETCHER
protected static BasicCollector.ArrayHelper
OBJECT_ARRAY_HELPER
protected static BasicCollector.ArrayHelper
SHORT_ARRAY_HELPER
-
Constructor Summary
Constructors Constructor Description BasicCollector()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static BasicCollector.ArrayHelper
arrayHelper(java.lang.Object ctx)
Mustache.VariableFetcher
createFetcher(java.lang.Object ctx, java.lang.String name)
Creates a fetcher for a so-named variable in the supplied context object, which will never be null.abstract <K,V>
java.util.Map<K,V>createFetcherCache()
This should return a thread-safe map, eitherCollections.synchronizedMap(java.util.Map<K, V>)
called on a standardMap
implementation or something likeConcurrentHashMap
.java.util.Iterator<?>
toIterator(java.lang.Object value)
Returns an iterator that can iterate over the supplied value, or null if the value is not a collection.
-
-
-
Field Detail
-
CUSTOM_FETCHER
protected static final Mustache.VariableFetcher CUSTOM_FETCHER
-
MAP_FETCHER
protected static final Mustache.VariableFetcher MAP_FETCHER
-
LIST_FETCHER
protected static final Mustache.VariableFetcher LIST_FETCHER
-
ITER_FETCHER
protected static final Mustache.VariableFetcher ITER_FETCHER
-
OBJECT_ARRAY_HELPER
protected static final BasicCollector.ArrayHelper OBJECT_ARRAY_HELPER
-
BOOLEAN_ARRAY_HELPER
protected static final BasicCollector.ArrayHelper BOOLEAN_ARRAY_HELPER
-
BYTE_ARRAY_HELPER
protected static final BasicCollector.ArrayHelper BYTE_ARRAY_HELPER
-
CHAR_ARRAY_HELPER
protected static final BasicCollector.ArrayHelper CHAR_ARRAY_HELPER
-
SHORT_ARRAY_HELPER
protected static final BasicCollector.ArrayHelper SHORT_ARRAY_HELPER
-
INT_ARRAY_HELPER
protected static final BasicCollector.ArrayHelper INT_ARRAY_HELPER
-
LONG_ARRAY_HELPER
protected static final BasicCollector.ArrayHelper LONG_ARRAY_HELPER
-
FLOAT_ARRAY_HELPER
protected static final BasicCollector.ArrayHelper FLOAT_ARRAY_HELPER
-
DOUBLE_ARRAY_HELPER
protected static final BasicCollector.ArrayHelper DOUBLE_ARRAY_HELPER
-
-
Method Detail
-
toIterator
public java.util.Iterator<?> toIterator(java.lang.Object value)
Description copied from interface:Mustache.Collector
Returns an iterator that can iterate over the supplied value, or null if the value is not a collection.- Specified by:
toIterator
in interfaceMustache.Collector
-
createFetcher
public Mustache.VariableFetcher createFetcher(java.lang.Object ctx, java.lang.String name)
Description copied from interface:Mustache.Collector
Creates a fetcher for a so-named variable in the supplied context object, which will never be null. The fetcher will be cached and reused for future contexts for whichoctx.getClass().equals(nctx.getClass()
.- Specified by:
createFetcher
in interfaceMustache.Collector
-
createFetcherCache
public abstract <K,V> java.util.Map<K,V> createFetcherCache()
This should return a thread-safe map, eitherCollections.synchronizedMap(java.util.Map<K, V>)
called on a standardMap
implementation or something likeConcurrentHashMap
.- Specified by:
createFetcherCache
in interfaceMustache.Collector
-
arrayHelper
protected static BasicCollector.ArrayHelper arrayHelper(java.lang.Object ctx)
-
-