00001
00002
00003
00004
00005
00006
00007
00008
00009 package com.declarativa.interprolog.util;
00010 import java.io.*;
00014 public class BasicTypeWrapper implements Serializable{
00015 public Object wrapper;
00016 public Class basicTypeClass(){
00017 if (wrapper instanceof Boolean) return Boolean.TYPE;
00018 if (wrapper instanceof Character) return Character.TYPE;
00019 if (wrapper instanceof Byte) return Byte.TYPE;
00020 if (wrapper instanceof Double) return Double.TYPE;
00021 if (wrapper instanceof Float) return Float.TYPE;
00022 if (wrapper instanceof Integer) return Integer.TYPE;
00023 if (wrapper instanceof Long) return Long.TYPE;
00024 if (wrapper instanceof Short) return Short.TYPE;
00025 throw new RuntimeException("Bad BasicTypeWrapper:"+wrapper);
00026 }
00027 public BasicTypeWrapper(Object w){
00028 wrapper=w;
00029 }
00030 public String toString(){return "BasicTypeWrapper:"+wrapper.toString();}
00031
00032 public static boolean instanceOfWrapper(Object x){
00033 if (x instanceof Boolean) return true;
00034 else if (x instanceof Character) return true;
00035 else if (x instanceof Byte) return true;
00036 else if (x instanceof Double) return true;
00037 else if (x instanceof Float) return true;
00038 else if (x instanceof Integer) return true;
00039 else if (x instanceof Long) return true;
00040 else if (x instanceof Short) return true;
00041 else return false;
00042 }
00043 }