1 /**
2  * Copyright 2017 SmartBear Software
3  * <p>
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  * <p>
8  * http://www.apache.org/licenses/LICENSE-2.0
9  * <p>
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package io.swagger.v3.oas.models.media;
18
19 import java.util.Objects;
20
21 /**
22  * ObjectSchema
23  */

24
25 public class ObjectSchema extends Schema<Object> {
26
27     public ObjectSchema() {
28         super("object"null);
29     }
30
31     public ObjectSchema type(String type) {
32         super.setType(type);
33         return this;
34     }
35
36     public ObjectSchema example(Object example) {
37         if (example != null) {
38             super.setExample(example.toString());
39         }
40         return this;
41     }
42
43     @Override
44     protected Object cast(Object value) {
45         return value;
46     }
47
48     @Override
49     public boolean equals(java.lang.Object o) {
50         if (this == o) {
51             return true;
52         }
53         if (o == null || getClass() != o.getClass()) {
54             return false;
55         }
56         return super.equals(o);
57     }
58
59     @Override
60     public int hashCode() {
61         return Objects.hash(super.hashCode());
62     }
63
64     @Override
65     public String toString() {
66         StringBuilder sb = new StringBuilder();
67         sb.append("class ObjectSchema {\n");
68         sb.append("    ").append(toIndentedString(super.toString())).append("\n");
69         sb.append("}");
70         return sb.toString();
71     }
72 }
73