001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau.examples.rest.petstore.dto; 014 015import org.apache.juneau.annotation.*; 016 017/** 018 * Bean for creating {@link Order} objects. 019 */ 020@Bean(fluentSetters=true, properties="petId,username") 021public class CreateOrder { 022 023 private long petId; 024 private String username; 025 026 /** 027 * Optional constructor. 028 */ 029 @BeanConstructor(properties="petId,username") 030 public CreateOrder(long petId, String username) { 031 this.petId = petId; 032 this.username = username; 033 } 034 035 /** 036 * Constructor needed by JPA. 037 */ 038 public CreateOrder() {} 039 040 //----------------------------------------------------------------------------------------------------------------- 041 // Bean properties 042 //----------------------------------------------------------------------------------------------------------------- 043 044 public long getPetId() { 045 return petId; 046 } 047 048 public CreateOrder petId(long value) { 049 this.petId = value; 050 return this; 051 } 052 053 public String getUsername() { 054 return username; 055 } 056 057 public CreateOrder username(String value) { 058 this.username = value; 059 return this; 060 } 061 062 //----------------------------------------------------------------------------------------------------------------- 063 // Other 064 //----------------------------------------------------------------------------------------------------------------- 065 066 /** 067 * Used to populate Swagger examples. 068 * Example is inferred from the method name. 069 */ 070 public static CreateOrder example() { 071 return new CreateOrder(123, "sampleuser"); 072 } 073}