mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Numeric conversions to and from Boolean
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@15651 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -422,6 +422,14 @@ public class DefaultTypeConverter
|
||||
// Number to Subtypes and Date
|
||||
//
|
||||
|
||||
INSTANCE.addConverter(Number.class, Boolean.class, new TypeConverter.Converter<Number, Boolean>()
|
||||
{
|
||||
public Boolean convert(Number source)
|
||||
{
|
||||
return new Boolean(source.longValue() > 0);
|
||||
}
|
||||
});
|
||||
|
||||
INSTANCE.addConverter(Number.class, Byte.class, new TypeConverter.Converter<Number, Byte>()
|
||||
{
|
||||
public Byte convert(Number source)
|
||||
@@ -562,6 +570,16 @@ public class DefaultTypeConverter
|
||||
// Boolean ->
|
||||
//
|
||||
|
||||
final Long LONG_FALSE = new Long(0L);
|
||||
final Long LONG_TRUE = new Long(1L);
|
||||
INSTANCE.addConverter(Boolean.class, Long.class, new TypeConverter.Converter<Boolean, Long>()
|
||||
{
|
||||
public Long convert(Boolean source)
|
||||
{
|
||||
return source.booleanValue() ? LONG_TRUE : LONG_FALSE;
|
||||
}
|
||||
});
|
||||
|
||||
INSTANCE.addConverter(Boolean.class, String.class, new TypeConverter.Converter<Boolean, String>()
|
||||
{
|
||||
public String convert(Boolean source)
|
||||
|
Reference in New Issue
Block a user