|
19 | 19 | */
|
20 | 20 | package org.sonar.python.types.v2;
|
21 | 21 |
|
22 |
| -import javax.annotation.CheckForNull; |
23 | 22 | import javax.annotation.Nullable;
|
24 | 23 | import org.sonar.plugins.python.api.LocationInFile;
|
25 | 24 |
|
26 |
| -public class ParameterV2 { |
27 |
| - |
28 |
| - private final String name; |
29 |
| - private PythonType declaredType; |
30 |
| - private final boolean hasDefaultValue; |
31 |
| - private final boolean isKeywordVariadic; |
32 |
| - private final boolean isPositionalVariadic; |
33 |
| - private final boolean isKeywordOnly; |
34 |
| - private final boolean isPositionalOnly; |
35 |
| - private final LocationInFile location; |
36 |
| - |
37 |
| - public ParameterV2(@Nullable String name, PythonType declaredType, boolean hasDefaultValue, |
38 |
| - boolean isKeywordOnly, boolean isPositionalOnly, boolean isKeywordVariadic, boolean isPositionalVariadic, |
39 |
| - @Nullable LocationInFile location) { |
40 |
| - this.name = name; |
41 |
| - this.declaredType = declaredType; |
42 |
| - this.hasDefaultValue = hasDefaultValue; |
43 |
| - this.isKeywordVariadic = isKeywordVariadic; |
44 |
| - this.isPositionalVariadic = isPositionalVariadic; |
45 |
| - this.isKeywordOnly = isKeywordOnly; |
46 |
| - this.isPositionalOnly = isPositionalOnly; |
47 |
| - this.location = location; |
48 |
| - } |
49 |
| - |
50 |
| - @CheckForNull |
51 |
| - public String name() { |
52 |
| - return name; |
53 |
| - } |
54 |
| - |
55 |
| - public PythonType declaredType() { |
56 |
| - return declaredType; |
57 |
| - } |
58 |
| - |
59 |
| - public boolean hasDefaultValue() { |
60 |
| - return hasDefaultValue; |
61 |
| - } |
| 25 | +public record ParameterV2( |
| 26 | + @Nullable String name, |
| 27 | + PythonType declaredType, |
| 28 | + boolean hasDefaultValue, |
| 29 | + boolean isKeywordOnly, |
| 30 | + boolean isPositionalOnly, |
| 31 | + boolean isKeywordVariadic, |
| 32 | + boolean isPositionalVariadic, |
| 33 | + @Nullable LocationInFile location) { |
62 | 34 |
|
63 | 35 | public boolean isVariadic() {
|
64 | 36 | return isKeywordVariadic || isPositionalVariadic;
|
65 | 37 | }
|
66 |
| - |
67 |
| - public boolean isKeywordOnly() { |
68 |
| - return isKeywordOnly; |
69 |
| - } |
70 |
| - |
71 |
| - public boolean isPositionalOnly() { |
72 |
| - return isPositionalOnly; |
73 |
| - } |
74 |
| - |
75 |
| - public boolean isKeywordVariadic() { |
76 |
| - return isKeywordVariadic; |
77 |
| - } |
78 |
| - |
79 |
| - public boolean isPositionalVariadic() { |
80 |
| - return isPositionalVariadic; |
81 |
| - } |
82 |
| - |
83 |
| - @CheckForNull |
84 |
| - public LocationInFile location() { |
85 |
| - return location; |
86 |
| - } |
87 | 38 | }
|
88 | 39 |
|
0 commit comments