| 351 | } |
| 352 | |
| 353 | List<Field> getFieldsToEnrich() { |
| 354 | return Util.allFields(getClass()).stream() |
| 355 | // exclude anything generated by compiler |
| 356 | .filter(field -> !field.isSynthetic()) |
| 357 | // and capabilities itself |
| 358 | .filter(field -> !Objects.equals(field.getName(), "capabilities")) |
| 359 | // and thisB helper field |
| 360 | .filter(field -> !Objects.equals(field.getName(), "thisB")) |
| 361 | // interceptor lists are enriched per-element then as a whole via custom types |
| 362 | .filter(field -> !Objects.equals(field.getName(), "requestInterceptors")) |
| 363 | .filter(field -> !Objects.equals(field.getName(), "responseInterceptors")) |
| 364 | .filter(field -> !Objects.equals(field.getName(), "methodInterceptors")) |
| 365 | // caller-owned lifecycle resources are not capability-enriched |
| 366 | .filter(field -> !Objects.equals(field.getName(), "executorService")) |
| 367 | // skip primitive types |
| 368 | .filter(field -> !field.getType().isPrimitive()) |
| 369 | // skip enumerations |
| 370 | .filter(field -> !field.getType().isEnum()) |
| 371 | .collect(Collectors.toList()); |
| 372 | } |
| 373 | |
| 374 | public final T build() { |
| 375 | return enrich().internalBuild(); |