本文整理匯總了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);
}