@OpenApiAll
public class SorterTool
extends com.nomagic.magicreport.engine.tools.SortTool
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONTEXT_NAME
Contains a context name.
|
Constructor and Description |
---|
SorterTool() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getBlankValue()
Return the value for blank field.
|
protected java.lang.Object |
getValue(java.lang.Object object,
java.lang.String propertyName)
Look up a object value by property name.
|
java.util.Collection |
humanSort(java.util.Collection collection)
Special sorting function with human order, which says to split the text to be sorted into numeric and
non-numeric chunks, then sort so that the numeric chunks are treated as numbers.
|
void |
setProperties(java.util.Properties properties)
This method is invoked by the template engine runtime, after class has been initializing, to set the
template properties.
|
java.util.Collection |
sort(java.util.Collection collection)
Sort function for template report.
|
java.util.Collection |
treeSort(java.util.Collection collection)
Special sorting function with human order for containment tree elements, which says to split the text to be
sorted into numeric and non-numeric chunks, then sort so that the numeric chunks are treated as numbers.
|
getNextToken, humanSort, sort, sortByFirstNumber, sortByFirstNumber, sortByLocale, sortByLocale
clone, getContext, getProperties, getProperty, getProperty, notifyObservers, setContext
public static final java.lang.String CONTEXT_NAME
public void setProperties(java.util.Properties properties)
setProperties
in interface com.nomagic.magicreport.engine.ITool
setProperties
in class com.nomagic.magicreport.engine.Tool
properties
- template engine propertiespublic java.lang.String getBlankValue()
public java.util.Collection sort(java.util.Collection collection)
$sorter
For example:
<code> #foreach ($rel in $sorter.sort($package)) $rel.name #end </code>
This method will sort object in collection by default MagicDraw model ordering ('name' when input is a collection of NamedElement).
sort
in class com.nomagic.magicreport.engine.tools.SortTool
collection
- collection to be sortpublic java.util.Collection humanSort(java.util.Collection collection)
This method will sort object in collection by default MagicDraw model ordering. ('name' when input is a collection of NamedElement).
humanSort
in class com.nomagic.magicreport.engine.tools.SortTool
collection
- collection collection to be sortpublic java.util.Collection treeSort(java.util.Collection collection)
This method will sort object in collection by default MagicDraw model ordering. ('name' when input is a collection of NamedElement).
collection
- collection collection to be sortprotected java.lang.Object getValue(java.lang.Object object, java.lang.String propertyName)
getValue
in class com.nomagic.magicreport.engine.tools.SortTool
object
- target object.propertyName
- property name