本文整理汇总了Java中io.codearte.jfairy.Fairy.baseProducer方法的典型用法代码示例。如果您正苦于以下问题:Java Fairy.baseProducer方法的具体用法?Java Fairy.baseProducer怎么用?Java Fairy.baseProducer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.codearte.jfairy.Fairy
的用法示例。
在下文中一共展示了Fairy.baseProducer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateStories
import io.codearte.jfairy.Fairy; //导入方法依赖的package包/类
public static List<Story> generateStories(){
Fairy fairy = Fairy.create();
BaseProducer baseProducer = fairy.baseProducer();
List<Story> stories = new ArrayList<>();
for(int i=0; i<=baseProducer.randomBetween(1, 50); i++){
stories.add(generateStory());
}
return stories;
}
示例2: generateStory
import io.codearte.jfairy.Fairy; //导入方法依赖的package包/类
public static Story generateStory(){
Fairy fairy = Fairy.create();
TextProducer textProducer = fairy.textProducer();
BaseProducer baseProducer = fairy.baseProducer();
Story story = new Story.Builder()
.title(textProducer.sentence())
.userId(String.valueOf(baseProducer.randomBetween(0, 999999999)))
.geolocation(getRandomGeoLocation())
.groupId(null)
.id(String.valueOf(baseProducer.randomBetween(0, 999999999)))
.story(textProducer.paragraph())
.build();
return story;
}
示例3: generateStoryWithoutId
import io.codearte.jfairy.Fairy; //导入方法依赖的package包/类
public static Story generateStoryWithoutId(){
Fairy fairy = Fairy.create();
TextProducer textProducer = fairy.textProducer();
BaseProducer baseProducer = fairy.baseProducer();
Story story = new Story.Builder()
.title(textProducer.sentence())
.userId(String.valueOf(baseProducer.randomBetween(0, 999999999)))
.geolocation(getRandomGeoLocation())
.groupId(null)
.story(textProducer.paragraph())
.build();
return story;
}
示例4: generateComments
import io.codearte.jfairy.Fairy; //导入方法依赖的package包/类
public static List<Comment> generateComments() {
Fairy fairy = Fairy.create();
BaseProducer baseProducer = fairy.baseProducer();
List<Comment> comments = new ArrayList<>();
for(int i=0; i<=baseProducer.randomBetween(2, 10); i++){
comments.add(generateComment());
}
return comments;
}
示例5: generateComment
import io.codearte.jfairy.Fairy; //导入方法依赖的package包/类
public static Comment generateComment() {
Fairy fairy = Fairy.create();
TextProducer textProducer = fairy.textProducer();
BaseProducer baseProducer = fairy.baseProducer();
Comment comment = new Comment.Builder()
.storyId(String.valueOf(baseProducer.randomBetween(0, 999999999)))
.description(textProducer.paragraph(10))
.userId(String.valueOf(baseProducer.randomBetween(0, 999999999)))
.header(textProducer.sentence())
.id(String.valueOf(baseProducer.randomBetween(0, 999999999)))
.build();
return comment;
}
示例6: generateStories
import io.codearte.jfairy.Fairy; //导入方法依赖的package包/类
public static List<Story> generateStories() {
Fairy fairy = Fairy.create();
BaseProducer baseProducer = fairy.baseProducer();
List<Story> stories = new ArrayList<>();
for (int i = 0; i <= baseProducer.randomBetween(1, 50); i++) {
stories.add(generateStory());
}
return stories;
}
示例7: randomIds
import io.codearte.jfairy.Fairy; //导入方法依赖的package包/类
private static List<String> randomIds() {
Fairy fairy = Fairy.create();
BaseProducer baseProducer = fairy.baseProducer();
ArrayList<String> tempList = new ArrayList<>();
tempList.add(String.valueOf(baseProducer.randomBetween(1, 999999999)));
tempList.add(String.valueOf(baseProducer.randomBetween(1, 999999999)));
return tempList;
}
示例8: generateStory
import io.codearte.jfairy.Fairy; //导入方法依赖的package包/类
public static Story generateStory() {
Fairy fairy = Fairy.create();
TextProducer textProducer = fairy.textProducer();
BaseProducer baseProducer = fairy.baseProducer();
Story story = new Story.Builder<>()
.title(textProducer.sentence())
.userId(String.valueOf(baseProducer.randomBetween(0, 999999999)))
.geolocation(generateRandomGeolocation())
.id(String.valueOf(baseProducer.randomBetween(0, 999999999)))
.story(textProducer.paragraph())
.build();
return story;
}
示例9: generateStories
import io.codearte.jfairy.Fairy; //导入方法依赖的package包/类
public static List<Story> generateStories(){
Fairy fairy = Fairy.create();
BaseProducer baseProducer = fairy.baseProducer();
List<Story> stories = new ArrayList<>();
for(int i=0; i<=baseProducer.randomBetween(1, 50); i++){
stories.add(generateStory());
}
return stories;
}
示例10: generateUser
import io.codearte.jfairy.Fairy; //导入方法依赖的package包/类
public static User generateUser(){
Fairy fairy = Fairy.create();
Person person = fairy.person();
BaseProducer baseProducer = fairy.baseProducer();
User user = new User.Builder()
.gender(Gender.MALE)
.username(String.valueOf(baseProducer.randomBetween(1, 999999999)))
.name(person.getFirstName())
.surname(person.getLastName())
.build();
return user;
}
示例11: randomIds
import io.codearte.jfairy.Fairy; //导入方法依赖的package包/类
private static List<String> randomIds(){
Fairy fairy = Fairy.create();
BaseProducer baseProducer = fairy.baseProducer();
ArrayList<String> tempList = new ArrayList<>();
tempList.add(String.valueOf(baseProducer.randomBetween(1, 999999999)));
tempList.add(String.valueOf(baseProducer.randomBetween(1, 999999999)));
return tempList;
}
示例12: generateUsers
import io.codearte.jfairy.Fairy; //导入方法依赖的package包/类
public static List<User> generateUsers(){
Fairy fairy = Fairy.create();
BaseProducer baseProducer = fairy.baseProducer();
List<User> users = new ArrayList<>();
for(int i=0; i<=baseProducer.randomBetween(2, 10); i++){
users.add(generateUser());
}
return users;
}
示例13: generateStory
import io.codearte.jfairy.Fairy; //导入方法依赖的package包/类
public static Story generateStory(){
Fairy fairy = Fairy.create();
TextProducer textProducer = fairy.textProducer();
BaseProducer baseProducer = fairy.baseProducer();
Story story = new Story.Builder()
.title(textProducer.sentence())
.userId(String.valueOf(baseProducer.randomBetween(0, 999999999)))
.geolocation(generateRandomGeolocation())
.id(String.valueOf(baseProducer.randomBetween(0, 999999999)))
.story(textProducer.paragraph())
.build();
return story;
}
示例14: createFor
import io.codearte.jfairy.Fairy; //导入方法依赖的package包/类
@Override
Object createFor(AnnotatedElement annotatedElement, Class<?> targetType, Fairy fairy) {
IntegerWith config = findAnnotation(annotatedElement, IntegerWith.class).orElse(null);
int min = minValue(config);
int max = maxValue(config);
BaseProducer producer = fairy.baseProducer();
return producer.randomBetween(min, max);
}
示例15: createFor
import io.codearte.jfairy.Fairy; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
Object createFor(AnnotatedElement annotatedElement, Class<?> targetType, Fairy fairy) {
Class<Enum<?>> enumClass = (Class<Enum<?>>) targetType;
BaseProducer producer = fairy.baseProducer();
return producer.randomElement(enumClass);
}