|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttemmental.TemplateUtils
public class TemplateUtils
Utilities to create models.
Method Summary | ||
---|---|---|
static
|
convert(java.lang.Iterable<T> items,
ConvertFunction<T> function)
Convert a collection of items to a list of models using the given function. |
|
static java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
createList(java.lang.Object... map)
Creates a list with the given models. |
|
static java.util.Map<java.lang.String,java.lang.Object> |
createModel(java.lang.Object... map)
Creates a model: it is an association of key/value pairs. |
|
static
|
filter(java.lang.Iterable<T> items,
ConditionalFunction<T> function)
Returns a list of items for which the given function is true. |
|
static
|
filterAndConvert(java.lang.Iterable<T> items,
ConditionalConvertFunction<T> function)
Filter and convert a collection of items to a list of models using the given function. |
|
static java.util.Properties |
readProperties(java.lang.String propertiesFilePath)
Reads a properties file |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T> java.util.List<T> filter(java.lang.Iterable<T> items, ConditionalFunction<T> function)
T
- The type of itemsitems
- The collection of itemsfunction
- The function to apply on an item. If the result is true, the item is added to the result.
public static <T> java.util.List<java.util.Map<java.lang.String,java.lang.Object>> convert(java.lang.Iterable<T> items, ConvertFunction<T> function)
T
- The type of itemsitems
- The collection of itemsfunction
- The function to use to convert items to models
public static <T> java.util.List<java.util.Map<java.lang.String,java.lang.Object>> filterAndConvert(java.lang.Iterable<T> items, ConditionalConvertFunction<T> function)
T
- The type of itemsitems
- The collection of itemsfunction
- The function to apply on an item. If the result is true, the item is converted to a model and the model is added to the result.
public static java.util.List<java.util.Map<java.lang.String,java.lang.Object>> createList(java.lang.Object... map)
map
- the collection of models
public static java.util.Map<java.lang.String,java.lang.Object> createModel(java.lang.Object... map) throws TemplateException
map
- a key followed by a value. It is an enumeration, so this implies an even size.
TemplateException
- if there is not an even size of parameterspublic static java.util.Properties readProperties(java.lang.String propertiesFilePath) throws java.io.FileNotFoundException, java.io.IOException
propertiesFilePath
- the path of the properties file
java.io.FileNotFoundException
- if the file is not found
java.io.IOException
- if the file can not be read
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |