Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support primitive/boxed type equality
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@266 1c488680-804c-0410-94cd-c6b725194a0e
- Loading branch information
Showing
13 changed files
with
186 additions
and
24 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
53 changes: 53 additions & 0 deletions
53
webbeans-ri/src/main/java/org/jboss/webbeans/util/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,53 @@ | ||
package org.jboss.webbeans.util; | ||
|
||
public class Types | ||
{ | ||
|
||
public static Class<?> boxedType(Class<?> type) | ||
{ | ||
if (type.isPrimitive()) | ||
{ | ||
if (type.equals(Boolean.TYPE)) | ||
{ | ||
return Boolean.class; | ||
} | ||
else if (type.equals(Character.TYPE)) | ||
{ | ||
return Character.class; | ||
} | ||
else if (type.equals(Byte.TYPE)) | ||
{ | ||
return Byte.class; | ||
} | ||
else if (type.equals(Short.TYPE)) | ||
{ | ||
return Short.class; | ||
} | ||
else if (type.equals(Integer.TYPE)) | ||
{ | ||
return Integer.class; | ||
} | ||
else if (type.equals(Long.TYPE)) | ||
{ | ||
return Long.class; | ||
} | ||
else if (type.equals(Float.TYPE)) | ||
{ | ||
return Float.class; | ||
} | ||
else if (type.equals(Double.TYPE)) | ||
{ | ||
return Double.class; | ||
} | ||
else | ||
{ | ||
throw new IllegalStateException("Some weird type!!!"); | ||
} | ||
} | ||
else | ||
{ | ||
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
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
11 changes: 11 additions & 0 deletions
11
webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Barn.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,11 @@ | ||
package org.jboss.webbeans.test.beans; | ||
|
||
import org.jboss.webbeans.test.annotations.Tame; | ||
|
||
public class Barn | ||
{ | ||
|
||
@Tame | ||
public Tarantula petSpider; | ||
|
||
} |
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
11 changes: 11 additions & 0 deletions
11
webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/broken/FarmHouse.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,11 @@ | ||
package org.jboss.webbeans.test.beans.broken; | ||
|
||
import javax.webbeans.Current; | ||
|
||
public class FarmHouse | ||
{ | ||
|
||
@Current | ||
public int noOfBedrooms; | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/broken/FarmHouseProducer.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,13 @@ | ||
package org.jboss.webbeans.test.beans.broken; | ||
|
||
import javax.webbeans.Produces; | ||
|
||
public class FarmHouseProducer | ||
{ | ||
|
||
@Produces public Integer getNumberOfBedrooms() | ||
{ | ||
return null; | ||
} | ||
|
||
} |