Package samples.dsl

Source Code of samples.dsl.Dsl

package samples.dsl;

import samples.AddressBuilder;
import samples.ItemBuilder;
import samples.OrderBuilder;
import samples.RecipientBuilder;

/**
* This is the domain-specific data factory.
* <p>
* It provides factory methods for pre-configured builders of domain pojos.
* <p>
* It makes sense that these factories define typical default values for the builders.
*/
public class Dsl extends DslBase {

  public static RecipientBuilder $Recipient() {
    return new RecipientBuilder().withName($String());
  }

  public static AddressBuilder $Address() {
    return new AddressBuilder().withCity($String().withFormat("City-%s"))
        .withPostCode($String().withFormat("PostCode-%s")).withStreet($String().withFormat("Street-%s"));
  }

  public static OrderBuilder $Order() {
    return new OrderBuilder().withRecipient($Recipient());
  }

  public static ItemBuilder $Item() {
    return new ItemBuilder().withArticle($String().withFormat("Item-%s")).withAmount($Integer());
  }

}
TOP

Related Classes of samples.dsl.Dsl

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.