Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaTP committed Nov 22, 2023
1 parent f488ee9 commit 3813d35
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.microsoft.kiota.serialization.mocks;

import com.microsoft.kiota.serialization.ValuedEnum;
import com.microsoft.kiota.serialization.ValuedEnumParser;
import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;
import java.util.Objects;

public enum MyEnum implements ValuedEnum, ValuedEnumParser<MyEnum> {
public enum MyEnum implements ValuedEnum {
MY_VALUE1("VALUE1"),
MY_VALUE2("VALUE2");
public final String value;
Expand All @@ -13,11 +14,11 @@ public enum MyEnum implements ValuedEnum, ValuedEnumParser<MyEnum> {
this.value = value;
}

@jakarta.annotation.Nonnull public String getValue() {
@Nonnull public String getValue() {
return this.value;
}

@jakarta.annotation.Nullable public MyEnum forValue(@jakarta.annotation.Nonnull final String searchValue) {
@Nullable public static MyEnum forValue(@jakarta.annotation.Nonnull final String searchValue) {
Objects.requireNonNull(searchValue);
switch (searchValue) {
case "VALUE1":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,7 @@ public Map<String, Consumer<ParseNode>> getFieldDeserializers() {
put(
"myEnum",
(n) -> {
setMyEnum(
n.getEnumValue(
value ->
(value == null || MyEnum.values().length < 1)
? null
: MyEnum.values()[0].forValue(value)));
setMyEnum(n.getEnumValue(MyEnum::forValue));
});
put(
"createdDateTime",
Expand Down

0 comments on commit 3813d35

Please sign in to comment.