Skip to content

Commit

Permalink
float type has been introduced in Eclipse Che (when search has been i…
Browse files Browse the repository at this point in the history
…ntroduced :https://github.com/eclipse/che/blob/0cada6bc983448a1e6619249d4c9f6c18c74db84/wsagent/che-core-api-project-shared/src/main/java/org/eclipse/che/api/project/shared/dto/SearchOccurrenceDto.java#L28 )

It wasn't handled by typescript dto generator, add test case and handle it now.

Change-Id: I63a634cdd8822b8908ad84816f75b25a122d45d3
Signed-off-by: Florent BENOIT <fbenoit@redhat.com>
  • Loading branch information
benoitf committed Aug 17, 2017
1 parent 1e57af9 commit e7712ea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ class DTOBuilder {
static MY_SIMPLE_ID : number = 2503;
static MY_SIMPLE_BOOLEAN : boolean = true;
static MY_SIMPLE_DOUBLE : number = 19.79;
static MY_SIMPLE_FLOAT : number = 3.14;


static buildSimpleDto() : org.eclipse.che.plugin.typescript.dto.MySimpleDTO {
let mySimpleDTO : org.eclipse.che.plugin.typescript.dto.MySimpleDTO = new org.eclipse.che.plugin.typescript.dto.MySimpleDTOImpl();
mySimpleDTO.withId(DTOBuilder.MY_SIMPLE_ID).withBoolean(DTOBuilder.MY_SIMPLE_BOOLEAN).withDouble(DTOBuilder.MY_SIMPLE_DOUBLE);
mySimpleDTO.withId(DTOBuilder.MY_SIMPLE_ID).withBoolean(DTOBuilder.MY_SIMPLE_BOOLEAN).withDouble(DTOBuilder.MY_SIMPLE_DOUBLE).withFloat(DTOBuilder.MY_SIMPLE_FLOAT);
return mySimpleDTO;
}

Expand Down Expand Up @@ -55,6 +56,7 @@ describe("DTO serialization tests", () => {
expect(myCustomDTO.getId()).to.eql(DTOBuilder.MY_SIMPLE_ID);
expect(myCustomDTO.getBoolean()).to.eql(DTOBuilder.MY_SIMPLE_BOOLEAN);
expect(myCustomDTO.getDouble()).to.eql(DTOBuilder.MY_SIMPLE_DOUBLE);
expect(myCustomDTO.getFloat()).to.eql(DTOBuilder.MY_SIMPLE_FLOAT);

});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public static String convertType(Type type) {
} else if (String.class.equals(type) || (type instanceof Class && ((Class)type).isEnum())) {
// Maybe find a better enum type for typescript
return "string";
} else if (Integer.class.equals(type) || Integer.TYPE.equals(type) || Long.class.equals(type) || Long.TYPE.equals(type) || Double.class.equals(type) || Double.TYPE.equals(type)) {
} else if (Integer.class.equals(type) || Integer.TYPE.equals(type) || Long.class.equals(type) || Long.TYPE.equals(type) || Double.class.equals(type) || Double.TYPE.equals(type) || Float.TYPE.equals(type)) {
return "number";
} else if (Boolean.class.equals(type)) {
return "boolean";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ public interface MySimpleDTO {

double getDouble();
MySimpleDTO withDouble(double d);

float getFloat();
MySimpleDTO withFloat(float f);

}

0 comments on commit e7712ea

Please sign in to comment.