Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert primitiv to enum class #59

Closed
l-salih opened this issue Nov 18, 2016 · 15 comments
Closed

convert primitiv to enum class #59

l-salih opened this issue Nov 18, 2016 · 15 comments
Assignees
Labels
Milestone

Comments

@l-salih
Copy link

l-salih commented Nov 18, 2016

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?

@avurro
Copy link
Member

avurro commented Nov 18, 2016

Hi @ls3642,
I will write the test and give you feedback as soon as possible

@avurro avurro self-assigned this Nov 18, 2016
@avurro
Copy link
Member

avurro commented 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! 👍

@petromir
Copy link

#58 points 1.6.2-SNAPSHOT as a snapshot version. How 1.6.1.CR2-SNAPSHOT differs from it?

@avurro
Copy link
Member

avurro commented Nov 19, 2016

This snapshot includes several issue, see release notes for more info. For the first snapshot i haven't reasoned much about the definition of the name. This release include 1.6.2-SNAPSHOT, so you can use it without problem.

@avurro avurro added the bug label Nov 21, 2016
@avurro avurro added this to the 1.6.1.CR2 milestone Nov 21, 2016
@avurro avurro closed this as completed Nov 21, 2016
@l-salih
Copy link
Author

l-salih commented Nov 23, 2016

Hi @avurro thanks for the fast response!
I do get a Exception: com.googlecode.jmapper.exceptions.JMapperException: com.googlecode.jmapper.exceptions.ConversionBodyIllegalCodeException: There is an error in the generated method. Additional information: [source error] invalid types for !=

@avurro
Copy link
Member

avurro commented Nov 23, 2016

are you using the snapshot?

@l-salih
Copy link
Author

l-salih commented Nov 23, 2016

I thought the snapshot version 1.6.2-SNAPSHOT also includes the fix of this bug. I used now the version 1.6.1.CR2-SNAPSHOT and it worked perfectly.
Thank you for your support!

@avurro
Copy link
Member

avurro commented Nov 23, 2016

add a star if you like the project! thank you! 👍

@phil-schneider
Copy link

We have the same issue.
Could you create a new release for 1.6.1.CR2-SNAPSHOT
We can not really work with Snapshot versions and I dont want to fork your whole project :-)
Thanks a lot

@avurro
Copy link
Member

avurro commented Dec 6, 2016

I think about it a bit, let you know

@petromir
Copy link

petromir commented Dec 6, 2016

I also vote for more often final releases, even if they contain 1 or 2 fixed issues. Thanks for your hard work.

@phil-schneider
Copy link

Hello,
I cloned the repository to make a local release for 1.6.1.CR2-SNAPSHOT.
But I did not find any commit for this issue, nor did I found any tags or branches for this.
Could you please push your changes?

I understand that you might dont want to release yet, but please give us the chance to release a local version ourself with the fix.
Thanks a lot.

@avurro
Copy link
Member

avurro commented Dec 8, 2016

@phil-schneider give me the time to release a version with this fix, just few hours.

@avurro
Copy link
Member

avurro commented Dec 12, 2016

I'm having problems with the tests, i am sorry for the delay

@avurro
Copy link
Member

avurro commented Dec 12, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants