mirror of
https://github.com/google/nomulus.git
synced 2025-05-12 22:38:16 +02:00
Run automatic Java 8 conversion over codebase
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=171174380
This commit is contained in:
parent
44df5da771
commit
5edb7935ed
190 changed files with 2312 additions and 3096 deletions
|
@ -17,6 +17,7 @@ package google.registry.tools;
|
|||
import static com.google.common.base.CaseFormat.UPPER_CAMEL;
|
||||
import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.collect.ImmutableList.toImmutableList;
|
||||
import static google.registry.model.registry.Registries.assertTldExists;
|
||||
import static google.registry.util.PreconditionsUtils.checkArgumentPresent;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
|
@ -25,9 +26,9 @@ import com.beust.jcommander.Parameter;
|
|||
import com.beust.jcommander.Parameters;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Streams;
|
||||
import com.google.re2j.Matcher;
|
||||
import com.google.re2j.Pattern;
|
||||
import google.registry.model.billing.RegistrarCredit;
|
||||
|
@ -42,6 +43,7 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
import org.joda.money.BigMoney;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
import org.joda.money.Money;
|
||||
|
@ -107,31 +109,25 @@ final class CreateAuctionCreditsCommand extends MutatingCommand {
|
|||
CURRENCY_CODE;
|
||||
|
||||
public static List<String> getHeaders() {
|
||||
return FluentIterable.from(values())
|
||||
.transform(new Function<CsvHeader, String>() {
|
||||
@Override
|
||||
public String apply(CsvHeader header) {
|
||||
// Returns the name of the header as it appears in the CSV file.
|
||||
return UPPER_UNDERSCORE.to(UPPER_CAMEL, header.name());
|
||||
}})
|
||||
.toList();
|
||||
return Stream.of(values())
|
||||
.map(header -> UPPER_UNDERSCORE.to(UPPER_CAMEL, header.name()))
|
||||
.collect(toImmutableList());
|
||||
}
|
||||
}
|
||||
|
||||
private static final Pattern QUOTED_STRING = Pattern.compile("\"(.*)\"");
|
||||
|
||||
/** Helper function to unwrap a quoted string, failing if the string is not quoted. */
|
||||
private static final Function<String, String> UNQUOTER = new Function<String, String>() {
|
||||
@Override
|
||||
public String apply(String input) {
|
||||
Matcher matcher = QUOTED_STRING.matcher(input);
|
||||
checkArgument(matcher.matches(), "Input not quoted");
|
||||
return matcher.group(1);
|
||||
}};
|
||||
private static final Function<String, String> UNQUOTER =
|
||||
input -> {
|
||||
Matcher matcher = QUOTED_STRING.matcher(input);
|
||||
checkArgument(matcher.matches(), "Input not quoted");
|
||||
return matcher.group(1);
|
||||
};
|
||||
|
||||
/** Returns the input string of quoted CSV values split into the list of unquoted values. */
|
||||
private static List<String> splitCsvLine(String line) {
|
||||
return FluentIterable.from(Splitter.on(',').split(line)).transform(UNQUOTER).toList();
|
||||
return Streams.stream(Splitter.on(',').split(line)).map(UNQUOTER).collect(toImmutableList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue