Changeset 60:5aca8ba633a0 in livinglogic.java.ul4

Show
Ignore:
Timestamp:
05/31/08 20:32:35 (12 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Add type checks to getSlice().

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/src/com/livinglogic/sxtl/Utils.java

    r58 r60  
    399399    public static Object getSlice(Object arg1, Object arg2, Object arg3) 
    400400    { 
     401        if (arg2 instanceof Integer && arg3 instanceof Integer) 
     402        { 
     403            if (arg1 instanceof List) 
     404                return getSlice((List)arg1, (Integer)arg2, (Integer)arg3); 
     405            else if (arg1 instanceof String) 
     406                return getSlice((String)arg1, (Integer)arg2, (Integer)arg3); 
     407        } 
    401408        throw new UnsupportedOperationException("Instance of " + arg1.getClass() + " does not support getslice with arguments of type " + arg2.getClass() + " and " + arg3.getClass() + "!"); 
    402409    }