|
1 | 1 | /*
|
2 |
| - * Copyright 2013-2014 the original author or authors. |
| 2 | + * Copyright 2013-2015 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -84,6 +84,15 @@ public static Field field(String name) {
|
84 | 84 | return new AggregationField(name);
|
85 | 85 | }
|
86 | 86 |
|
| 87 | + /** |
| 88 | + * Creates a {@link Field} with the given {@code name} and {@code target}. |
| 89 | + * <p> |
| 90 | + * The {@code target} is the name of the backing document field that will be aliased with {@code name}. |
| 91 | + * |
| 92 | + * @param name |
| 93 | + * @param target must not be {@literal null} or empty |
| 94 | + * @return |
| 95 | + */ |
87 | 96 | public static Field field(String name, String target) {
|
88 | 97 | Assert.hasText(target, "Target must not be null or empty!");
|
89 | 98 | return new AggregationField(name, target);
|
@@ -187,15 +196,24 @@ static class AggregationField implements Field {
|
187 | 196 | private final String target;
|
188 | 197 |
|
189 | 198 | /**
|
190 |
| - * Creates an aggregation field with the given name. As no target is set explicitly, the name will be used as target |
191 |
| - * as well. |
| 199 | + * Creates an aggregation field with the given {@code name}. |
192 | 200 | *
|
193 |
| - * @param key |
| 201 | + * @see AggregationField#AggregationField(String, String). |
| 202 | + * @param name must not be {@literal null} or empty |
194 | 203 | */
|
195 |
| - public AggregationField(String key) { |
196 |
| - this(key, null); |
| 204 | + public AggregationField(String name) { |
| 205 | + this(name, null); |
197 | 206 | }
|
198 | 207 |
|
| 208 | + /** |
| 209 | + * Creates an aggregation field with the given {@code name} and {@code target}. |
| 210 | + * <p> |
| 211 | + * The {@code name} serves as an alias for the actual backing document field denoted by {@code target}. If no target |
| 212 | + * is set explicitly, the name will be used as target. |
| 213 | + * |
| 214 | + * @param name must not be {@literal null} or empty |
| 215 | + * @param target |
| 216 | + */ |
199 | 217 | public AggregationField(String name, String target) {
|
200 | 218 |
|
201 | 219 | String nameToSet = cleanUp(name);
|
|
0 commit comments