question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

convert primitiv to enum class

See original GitHub issue

ConversionBodyIllegalCodeException: error in static conversion: probably is an incompatibility of signature, the expected input fields do not match with the real ones, checks the configured class.

I want to convert a primitiv short to an enum object.

.add(attribute("anEnum") .value("aShort")) .add(conversion("shortToEnum") .from("aShort").to("anEnum") .type(JMapConversion.Type.DYNAMIC) .body("return com.test.v1.Enum.get(${source});")));

The class has a get() method which returns an Enum.

public enum Enum {

    NUMBER(1);

    private final int value;

    Enum(int value) {
        this.value = value;
    }

    public int getValue() {
        return value;
    }

    public static Enum get(short s){
        for(Enum e: values()){
            if(e.getValue() == s){
                return e;
            }
        }
        return null;
    }
}

maybe a Bug?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
avurrocommented, Dec 12, 2016

Ok guys, 1.6.1.CR2 released! i’m apologize for my delay

1reaction
avurrocommented, Nov 18, 2016

Fixed!

<dependency>
  <groupId>com.googlecode.jmapper-framework</groupId>
  <artifactId>jmapper-core</artifactId>
  <version>1.6.1.CR2-SNAPSHOT</version>
</dependency>

You need to add the Snapshot repository! go to wiki page for this.

Add a star if you like the project! thank you for support! 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to convert primitive type value to enum ... - Stack Overflow
Enum variable is basically just a number, it doesn't have a label (such as R2 ) attached to it. For example, FlipRotate2dEnum.
Read more >
EnumToIntConverter - .NET MAUI Community Toolkit
The EnumToIntConverter is a converter that allows you to convert a standard Enum (extending int) to its underlying primitive int type.
Read more >
[Solved]-Enum inheriting from primitive type-C++
Coding example for the question Enum inheriting from primitive type-C++. ... This does not mean inheritance, this selects the enum's underlying type.
Read more >
Rusticity: convert an integer to an enum
Converting an integer to an enum in C. In C, the enumeration constants have the type int . Thus, an integer value can...
Read more >
How to convert an enum type variable to a string in C++?
Here we will see how to convert some enum type data to a string in C++. There is no such direct function to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found