|
43 | 43 | @ThreadSafe
|
44 | 44 | @Internal
|
45 | 45 | public final class DefaultDispatcher implements Dispatcher, Registrar {
|
46 |
| - @SuppressWarnings("unused") |
47 |
| - private final CelOptions celOptions; |
48 |
| - |
49 | 46 | /**
|
50 |
| - * @deprecated use {@link DefaultDispatcher(CelOptions)} instead. |
| 47 | + * Creates a new dispatcher with all standard functions. |
| 48 | + * |
| 49 | + * @deprecated Migrate to fluent APIs. See {@link CelRuntimeFactory}. |
51 | 50 | */
|
52 | 51 | @Deprecated
|
53 |
| - public DefaultDispatcher(ImmutableSet<ExprFeatures> features) { |
54 |
| - this(CelOptions.fromExprFeatures(features)); |
55 |
| - } |
56 |
| - |
57 |
| - public DefaultDispatcher(CelOptions celOptions) { |
58 |
| - this.celOptions = celOptions; |
| 52 | + public static DefaultDispatcher create() { |
| 53 | + return create(CelOptions.LEGACY); |
59 | 54 | }
|
60 | 55 |
|
61 | 56 | /**
|
62 | 57 | * Creates a new dispatcher with all standard functions.
|
63 | 58 | *
|
64 |
| - * @deprecated use {@link #create(CelOptions)} instead. |
| 59 | + * @deprecated Migrate to fluent APIs. See {@link CelRuntimeFactory}. |
65 | 60 | */
|
66 | 61 | @Deprecated
|
67 | 62 | public static DefaultDispatcher create(ImmutableSet<ExprFeatures> features) {
|
68 | 63 | return create(CelOptions.fromExprFeatures(features));
|
69 | 64 | }
|
70 | 65 |
|
| 66 | + /** |
| 67 | + * Creates a new dispatcher with all standard functions. |
| 68 | + * |
| 69 | + * @deprecated Migrate to fluent APIs. See {@link CelRuntimeFactory}. |
| 70 | + */ |
| 71 | + @Deprecated |
71 | 72 | public static DefaultDispatcher create(CelOptions celOptions) {
|
72 | 73 | DynamicProto dynamicProto = DynamicProto.create(DefaultMessageFactory.INSTANCE);
|
73 |
| - return create(celOptions, dynamicProto); |
| 74 | + return create(celOptions, dynamicProto, true); |
74 | 75 | }
|
75 | 76 |
|
76 |
| - public static DefaultDispatcher create(CelOptions celOptions, DynamicProto dynamicProto) { |
77 |
| - DefaultDispatcher dispatcher = new DefaultDispatcher(celOptions); |
78 |
| - StandardFunctions.add(dispatcher, dynamicProto, celOptions); |
| 77 | + public static DefaultDispatcher create( |
| 78 | + CelOptions celOptions, DynamicProto dynamicProto, boolean enableStandardEnvironment) { |
| 79 | + DefaultDispatcher dispatcher = new DefaultDispatcher(); |
| 80 | + if (enableStandardEnvironment) { |
| 81 | + StandardFunctions.add(dispatcher, dynamicProto, celOptions); |
| 82 | + } |
79 | 83 | return dispatcher;
|
80 | 84 | }
|
81 | 85 |
|
82 |
| - public static DefaultDispatcher create() { |
83 |
| - return create(CelOptions.LEGACY); |
84 |
| - } |
85 |
| - |
86 | 86 | /** Internal representation of an overload. */
|
87 | 87 | @Immutable
|
88 | 88 | private static final class Overload {
|
@@ -237,4 +237,6 @@ public Dispatcher.ImmutableCopy immutableCopy() {
|
237 | 237 | return this;
|
238 | 238 | }
|
239 | 239 | }
|
| 240 | + |
| 241 | + private DefaultDispatcher() {} |
240 | 242 | }
|
0 commit comments