本文整理了Java中com.hazelcast.core.IMap.project()
方法的一些代码示例,展示了IMap.project()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IMap.project()
方法的具体详情如下:
包路径:com.hazelcast.core.IMap
类名称:IMap
方法名:project
[英]Applies the projection logic on all map entries and returns the result
[中]对所有地图条目应用投影逻辑并返回结果
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public <R> Collection<R> project(Projection<Entry<K, V>, R> projection, Predicate<K, V> predicate) {
return map.project(projection, predicate);
}
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public <R> Collection<R> project(Projection<Entry<K, V>, R> projection) {
return map.project(projection);
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private static void returnTransformedFieldsValue(IMap<String, Employee> employees) {
System.out.println("Doing a projection of a couple of field values");
// create the Predicate to select only Hazelcast employees
Predicate<String, Employee> companyPredicate = new CompanyPredicate("Hazelcast");
// execute the aggregation and print the result
Collection<String> names = employees.project(new Projection<Map.Entry<String, Employee>, String>() {
@Override
public String transform(Map.Entry<String, Employee> entry) {
return entry.getValue().getFirstName() + ":" + entry.getValue().getSalaryPerMonth();
}
}, companyPredicate);
System.out.println("Projected names and salaries: " + names);
System.out.println("\n");
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private static void returnSingleFieldValueWithPredicate(IMap<String, Employee> employees) {
System.out.println("Doing a projection of a single field value");
// create the Predicate to select only Hazelcast employees
Predicate<String, Employee> companyPredicate = new CompanyPredicate("Hazelcast");
// execute the aggregation and print the result
Collection<String> names = employees.project(new Projection<Map.Entry<String, Employee>, String>() {
@Override
public String transform(Map.Entry<String, Employee> entry) {
return entry.getValue().getFirstName();
}
}, companyPredicate);
System.out.println("Projected names: " + names);
System.out.println("\n");
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
@SuppressWarnings({"unchecked", "rawtypes"})
private void alert(User user, String airportCode) {
alerts++;
if (alerts > ALERT_LOGGING_LIMIT) {
return;
}
String sql = "code = '" + airportCode + "' OR code = '" + user.getLastCardUsePlace() + "'";
Predicate predicate = new SqlPredicate(sql);
Projection projection = Projections.singleAttribute("description");
Collection results = airportsMap.project(projection, predicate);
if (results.size() == 2) {
Iterator iterator = results.iterator();
System.err.printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %n");
System.err.printf("~~~ A L E R T ~~~ %n");
System.err.printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %n");
System.out.printf("~~~ User : '%d'%n", user.getUserId());
System.out.printf("~~~ Only three hours between card used at%n");
while (iterator.hasNext()) {
System.out.printf("~~~ %s%n", iterator.next());
}
System.err.printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %n");
} else {
log.error("alert({}, {}), Collection.size()=={}",
user, airportCode, results.size());
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
System.out.printf("PROJECTION : '%s'%n", projection);
Collection<Object[]> personFields = personMap.project(projection, predicate);
内容来源于网络,如有侵权,请联系作者删除!