forked from jbossas/console
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- support List model type conversions
- roundtrip generic form to dmr and back
- Loading branch information
1 parent
bc23396
commit b2e2d1d
Showing
7 changed files
with
100 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
gui/src/main/java/org/jboss/as/console/client/tools/Types.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.jboss.as.console.client.tools; | ||
|
||
import org.jboss.dmr.client.ModelType; | ||
|
||
/** | ||
* @author Heiko Braun | ||
* @date 7/23/12 | ||
*/ | ||
public class Types { | ||
|
||
public static ModelType toDMR(Object o) { | ||
return resolveModelType(o.getClass().getName()); | ||
} | ||
|
||
private static ModelType resolveModelType(String javaTypeName) { | ||
|
||
ModelType type = null; | ||
|
||
if("java.lang.String".equals(javaTypeName)) | ||
type = ModelType.STRING; | ||
else if("java.lang.Integer".equals(javaTypeName)) | ||
type = ModelType.INT; | ||
else if("java.lang.Long".equals(javaTypeName)) | ||
type = ModelType.LONG; | ||
else if("java.lang.Boolean".equals(javaTypeName)) | ||
type = ModelType.BOOLEAN; | ||
else if("java.lang.Double".equals(javaTypeName)) | ||
type = ModelType.DOUBLE; | ||
else if("java.util.List".equals(javaTypeName)) { | ||
type = ModelType.LIST; | ||
} | ||
else if("java.util.ArrayList".equals(javaTypeName)) { | ||
type = ModelType.LIST; | ||
} | ||
else { | ||
throw new RuntimeException("Failed to resolve ModelType for '"+ javaTypeName+"'"); | ||
} | ||
|
||
return type; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters