Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,6 +23,8 @@ import java.util.List;
|
||||
import joptsimple.OptionSet;
|
||||
import joptsimple.OptionSpec;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* {@link CommandLinePropertySource} implementation backed by a JOpt {@link OptionSet}.
|
||||
*
|
||||
@@ -84,13 +86,13 @@ public class JOptCommandLinePropertySource extends CommandLinePropertySource<Opt
|
||||
public String[] getPropertyNames() {
|
||||
List<String> names = new ArrayList<String>();
|
||||
for (OptionSpec<?> spec : this.source.specs()) {
|
||||
List<String> aliases = new ArrayList<String>(spec.options());
|
||||
List<String> aliases = spec.options();
|
||||
if (!aliases.isEmpty()) {
|
||||
// Only the longest name is used for enumerating
|
||||
names.add(aliases.get(aliases.size() - 1));
|
||||
}
|
||||
}
|
||||
return names.toArray(new String[names.size()]);
|
||||
return StringUtils.toStringArray(names);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user