Skip to content

Commit

Permalink
Revert file AbstractDeclarable.java from main
Browse files Browse the repository at this point in the history
  • Loading branch information
ngocnhan-tran1996 committed Oct 15, 2024
1 parent c2a7261 commit 578ee86
Showing 1 changed file with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;


import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;

/**
* Base class for {@link Declarable} classes.
Expand All @@ -40,7 +40,7 @@
*/
public abstract class AbstractDeclarable implements Declarable {

private final Lock lock = new ReentrantLock();
private final Lock lock = new ReentrantLock();

private boolean shouldDeclare = true;

Expand Down Expand Up @@ -103,18 +103,16 @@ public void setIgnoreDeclarationExceptions(boolean ignoreDeclarationExceptions)

@Override
public void setAdminsThatShouldDeclare(Object... adminArgs) {
this.declaringAdmins = new ArrayList<>();
if (ObjectUtils.isEmpty(adminArgs)) {
return;
}

if (adminArgs.length > 1) {
Assert.noNullElements(adminArgs, "'admins' cannot contain null elements");
this.declaringAdmins.addAll(Arrays.asList(adminArgs));
}
else if (adminArgs[0] != null) {
this.declaringAdmins.add(adminArgs[0]);
Collection<Object> admins = new ArrayList<>();
if (adminArgs != null) {
if (adminArgs.length > 1) {
Assert.noNullElements(adminArgs, "'admins' cannot contain null elements");
}
if (adminArgs.length > 0 && !(adminArgs.length == 1 && adminArgs[0] == null)) {
admins.addAll(Arrays.asList(adminArgs));
}
}
this.declaringAdmins = admins;
}

@Override
Expand Down

0 comments on commit 578ee86

Please sign in to comment.