本文整理汇总了Java中org.stringtemplate.v4.misc.Aggregate类的典型用法代码示例。如果您正苦于以下问题:Java Aggregate类的具体用法?Java Aggregate怎么用?Java Aggregate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Aggregate类属于org.stringtemplate.v4.misc包,在下文中一共展示了Aggregate类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addAggr
import org.stringtemplate.v4.misc.Aggregate; //导入依赖的package包/类
/** Split {@code aggrName.{propName1,propName2}} into list
* {@code [propName1, propName2]} and the {@code aggrName}. Spaces are
* allowed around {@code ','}.
*/
public synchronized ST addAggr(String aggrSpec, Object... values) {
int dot = aggrSpec.indexOf(".{");
if ( values==null || values.length==0 ) {
throw new IllegalArgumentException("missing values for aggregate attribute format: "+aggrSpec);
}
int finalCurly = aggrSpec.indexOf('}');
if ( dot<0 || finalCurly<0 ) {
throw new IllegalArgumentException("invalid aggregate attribute format: "+aggrSpec);
}
String aggrName = aggrSpec.substring(0, dot);
String propString = aggrSpec.substring(dot +2, aggrSpec.length()-1);
propString = propString.trim();
String[] propNames = propString.split("\\ *,\\ *");
if ( propNames==null || propNames.length==0 ) {
throw new IllegalArgumentException("invalid aggregate attribute format: "+aggrSpec);
}
if ( values.length!= propNames.length ) {
throw new IllegalArgumentException("number of properties and values mismatch for aggregate attribute format: "+aggrSpec);
}
int i = 0;
Aggregate aggr = new Aggregate();
for (String p : propNames) {
Object v = values[i++];
aggr.properties.put(p, v);
}
add(aggrName, aggr); // now add as usual
return this;
}
示例2: addAggr
import org.stringtemplate.v4.misc.Aggregate; //导入依赖的package包/类
/** Split {@code aggrName.{propName1,propName2}} into list
* {@code [propName1, propName2]} and the {@code aggrName}. Spaces are
* allowed around {@code ','}.
*/
public synchronized ST addAggr(String aggrSpec, Object ... values) {
int dot = aggrSpec.indexOf(".{");
if ( values==null || values.length==0 ) {
throw new IllegalArgumentException("missing values for aggregate attribute format: "+aggrSpec);
}
int finalCurly = aggrSpec.indexOf('}');
if ( dot<0 || finalCurly<0 ) {
throw new IllegalArgumentException("invalid aggregate attribute format: "+aggrSpec);
}
String aggrName = aggrSpec.substring(0, dot);
String propString = aggrSpec.substring(dot+2, aggrSpec.length()-1);
propString = propString.trim();
String[] propNames = propString.split("\\ *,\\ *");
if ( propNames==null || propNames.length==0 ) {
throw new IllegalArgumentException("invalid aggregate attribute format: "+aggrSpec);
}
if ( values.length!= propNames.length ) {
throw new IllegalArgumentException("number of properties and values mismatch for aggregate attribute format: "+aggrSpec);
}
int i = 0;
Aggregate aggr = new Aggregate();
for (String p : propNames) {
Object v = values[i++];
aggr.properties.put(p, v);
}
add(aggrName, aggr); // now add as usual
return this;
}
示例3: addAggr
import org.stringtemplate.v4.misc.Aggregate; //导入依赖的package包/类
/** Split {@code aggrName.{propName1,propName2}} into list
* {@code [propName1, propName2]} and the {@code aggrName}. Spaces are
* allowed around {@code ','}.
*/
public synchronized ST addAggr(String aggrSpec, Object ... values) {
int dot = aggrSpec.indexOf(".{");
if ( values==null || values.length==0 ) {
throw new IllegalArgumentException("missing values for aggregate attribute format: "+
aggrSpec);
}
int finalCurly = aggrSpec.indexOf('}');
if ( dot<0 || finalCurly<0 ) {
throw new IllegalArgumentException("invalid aggregate attribute format: "+
aggrSpec);
}
String aggrName = aggrSpec.substring(0, dot);
String propString = aggrSpec.substring(dot+2, aggrSpec.length()-1);
propString = propString.trim();
String[] propNames = propString.split("\\ *,\\ *");
if ( propNames==null || propNames.length==0 ) {
throw new IllegalArgumentException("invalid aggregate attribute format: "+
aggrSpec);
}
if ( values.length!=propNames.length ) {
throw new IllegalArgumentException("number of properties and values mismatch for aggregate attribute format: "+aggrSpec);
}
int i = 0;
Aggregate aggr = new Aggregate();
for (String p : propNames) {
Object v = values[i++];
aggr.properties.put(p, v);
}
add(aggrName, aggr); // now add as usual
return this;
}
示例4: addAggr
import org.stringtemplate.v4.misc.Aggregate; //导入依赖的package包/类
/** Split {@code aggrName.{propName1,propName2}} into list
* {@code [propName1, propName2]} and the {@code aggrName}. Spaces are
* allowed around {@code ','}.
*/
public synchronized ST addAggr(String aggrSpec, Object ... values) {
int dot = aggrSpec.indexOf(".{");
if ( values==null || values.length==0 ) {
throw new IllegalArgumentException("missing values for aggregate attribute format: "+
aggrSpec);
}
int finalCurly = aggrSpec.indexOf('}');
if ( dot<0 || finalCurly<0 ) {
throw new IllegalArgumentException("invalid aggregate attribute format: "+
aggrSpec);
}
String aggrName = aggrSpec.substring(0, dot);
String propString = aggrSpec.substring(dot+2, aggrSpec.length()-1);
propString = propString.trim();
String[] propNames = propString.split("\\ *,\\ *");
if ( propNames==null || propNames.length==0 ) {
throw new IllegalArgumentException("invalid aggregate attribute format: "+
aggrSpec);
}
if ( values.length!= propNames.length ) {
throw new IllegalArgumentException("number of properties and values mismatch for aggregate attribute format: "+aggrSpec);
}
int i = 0;
Aggregate aggr = new Aggregate();
for (String p : propNames) {
Object v = values[i++];
aggr.properties.put(p, v);
}
add(aggrName, aggr); // now add as usual
return this;
}
示例5: addAggr
import org.stringtemplate.v4.misc.Aggregate; //导入依赖的package包/类
/** Split {@code aggrName.{propName1,propName2}} into list
* {@code [propName1, propName2]} and the {@code aggrName}. Spaces are
* allowed around {@code ','}.
*/
public synchronized ST addAggr(String aggrSpec,Object ... values) {
int dot = aggrSpec.indexOf(".{");
if ( values==null || values.length==0 ) {
throw new IllegalArgumentException("missing values for aggregate attribute format: "+aggrSpec);
}
int finalCurly = aggrSpec.indexOf('}');
if ( dot<0 || finalCurly<0 ) {
throw new IllegalArgumentException("invalid aggregate attribute format: "+
aggrSpec);
}
String aggrName = aggrSpec.substring(0, dot);
String propString = aggrSpec.substring(dot+2, aggrSpec.length()-1);
propString = propString.trim();
String[] propNames = propString.split("\\ *,\\ *");
if ( propNames==null || propNames.length==0 ) {
throw new IllegalArgumentException("invalid aggregate attribute format: "+
aggrSpec);
}
if ( values.length!= propNames.length ) {
throw new IllegalArgumentException("number of properties and values mismatch for aggregate attribute format: "+aggrSpec);
}
int i = 0;
Aggregate aggr = new Aggregate();
for (String p : propNames) {
Object v = values[i++];
aggr.properties.put(p, v);
}
add(aggrName, aggr); // now add as usual
return this;
}
示例6: addAggr
import org.stringtemplate.v4.misc.Aggregate; //导入依赖的package包/类
/** Split {@code aggrName.{propName1,propName2}} into list
* {@code [propName1, propName2]} and the {@code aggrName}. Spaces are
* allowed around {@code ','}.
*/
public synchronized ST addAggr(String aggrSpec, Object... values) {
int dot = aggrSpec.indexOf(".{");
if ( values==null || values.length==0 ) {
throw new IllegalArgumentException("missing values for aggregate attribute format: "+
aggrSpec);
}
int finalCurly = aggrSpec.indexOf('}');
if ( dot<0 || finalCurly < 0 ) {
throw new IllegalArgumentException("invalid aggregate attribute format: "+
aggrSpec);
}
String aggrName = aggrSpec.substring(0, dot);
String propString = aggrSpec.substring(dot+2, aggrSpec.length()-1);
propString = propString.trim();
String[] propNames = propString.split("\\ *,\\ *");
if ( propNames==null || propNames.length==0 ) {
throw new IllegalArgumentException("invalid aggregate attribute format: "+
aggrSpec);
}
if ( values.length != propNames.length ) {
throw new IllegalArgumentException(
"number of properties and values mismatch for aggregate attribute format: "+
aggrSpec);
}
int i=0;
Aggregate aggr = new Aggregate();
for (String p : propNames) {
Object v = values[i++];
aggr.properties.put(p, v);
}
add(aggrName, aggr); // now add as usual
return this;
}
示例7: addAggregateList
import org.stringtemplate.v4.misc.Aggregate; //导入依赖的package包/类
@Override
public void addAggregateList(String name, Map<String, Object> map) {
Aggregate aggregate = new Aggregate();
aggregate.properties = new HashMap<>(map);
st.add(name, aggregate);
}