com.github.javafaker.service.FakeValuesGrouping Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javafaker Show documentation
Show all versions of javafaker Show documentation
This library is a port of Ruby's stympy/faker gem (as well as Perl's Data::Faker library) that generates fake data.
It's useful when you're developing a new project and need some pretty data for showcase.
package com.github.javafaker.service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class FakeValuesGrouping implements FakeValuesInterface {
private List fakeValuesList = new ArrayList();
public void add(FakeValues fakeValues) {
fakeValuesList.add(fakeValues);
}
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
public Map get(String key) {
Map result = null;
for (FakeValues fakeValues : fakeValuesList) {
if (fakeValues.supportsPath(key)) {
if (result != null) {
final Map newResult = fakeValues.get(key);
result.putAll(newResult);
} else {
result = fakeValues.get(key);
}
}
}
return result;
}
}