Polish AbstractExposableEndpoint

This commit is contained in:
Moritz Halbritter 2022-07-08 16:16:53 +02:00
parent 96c0e4783b
commit d58f33f1ce

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,9 +16,7 @@
package org.springframework.boot.actuate.endpoint; package org.springframework.boot.actuate.endpoint;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.List; import java.util.List;
import org.springframework.util.Assert; import org.springframework.util.Assert;
@ -34,9 +32,9 @@ public abstract class AbstractExposableEndpoint<O extends Operation> implements
private final EndpointId id; private final EndpointId id;
private boolean enabledByDefault; private final boolean enabledByDefault;
private List<O> operations; private final List<O> operations;
/** /**
* Create a new {@link AbstractExposableEndpoint} instance. * Create a new {@link AbstractExposableEndpoint} instance.
@ -49,7 +47,7 @@ public abstract class AbstractExposableEndpoint<O extends Operation> implements
Assert.notNull(operations, "Operations must not be null"); Assert.notNull(operations, "Operations must not be null");
this.id = id; this.id = id;
this.enabledByDefault = enabledByDefault; this.enabledByDefault = enabledByDefault;
this.operations = Collections.unmodifiableList(new ArrayList<>(operations)); this.operations = List.copyOf(operations);
} }
@Override @Override