Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
*** BEGIN LICENSE BLOCK ***** Version: MPL 2.0 echocat Jomon, Copyright (c) 2012-2013 echocat This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. *** END LICENSE BLOCK ***** /
package org.echocat.jomon.demo.generator;
import  javax.annotation.Nonnull;
import static org.echocat.jomon.runtime.date.DateGenerator.generateDate;
public class EmployeeGenerator implements Generator<EmployeeEmployeeRequirement> {
    private static final EmployeeGenerator INSTANCE = new EmployeeGenerator();
    @Nonnull
    public static Employee generateAn(@Nonnull EmployeeRequirement requirement) {
        return .generate(requirement);
    }
    private StringGenerator _stringGenerator = new StringGenerator();
    @Nonnull
    @Override
    public Employee generate(@Nonnull EmployeeRequirement requirement) {
        final Employee employee = new Employee();
        handleName(requirementemployee);
        handleJoined(requirementemployee);
        return employee;
    }
    protected void handleName(@Nonnull EmployeeRequirement requirement, @Nonnull Employee employee) {
        final String name = .generate(requirement.getName());
        employee.setName(name);
    }
    protected void handleJoined(@Nonnull EmployeeRequirement requirement, @Nonnull Employee employee) {
        final Date joined = generateDate(requirement.getJoined());
        employee.setJoined(joined);
    }
    public void setStringGenerator(@Nonnull StringGenerator stringGenerator) {
         = stringGenerator;
    }
New to GrepCode? Check out our FAQ X