Commits

John Marsden committed 305e311

Updates. Do not use this version to marshal - unit tests are not in place.

Comments (0)

Files changed (12)

src/main/java/cc/plural/jsonij/marshal/JSONDocumentMarshaler.java

 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javax.print.DocFlavor.STRING;
 import cc.plural.jsonij.JSON;
 import cc.plural.jsonij.Value;
 import cc.plural.jsonij.parser.ParserException;
-import cc.plural.jsonij.reflect.JavaType;
+import cc.plural.jsonij.reflect.ReflectType;
 
 /**
  *
     }
 
     private void marshalDocumentToObject(Class<?> objectClass, Object object, Value propertyValue, InspectorProperty property) throws NoSuchMethodException, IllegalArgumentException, IllegalAccessException, JSONMarshalerException, InvocationTargetException, NoSuchFieldException {
-        JavaType mutateType = JavaType.inspectObjectType(property.getMutateInputType());
+        ReflectType mutateType = ReflectType.inspectObjectType(property.getMutateInputType());
         if(property.getAccessPropertyType() == InspectorProperty.TYPE.METHOD) {
             Method method = objectClass.getMethod(property.getMutateName(), property.getMutateInputType());
             JSON.Array<Value> arrayJSON;

src/main/java/cc/plural/jsonij/marshal/JavaMarshaler.java

 
 import cc.plural.jsonij.JSON;
 import cc.plural.jsonij.Value;
-import cc.plural.jsonij.reflect.JavaType;
+import cc.plural.jsonij.reflect.ReflectType;
 
 /**
  *
  */
 public class JavaMarshaler {
 
-    JavaObjectMarshaler javaObjectMarshaler;
+    JavaMarshalerObjects javaObjectMarshaler;
 
     public JavaMarshaler() {
-        javaObjectMarshaler = new JavaObjectMarshaler(this);
+        javaObjectMarshaler = new JavaMarshalerObjects(this);
     }
 
     public Value marshalObject(Object o) {
         }
         Value marshaledObject = null;
         Class<?> objectClass = o.getClass();
-        JavaType objectType = JavaType.inspectObjectType(objectClass);
+        ReflectType objectType = ReflectType.inspectObjectType(objectClass);
         switch(objectType) {
             case BOOLEAN:
                 marshaledObject = marshalJavaBoolean(o);

src/main/java/cc/plural/jsonij/marshal/JavaMarshalerObjects.java

+/*
+ *  Copyright 2011 jmarsden.
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  under the License.
+ */
+package cc.plural.jsonij.marshal;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import cc.plural.jsonij.JSON;
+import cc.plural.jsonij.Value;
+import cc.plural.jsonij.marshal.JavaMarshaler.CycleDetector;
+import cc.plural.jsonij.marshal.annotation.JSONCollector;
+import cc.plural.jsonij.marshal.annotation.JSONEncoder;
+import cc.plural.jsonij.reflect.ClassProperty;
+import cc.plural.jsonij.reflect.ClassProperty.ClassPropertyAccessor;
+import cc.plural.jsonij.reflect.Inspection;
+import cc.plural.jsonij.reflect.ReflectType;
+
+/**
+ *
+ * @author jmarsden
+ */
+public class JavaMarshalerObjects {
+
+    protected JavaMarshaler marshaler;
+
+    static JSONCodecStore codecStore;
+
+    static int cycleLevels;
+
+    static {
+        cycleLevels = 0;
+    }
+
+    public JavaMarshalerObjects(JavaMarshaler marshaler) {
+        this.marshaler = marshaler;
+    }
+    
+    public Value marshalJavaObject(Object o, CycleDetector cycleDetector) {
+        Class<?> objectClass = o.getClass();
+        // Check for JSONEncoder Annotation
+        Method[] methods = objectClass.getDeclaredMethods();
+        for(Method method : methods) {
+            if(method.getAnnotation(JSONEncoder.class) != null) {
+                // TODO: Encode using method.
+            }
+        }
+
+        Field[] fields = objectClass.getFields();
+        for(Field field : fields) {
+            if(field.getAnnotation(JSONCollector.class) != null) {
+            }
+        }
+
+        // Check for JSONCodec
+        if(codecStore != null && codecStore.hasCodec(objectClass)) {
+            @SuppressWarnings("rawtypes")
+            JSONCodec codec = codecStore.getCodec(objectClass);
+            @SuppressWarnings("unchecked")
+            Value value = codec.encode(o);
+            return value;
+        }
+
+        // Find an object inspector
+        Inspection inspection = ReflectType.getInspection(objectClass);
+
+        HashMap<String, Value> valueCollector = new HashMap<String, Value>();
+        List<ClassProperty> properties = inspection.getProperties();
+        String name = null;
+        Value value;
+        int propCount = 0;
+        for (ClassProperty property : properties) {
+            ClassPropertyAccessor accessor = property.getAccessor();
+            if (accessor == null || !accessor.canAccess()) {
+                continue;
+            }
+            if (accessor.fieldType()) {
+                try {
+                    Field field = property.getAccessor().getField();
+                    value = marshalObjectFieldValue(field, o, cycleDetector);
+                    if(value == null) {
+                        continue;
+                    }
+                } catch(Exception ex) {
+                    value = new JSON.String(ex.toString());
+                }
+            } else if (accessor.methodType()) {
+                try {
+                    Method method = property.getAccessor().getMethod();
+                    value = marshalObjectMethodValue(method, o, cycleDetector);
+                    if(value == null) {
+                        continue;
+                    }
+                } catch(Exception ex) {
+                    value = new JSON.String(ex.toString());
+                }
+            } else {
+                value = JSON.NULL;
+            }
+            propCount++;
+            valueCollector.put(name, value);
+        }
+        if (inspection.hasInnerList()) {
+            if (propCount > 0) {
+                valueCollector.put(JSONMarshaler.INNER_ARRAY_PROPERTY, marshaler.marshalJavaList(o, cycleDetector));
+            } else {
+                return marshaler.marshalJavaList(o, cycleDetector);
+            }
+        }
+        if (inspection.hasInnerMap()) {
+            if (propCount > 0) {
+                valueCollector.put(JSONMarshaler.INNER_OBJECT_PROPERTY, marshaler.marshalJavaMap(o, cycleDetector));
+            } else {
+                return marshaler.marshalJavaMap(o, cycleDetector);
+            }
+        }
+        if(valueCollector.isEmpty()) {
+            return null;
+        } else {
+            JSON.Object<JSON.String, Value> marshaledObject = new JSON.Object<JSON.String, Value>();
+            Iterator<String> keySetIterator = valueCollector.keySet().iterator();
+            while(keySetIterator.hasNext()) {
+                String key = keySetIterator.next();
+                marshaledObject.put(new JSON.String(key), valueCollector.get(key));
+            }
+            return marshaledObject;
+        }
+    }
+
+    protected Value marshalObjectMethodValue(Method method, Object o, CycleDetector cycleDetector) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+        Value value;
+        Object marshaledObject = method.invoke(o);
+        if(marshaledObject == null) {
+            value = null;
+        } else {
+            int hashCode = marshaledObject.hashCode();
+            if(marshaledObject.getClass() == Boolean.class
+                    || marshaledObject.getClass() == Byte.class
+                    || marshaledObject.getClass() == Short.class
+                    || marshaledObject.getClass() == Integer.class
+                    || marshaledObject.getClass() == Float.class
+                    || marshaledObject.getClass() == Double.class
+                    || marshaledObject.getClass() == Long.class
+                    || marshaledObject.getClass() == String.class) {
+                value = marshaler.marshalAnyObject(marshaledObject, cycleDetector.cloneCycleDetector());
+            } else if(!cycleDetector.hashDetected(hashCode) || cycleDetector.getHashCount(hashCode) < JavaMarshalerObjects.getCycleLevels()) {
+                cycleDetector.addHash(hashCode);
+                value = marshaler.marshalAnyObject(marshaledObject, cycleDetector.cloneCycleDetector());
+            } else {
+                value = null;
+            }
+        }
+        return value;
+    }
+
+    protected Value marshalObjectFieldValue(Field field, Object o, CycleDetector cycleDetector) throws IllegalArgumentException, IllegalAccessException {
+        Value value = null;
+        Object marshaledObject = field.get(o);
+        if(marshaledObject == null) {
+            value = null;
+        } else {
+            int hashCode = marshaledObject.hashCode();
+            if(marshaledObject.getClass() == Boolean.class
+                    || marshaledObject.getClass() == Byte.class
+                    || marshaledObject.getClass() == Short.class
+                    || marshaledObject.getClass() == Integer.class
+                    || marshaledObject.getClass() == Float.class
+                    || marshaledObject.getClass() == Double.class
+                    || marshaledObject.getClass() == Long.class
+                    || marshaledObject.getClass() == String.class) {
+                value = marshaler.marshalAnyObject(marshaledObject, cycleDetector.cloneCycleDetector());
+            } else if(!cycleDetector.hashDetected(hashCode) || cycleDetector.getHashCount(hashCode) < JavaMarshalerObjects.getCycleLevels()) {
+                cycleDetector.addHash(hashCode);
+                value = marshaler.marshalAnyObject(marshaledObject, cycleDetector.cloneCycleDetector());
+            } else {
+                value = null;
+            }
+        }
+        return value;
+    }
+
+    public static boolean hasCodec(Class<?> codecType) {
+        if(codecStore == null) {
+            return false;
+        } else {
+            return codecStore.hasCodec(codecType);
+        }
+    }
+
+    public static void registerCodec(Class<?> codecClass) {
+        if(codecStore == null) {
+            codecStore = new JSONCodecStore();
+        }
+        codecStore.registerCodec(codecClass);
+    }
+
+    public static JSONCodec<?> getCodec(Class<?> codecType) {
+        if(codecStore == null) {
+            return null;
+        } else {
+            return codecStore.getCodec(codecType);
+        }
+    }
+
+    public static int getCycleLevels() {
+        return cycleLevels;
+    }
+
+    public static void setCycleLevels(int levels) {
+        cycleLevels = levels;
+    }
+}

src/main/java/cc/plural/jsonij/marshal/JavaObjectMarshaler.java

-/*
- *  Copyright 2011 jmarsden.
- * 
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- * 
- *       http://www.apache.org/licenses/LICENSE-2.0
- * 
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *  under the License.
- */
-package cc.plural.jsonij.marshal;
-
-import cc.plural.jsonij.reflect.JavaType;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import cc.plural.jsonij.JSON;
-import cc.plural.jsonij.Value;
-import cc.plural.jsonij.marshal.JavaMarshaler.CycleDetector;
-import cc.plural.jsonij.marshal.annotation.JSONCollector;
-import cc.plural.jsonij.marshal.annotation.JSONEncoder;
-import cc.plural.jsonij.reflect.ClassProperty;
-import cc.plural.jsonij.reflect.ClassProperty.ClassPropertyAccessor;
-import cc.plural.jsonij.reflect.Inspection;
-
-/**
- *
- * @author jmarsden
- */
-public class JavaObjectMarshaler {
-
-    protected JavaMarshaler marshaler;
-
-    final protected Map<Class<?>, Inspector> inspectedClasses;
-
-    static JSONCodecStore codecStore;
-
-    static int cycleLevels;
-
-    static {
-        cycleLevels = 0;
-    }
-
-    public JavaObjectMarshaler(JavaMarshaler marshaler) {
-        this.marshaler = marshaler;
-        inspectedClasses = new HashMap<Class<?>, Inspector>();
-    }
-
-    /*
-    public boolean isObjectType(Class<?> objectClass) {
-        Inspector inspector = null;//JavaType.getInstpector(objectClass);
-        InspectorProperty[] properties = inspector.getProperties();
-        if((properties != null && Array.getLength(properties) > 0) || inspector.hasInnerArray() || inspector.hasInnerObject()) {
-            return true;
-        }
-        return false;
-    }
-    */
-    
-    public Value marshalJavaObject(Object o, CycleDetector cycleDetector) {
-        Class<?> objectClass = o.getClass();
-        // Check for JSONEncoder Annotation
-        Method[] methods = objectClass.getDeclaredMethods();
-        for(Method method : methods) {
-            if(method.getAnnotation(JSONEncoder.class) != null) {
-                // TODO: Encode using method.
-            }
-        }
-
-        Field[] fields = objectClass.getFields();
-        for(Field field : fields) {
-            if(field.getAnnotation(JSONCollector.class) != null) {
-            }
-        }
-
-        // Check for JSONCodec
-        if(codecStore != null && codecStore.hasCodec(objectClass)) {
-            @SuppressWarnings("rawtypes")
-            JSONCodec codec = codecStore.getCodec(objectClass);
-            @SuppressWarnings("unchecked")
-            Value value = codec.encode(o);
-            return value;
-        }
-
-        // Find an object inspector
-        Inspection inspection = JavaType.getInspection(objectClass);
-
-        HashMap<String, Value> valueCollector = new HashMap<String, Value>();
-        List<ClassProperty> properties = inspection.getProperties();
-        String name = null;
-        Value value;
-        int propCount = 0;
-        for (ClassProperty property : properties) {
-            ClassPropertyAccessor accessor = property.getAccessor();
-            if (accessor == null || !accessor.canAccess()) {
-                continue;
-            }
-            if (accessor.methodType()) {
-                try {
-                    Method method = property.getAccessor().getMethod();
-                    value = marshalObjectMethodValue(method, o, cycleDetector);
-                    if(value == null) {
-                        continue;
-                    }
-                } catch(Exception ex) {
-                    value = new JSON.String(ex.toString());
-                }
-            } else if (accessor.fieldType()) {
-                try {
-                    Field field = property.getAccessor().getField();
-                    value = marshalObjectFieldValue(field, o, cycleDetector);
-                    if(value == null) {
-                        continue;
-                    }
-                } catch(Exception ex) {
-                    value = new JSON.String(ex.toString());
-                }
-            } else {
-                value = JSON.NULL;
-            }
-            propCount++;
-            valueCollector.put(name, value);
-        }
-        if (inspection.hasInnerList()) {
-            if (propCount > 0) {
-                valueCollector.put("innerArray", marshaler.marshalJavaList(o, cycleDetector));
-            } else {
-                return marshaler.marshalJavaList(o, cycleDetector);
-            }
-        }
-        if (inspection.hasInnerMap()) {
-            if (propCount > 0) {
-                valueCollector.put("innerObject", marshaler.marshalJavaMap(o, cycleDetector));
-            } else {
-                return marshaler.marshalJavaMap(o, cycleDetector);
-            }
-        }
-        if(valueCollector.isEmpty()) {
-            return null;
-        } else {
-            JSON.Object<JSON.String, Value> marshaledObject = new JSON.Object<JSON.String, Value>();
-            Iterator<String> keySetIterator = valueCollector.keySet().iterator();
-            while(keySetIterator.hasNext()) {
-                String key = keySetIterator.next();
-                marshaledObject.put(new JSON.String(key), valueCollector.get(key));
-            }
-            return marshaledObject;
-        }
-    }
-
-    protected Value marshalObjectMethodValue(Method method, Object o, CycleDetector cycleDetector) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-        Value value;
-        Object marshaledObject = method.invoke(o);
-        if(marshaledObject == null) {
-            value = null;
-        } else {
-            int hashCode = marshaledObject.hashCode();
-            if(marshaledObject.getClass() == Boolean.class
-                    || marshaledObject.getClass() == Byte.class
-                    || marshaledObject.getClass() == Short.class
-                    || marshaledObject.getClass() == Integer.class
-                    || marshaledObject.getClass() == Float.class
-                    || marshaledObject.getClass() == Double.class
-                    || marshaledObject.getClass() == Long.class
-                    || marshaledObject.getClass() == String.class) {
-                value = marshaler.marshalAnyObject(marshaledObject, cycleDetector.cloneCycleDetector());
-            } else if(!cycleDetector.hashDetected(hashCode) || cycleDetector.getHashCount(hashCode) < JavaObjectMarshaler.getCycleLevels()) {
-                cycleDetector.addHash(hashCode);
-                value = marshaler.marshalAnyObject(marshaledObject, cycleDetector.cloneCycleDetector());
-            } else {
-                value = null;
-            }
-        }
-        return value;
-    }
-
-    protected Value marshalObjectFieldValue(Field field, Object o, CycleDetector cycleDetector) throws IllegalArgumentException, IllegalAccessException {
-        Value value = null;
-        Object marshaledObject = field.get(o);
-        if(marshaledObject == null) {
-            value = null;
-        } else {
-            int hashCode = marshaledObject.hashCode();
-            if(marshaledObject.getClass() == Boolean.class
-                    || marshaledObject.getClass() == Byte.class
-                    || marshaledObject.getClass() == Short.class
-                    || marshaledObject.getClass() == Integer.class
-                    || marshaledObject.getClass() == Float.class
-                    || marshaledObject.getClass() == Double.class
-                    || marshaledObject.getClass() == Long.class
-                    || marshaledObject.getClass() == String.class) {
-                value = marshaler.marshalAnyObject(marshaledObject, cycleDetector.cloneCycleDetector());
-            } else if(!cycleDetector.hashDetected(hashCode) || cycleDetector.getHashCount(hashCode) < JavaObjectMarshaler.getCycleLevels()) {
-                cycleDetector.addHash(hashCode);
-                value = marshaler.marshalAnyObject(marshaledObject, cycleDetector.cloneCycleDetector());
-            } else {
-                value = null;
-            }
-        }
-        return value;
-    }
-
-    public static boolean hasCodec(Class<?> codecType) {
-        if(codecStore == null) {
-            return false;
-        } else {
-            return codecStore.hasCodec(codecType);
-        }
-    }
-
-    public static void registerCodec(Class<?> codecClass) {
-        if(codecStore == null) {
-            codecStore = new JSONCodecStore();
-        }
-        codecStore.registerCodec(codecClass);
-    }
-
-    public static JSONCodec<?> getCodec(Class<?> codecType) {
-        if(codecStore == null) {
-            return null;
-        } else {
-            return codecStore.getCodec(codecType);
-        }
-    }
-
-    public static int getCycleLevels() {
-        return cycleLevels;
-    }
-
-    public static void setCycleLevels(int levels) {
-        cycleLevels = levels;
-    }
-}

src/main/java/cc/plural/jsonij/reflect/ClassProperty.java

     }
 
     public boolean isValid() {
-        return true;
+        if(mutator != null && accessor != null && mutator.canAccess() && accessor.canAccess()) {
+            return true;
+        }
+        return false;
     }
 
     @Override
             builder.append(']');
             return builder.toString();
         }
+        
+        public boolean canAccess() {
+            if(field != null && Modifier.isPublic(field.getModifiers())) {
+                return true;
+            }
+            if(method != null && Modifier.isPublic(method.getModifiers())) {
+                return true;
+            }
+            return false;
+        }
+
+        public boolean fieldType() {
+            if(field != null && Modifier.isPublic(field.getModifiers())) {
+                return true;
+            }
+            return false;
+        }
+
+        public boolean methodType() {
+            if(method != null && Modifier.isPublic(method.getModifiers())) {
+                return true;
+            }
+            return false;
+        }
     }
 
     public static String getModifierString(int modifiers) {

src/main/java/cc/plural/jsonij/reflect/InspectionFactory.java

         if(klass == null) {
             throw new NullPointerException();
         }
+        List<ClassProperty> tempProperties = new ArrayList<ClassProperty>();
         List<ClassProperty> classProperties = new ArrayList<ClassProperty>();
         Class<?> currentClass = klass;
         do {
             }
             List<ClassProperty> currentClassProperties = inspectClassProperties(currentClass);
             for(ClassProperty currentClassProperty: currentClassProperties) {
-                if(!classProperties.contains(currentClassProperty)) {
-                    classProperties.add(currentClassProperty);
+                if(!tempProperties.contains(currentClassProperty)) {
+                    tempProperties.add(currentClassProperty);
                 } else {
                     // TODO: Some kind of merge.
                 }
             }
         } while((currentClass = currentClass.getSuperclass()) != null);
 
-        for(ClassProperty property : classProperties) {
-            if(!property.isValid()) {
-                classProperties.remove(property);
+        for(ClassProperty property : tempProperties) {
+            if(property.isValid() && !classProperties.contains(property)) {
+                classProperties.add(property);
             }
         }
 
         Inspection inspection = new Inspection();
         inspection.setKlass(klass);
-        inspection.setProperties(classProperties);
+        inspection.setProperties(tempProperties);
+        inspection.setInnerList(isListType(klass));
+        inspection.setInnerMap(isMapType(klass));
         return inspection;
     }
 
         propertyList.addAll(propertyMap.values());
         return propertyList;
     }
+
+   public static boolean isMapType(Class<?> c) {
+        Class<?> currentClass = c;
+        do {
+            Class<?>[] interfaces = currentClass.getInterfaces();
+            for(Class<?> i : interfaces) {
+                if(i == Map.class) {
+                    return true;
+                }
+            }
+        } while((currentClass = currentClass.getSuperclass()) != null);
+        return false;
+    }
+
+    public static boolean isListType(Class<?> c) {
+        Class<?> currentClass = c;
+        do {
+            Class<?>[] interfaces = currentClass.getInterfaces();
+            for(Class<?> i : interfaces) {
+                if(i == List.class) {
+                    return true;
+                }
+            }
+        } while((currentClass = currentClass.getSuperclass()) != null);
+        return false;
+    }
 }

src/main/java/cc/plural/jsonij/reflect/JavaType.java

-/*
- * Copyright 2011 jmarsden.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package cc.plural.jsonij.reflect;
-
-import java.lang.reflect.Array;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * JavaType Utility. Queries objects for their types and manages inspector
- * instances so time is not wasted re-inspecting the same objects.
- *
- * Inspecting is the task of reflecting attributes and methods and their
- * types for access.
- *
- * @author jmarsden@plural.cc
- */
-public enum JavaType {
-
-    /**
-     * The JavaTypes possible for an inspection.
-     * UNKNOWN will be returned where an object cannot be decided.
-     * ARRAY will be returned for an array of Objects.
-     */
-    BOOLEAN,
-    BYTE,
-    SHORT,
-    INTEGER,
-    FLOAT,
-    DOUBLE,
-    LONG,
-    STRING,
-    LIST,
-    OBJECT,
-    MAP,
-    ENUM,
-    ARRAY,
-    ARRAY_BOOLEAN,
-    ARRAY_BYTE,
-    ARRAY_SHORT,
-    ARRAY_INTEGER,
-    ARRAY_FLOAT,
-    ARRAY_DOUBLE,
-    ARRAY_LONG,
-    ARRAY_STRING,
-    ARRAY_ENUM,
-    // HMMN
-    ARRAY_LIST,
-    ARRAY_MAP,
-    ARRAY_ARRAY,
-    UNKOWN;
-
-    boolean primitive;
-
-    JavaArrayType arrayType;
-
-    static final protected InspectionFactory inspectionFactory;
-    
-    static final protected Map<Class<?>, Inspection> inspectedClasses;
-
-    static {
-        inspectionFactory = new InspectionFactory();
-        inspectedClasses = new HashMap<Class<?>, Inspection>();
-    }
-
-    JavaType() {
-        primitive = true;
-    }
-
-    public void setPrimitive(boolean primitive) {
-        this.primitive = primitive;
-    }
-
-    public boolean isPrimitive() {
-        return this.primitive;
-    }
-
-    public static JavaType inspectObjectType(Class<?> c) {
-        JavaType type = null;
-        if(c == boolean.class) {
-            type = JavaType.BOOLEAN;
-            type.setPrimitive(true);
-            return type;
-        } else if(c == Boolean.class) {
-            type = JavaType.BOOLEAN;
-            type.setPrimitive(false);
-            return type;
-        } else if(c == int.class) {
-            type = JavaType.INTEGER;
-            type.setPrimitive(true);
-            return type;
-        } else if(c == Integer.class) {
-            type = JavaType.INTEGER;
-            type.setPrimitive(false);
-            return type;
-        } else if(c == double.class) {
-            type = JavaType.DOUBLE;
-            type.setPrimitive(true);
-            return type;
-        } else if(c == Double.class) {
-            type = JavaType.DOUBLE;
-            type.setPrimitive(false);
-            return type;
-        } else if(c == float.class) {
-            type = JavaType.FLOAT;
-            type.setPrimitive(true);
-            return type;
-        } else if(c == Float.class) {
-            type = JavaType.FLOAT;
-            type.setPrimitive(false);
-            return type;
-        } else if(c == long.class) {
-            type = JavaType.LONG;
-            type.setPrimitive(true);
-            return type;
-        } else if(c == Long.class) {
-            type = JavaType.LONG;
-            type.setPrimitive(false);
-            return type;
-        } else if(c == short.class) {
-            type = JavaType.SHORT;
-            type.setPrimitive(true);
-            return type;
-        } else if(c == Short.class) {
-            type = JavaType.SHORT;
-            type.setPrimitive(false);
-            return type;
-        } else if(c == byte.class) {
-            type = JavaType.BYTE;
-            type.setPrimitive(true);
-            return type;
-        } else if(c == Byte.class) {
-            type = JavaType.BYTE;
-            type.setPrimitive(false);
-            return type;
-        } else if(c.isEnum()) {
-            type = JavaType.ENUM;
-            type.setPrimitive(false);
-            return type;
-        } else if(c == String.class || ((c == char.class || c == Character.class))) {
-            type = JavaType.STRING;
-            type.setPrimitive(false);
-            return type;
-        } else if(c.isArray()) {
-            type = getArrayType(c);
-            return type;
-        }
-        if(type == null) {
-            if(c == List.class) {
-                type = JavaType.LIST;
-                type.setPrimitive(false);
-                return type;
-            } else {
-                // Test if Object is a List
-                Class<?>[] interfaces = c.getInterfaces();
-                for(int i = 0; i < Array.getLength(interfaces); i++) {
-                    if(interfaces[i] == List.class) {
-                        type = JavaType.LIST;
-                        type.setPrimitive(false);
-                        return type;
-                    }
-                }
-            }
-            Class<?>[] interfaces = c.getInterfaces();
-            // Test if super classes are List
-            Class<?> parent = c.getSuperclass();
-            if(parent != null) {
-                do {
-                    interfaces = parent.getInterfaces();
-                    for(int i = 0; i < Array.getLength(interfaces); i++) {
-                        if(interfaces[i] == List.class) {
-                            type = JavaType.LIST;
-                            return type;
-                        }
-                    }
-                } while((parent = parent.getSuperclass()) != null);
-            }
-        }
-        if(type == null) {
-            if(c == Map.class) {
-                type = JavaType.MAP;
-                type.setPrimitive(false);
-                return type;
-            } else {
-                // Test if Object is a List
-                Class<?>[] interfaces = c.getInterfaces();
-                for(int i = 0; i < Array.getLength(interfaces); i++) {
-                    if(interfaces[i] == Map.class) {
-                        type = JavaType.MAP;
-                        type.setPrimitive(false);
-                        return type;
-                    }
-                }
-            }
-            Class<?>[] interfaces = c.getInterfaces();
-            Class<?> parent = c.getSuperclass();
-            if(parent != null) {
-                do {
-                    interfaces = parent.getInterfaces();
-                    for(int i = 0; i < Array.getLength(interfaces); i++) {
-                        if(interfaces[i] == Map.class) {
-                            type = JavaType.MAP;
-                            return type;
-                        }
-                    }
-                } while((parent = parent.getSuperclass()) != null);
-            }
-        }
-        if(c.getComponentType() ==  Class.class) {
-            type = JavaType.OBJECT;
-            return type;
-        }
-         
-        if(type == null) {
-            if(isObjectType(c)) {
-                type = JavaType.OBJECT;
-                type.setPrimitive(false);
-                return type;
-            }
-            
-        }
-        if(type != null) {
-            return type;
-        } else {
-            return JavaType.UNKOWN;
-        }
-    }
-
-    public static Inspection getInspection(Class<?> objectClass) {
-        Inspection inspection = null;
-        synchronized(inspectedClasses) {
-            if(inspectedClasses.containsKey(objectClass)) {
-                inspection = inspectedClasses.get(objectClass);
-            } else {
-                inspection = inspectionFactory.inspect(objectClass);
-                inspectedClasses.put(objectClass, inspection);
-            }
-        }
-        return inspection;
-    }
-
-    public static boolean isObjectType(Class<?> objectClass) {
-        Inspection inspection = getInspection(objectClass);
-        List<ClassProperty> properties = inspection.getProperties();
-        if((properties != null && !properties.isEmpty()) || inspection.isInnerList()|| inspection.isInnerMap()) {
-            return true;
-        }
-        return false;
-    }
-
-    @SuppressWarnings("unused")
-    public static JavaType getArrayType(Class<?> objectClass) {
-        JavaType resultType = null;
-        Class<?> objectComponentType = objectClass.getComponentType();
-
-        if(!objectComponentType.isArray()) {
-
-
-            JavaType componentType = inspectObjectType(objectComponentType);
-            //resultType.arrayType = new JavaArrayType(objectClass);
-            switch(componentType) {
-                case BOOLEAN:
-                    resultType = JavaType.ARRAY_BOOLEAN;
-                    resultType.setPrimitive(componentType.isPrimitive());
-                    break;
-                case BYTE:
-                    resultType = JavaType.ARRAY_BYTE;
-                    resultType.setPrimitive(componentType.isPrimitive());
-                    break;
-                case INTEGER:
-                    resultType = JavaType.ARRAY_INTEGER;
-                    resultType.setPrimitive(componentType.isPrimitive());
-                    break;
-                case SHORT:
-                    resultType = JavaType.ARRAY_SHORT;
-                    resultType.setPrimitive(componentType.isPrimitive());
-                    break;
-                case FLOAT:
-                    resultType = JavaType.ARRAY_FLOAT;
-                    resultType.setPrimitive(componentType.isPrimitive());
-                    break;
-                case LONG:
-                    resultType = JavaType.ARRAY_LONG;
-                    resultType.setPrimitive(componentType.isPrimitive());
-                    break;
-                case DOUBLE:
-                    resultType = JavaType.ARRAY_DOUBLE;
-                    resultType.setPrimitive(componentType.isPrimitive());
-                    break;
-                case STRING:
-                    resultType = JavaType.ARRAY_STRING;
-                    resultType.setPrimitive(componentType.isPrimitive());
-                    break;
-                case ENUM:
-                    resultType = JavaType.ARRAY_ENUM;
-                    resultType.setPrimitive(componentType.isPrimitive());
-                    break;
-                case MAP:
-                    resultType = JavaType.ARRAY_MAP;
-                    resultType.setPrimitive(componentType.isPrimitive());
-                    break;
-                case LIST:
-                    resultType = JavaType.ARRAY_LIST;
-                    resultType.setPrimitive(componentType.isPrimitive());
-                    break;
-                case OBJECT:
-                    resultType = JavaType.ARRAY;
-                    resultType.setPrimitive(componentType.isPrimitive());
-                    break;
-            }
-        } else {
-            resultType = JavaType.ARRAY_ARRAY;
-            resultType.setPrimitive(false);
-        }
-
-        if(resultType != null) {
-            return resultType;
-        } else {
-            return JavaType.UNKOWN;
-        }
-    }
-
-    public static class JavaArrayType {
-
-        Class<?> arrayType;
-
-        int dimension;
-
-        public JavaArrayType(Class<?> arrayType) {
-            this.arrayType = arrayType;
-            dimension = 0;
-            this.inspect();
-        }
-
-        public final void inspect() {
-            if(arrayType != null && arrayType.isArray()) {
-                Class<?> innerType = arrayType.getComponentType();
-                dimension = 1;
-                while(innerType.isArray() && (innerType = arrayType.getComponentType()) != null) {
-                    dimension++;
-                }
-            }
-        }
-
-        @Override
-        public String toString() {
-            return "Array " + arrayType.getSimpleName() + "[" + dimension + "]";
-        }
-    }
-}

src/main/java/cc/plural/jsonij/reflect/ReflectType.java

+/*
+ * Copyright 2011 jmarsden.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cc.plural.jsonij.reflect;
+
+import java.lang.reflect.Array;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import cc.plural.jsonij.marshal.JSONMarshaler;
+
+/**
+ * JavaType Utility. Queries objects for their types and manages inspector
+ * instances so time is not wasted re-inspecting the same objects.
+ *
+ * Inspecting is the task of reflecting attributes and methods and their
+ * types for access.
+ *
+ * @author jmarsden@plural.cc
+ */
+public enum ReflectType {
+
+    /**
+     * The JavaTypes possible for an inspection.
+     * UNKNOWN will be returned where an object cannot be decided.
+     * ARRAY will be returned for an array of Objects.
+     */
+    BOOLEAN,
+    BYTE,
+    SHORT,
+    INTEGER,
+    FLOAT,
+    DOUBLE,
+    LONG,
+    STRING,
+    LIST,
+    OBJECT,
+    MAP,
+    ENUM,
+    ARRAY,
+    ARRAY_BOOLEAN,
+    ARRAY_BYTE,
+    ARRAY_SHORT,
+    ARRAY_INTEGER,
+    ARRAY_FLOAT,
+    ARRAY_DOUBLE,
+    ARRAY_LONG,
+    ARRAY_STRING,
+    ARRAY_ENUM,
+    // HMMN
+    ARRAY_LIST,
+    ARRAY_MAP,
+    ARRAY_ARRAY,
+    UNKOWN;
+
+    boolean primitive;
+
+    JavaArrayType arrayType;
+
+    static final protected InspectionFactory inspectionFactory;
+    
+    static final protected Map<Class<?>, Inspection> inspectedClasses;
+
+    static {
+        inspectionFactory = new InspectionFactory();
+        inspectedClasses = new HashMap<Class<?>, Inspection>();
+    }
+
+    ReflectType() {
+        primitive = true;
+    }
+
+    public void setPrimitive(boolean primitive) {
+        this.primitive = primitive;
+    }
+
+    public boolean isPrimitive() {
+        return this.primitive;
+    }
+
+    public static ReflectType inspectObjectType(Class<?> c) {
+        ReflectType type = null;
+        if(c == boolean.class) {
+            type = BOOLEAN;
+            type.setPrimitive(true);
+            return type;
+        } else if(c == Boolean.class) {
+            type = BOOLEAN;
+            type.setPrimitive(false);
+            return type;
+        } else if(c == int.class) {
+            type = INTEGER;
+            type.setPrimitive(true);
+            return type;
+        } else if(c == Integer.class) {
+            type = INTEGER;
+            type.setPrimitive(false);
+            return type;
+        } else if(c == double.class) {
+            type = DOUBLE;
+            type.setPrimitive(true);
+            return type;
+        } else if(c == Double.class) {
+            type = DOUBLE;
+            type.setPrimitive(false);
+            return type;
+        } else if(c == float.class) {
+            type = FLOAT;
+            type.setPrimitive(true);
+            return type;
+        } else if(c == Float.class) {
+            type = FLOAT;
+            type.setPrimitive(false);
+            return type;
+        } else if(c == long.class) {
+            type = LONG;
+            type.setPrimitive(true);
+            return type;
+        } else if(c == Long.class) {
+            type = LONG;
+            type.setPrimitive(false);
+            return type;
+        } else if(c == short.class) {
+            type = SHORT;
+            type.setPrimitive(true);
+            return type;
+        } else if(c == Short.class) {
+            type = SHORT;
+            type.setPrimitive(false);
+            return type;
+        } else if(c == byte.class) {
+            type = BYTE;
+            type.setPrimitive(true);
+            return type;
+        } else if(c == Byte.class) {
+            type = BYTE;
+            type.setPrimitive(false);
+            return type;
+        } else if(c.isEnum()) {
+            type = ENUM;
+            type.setPrimitive(false);
+            return type;
+        } else if(c == String.class || ((c == char.class || c == Character.class))) {
+            type = STRING;
+            type.setPrimitive(false);
+            return type;
+        } else if(c.isArray()) {
+            type = getArrayType(c);
+            return type;
+        }
+        
+        if(c == List.class) {
+            return LIST;
+        }
+        if(c == Map.class) {
+            return MAP;
+        }
+        
+        Class<?>[] interfaces;
+        Class<?> currentClass = c;
+        
+        do {
+            interfaces = currentClass.getInterfaces();
+            for(int i = 0; i < Array.getLength(interfaces); i++) {
+                if(interfaces[i] == List.class) {
+                    type = LIST;
+                } else if(interfaces[i] == Map.class) {
+                    type = MAP;
+                }
+            }
+        } while((currentClass = currentClass.getSuperclass()) != null);
+
+        if((JSONMarshaler.ALWAYS_USE_INNER_PROPERTY && (type!=null)) || isObjectType(c)) {
+            type = OBJECT;
+            type.setPrimitive(false);
+            return type;
+        } 
+        if(c.getComponentType() == Class.class) {
+            type = OBJECT;
+            return type;
+        }
+        if(type != null) {
+            return type;
+        } else {
+            return UNKOWN;
+        }
+    }
+
+    public static Inspection getInspection(Class<?> objectClass) {
+        Inspection inspection = null;
+        synchronized(inspectedClasses) {
+            if(inspectedClasses.containsKey(objectClass)) {
+                inspection = inspectedClasses.get(objectClass);
+            } else {
+                inspection = inspectionFactory.inspect(objectClass);
+                inspectedClasses.put(objectClass, inspection);
+            }
+        }
+        return inspection;
+    }
+
+    public static boolean isObjectType(Class<?> objectClass) {
+        Inspection inspection = getInspection(objectClass);
+        List<ClassProperty> properties = inspection.getProperties();
+        if((properties != null && !properties.isEmpty())/* || inspector.hasInnerArray() || inspector.hasInnerObject() */) {
+            return true;
+        }
+        return false;
+    }
+
+    @SuppressWarnings("unused")
+    public static ReflectType getArrayType(Class<?> objectClass) {
+        ReflectType resultType = null;
+        Class<?> objectComponentType = objectClass.getComponentType();
+
+        if(!objectComponentType.isArray()) {
+
+
+            ReflectType componentType = inspectObjectType(objectComponentType);
+            //resultType.arrayType = new JavaArrayType(objectClass);
+            switch(componentType) {
+                case BOOLEAN:
+                    resultType = ReflectType.ARRAY_BOOLEAN;
+                    resultType.setPrimitive(componentType.isPrimitive());
+                    break;
+                case BYTE:
+                    resultType = ReflectType.ARRAY_BYTE;
+                    resultType.setPrimitive(componentType.isPrimitive());
+                    break;
+                case INTEGER:
+                    resultType = ReflectType.ARRAY_INTEGER;
+                    resultType.setPrimitive(componentType.isPrimitive());
+                    break;
+                case SHORT:
+                    resultType = ReflectType.ARRAY_SHORT;
+                    resultType.setPrimitive(componentType.isPrimitive());
+                    break;
+                case FLOAT:
+                    resultType = ReflectType.ARRAY_FLOAT;
+                    resultType.setPrimitive(componentType.isPrimitive());
+                    break;
+                case LONG:
+                    resultType = ReflectType.ARRAY_LONG;
+                    resultType.setPrimitive(componentType.isPrimitive());
+                    break;
+                case DOUBLE:
+                    resultType = ReflectType.ARRAY_DOUBLE;
+                    resultType.setPrimitive(componentType.isPrimitive());
+                    break;
+                case STRING:
+                    resultType = ReflectType.ARRAY_STRING;
+                    resultType.setPrimitive(componentType.isPrimitive());
+                    break;
+                case ENUM:
+                    resultType = ReflectType.ARRAY_ENUM;
+                    resultType.setPrimitive(componentType.isPrimitive());
+                    break;
+                case MAP:
+                    resultType = ReflectType.ARRAY_MAP;
+                    resultType.setPrimitive(componentType.isPrimitive());
+                    break;
+                case LIST:
+                    resultType = ReflectType.ARRAY_LIST;
+                    resultType.setPrimitive(componentType.isPrimitive());
+                    break;
+                case OBJECT:
+                    resultType = ReflectType.ARRAY;
+                    resultType.setPrimitive(componentType.isPrimitive());
+                    break;
+            }
+        } else {
+            resultType = ReflectType.ARRAY_ARRAY;
+            resultType.setPrimitive(false);
+        }
+
+        if(resultType != null) {
+            return resultType;
+        } else {
+            return ReflectType.UNKOWN;
+        }
+    }
+
+    public static class JavaArrayType {
+
+        Class<?> arrayType;
+
+        int dimension;
+
+        public JavaArrayType(Class<?> arrayType) {
+            this.arrayType = arrayType;
+            dimension = 0;
+            this.inspect();
+        }
+
+        public final void inspect() {
+            if(arrayType != null && arrayType.isArray()) {
+                Class<?> innerType = arrayType.getComponentType();
+                dimension = 1;
+                while(innerType.isArray() && (innerType = arrayType.getComponentType()) != null) {
+                    dimension++;
+                }
+            }
+        }
+
+        @Override
+        public String toString() {
+            return "Array " + arrayType.getSimpleName() + "[" + dimension + "]";
+        }
+    }
+}

src/test/java/cc/plural/jsonij/marshal/JSONDocumentMarshalerTest.java

         handlers.put("ftp", Handler.class);
         config.setHandlers(handlers);
         
-        JavaObjectMarshaler.registerCodec(ClassJSONCodec.class);
+        JavaMarshalerObjects.registerCodec(ClassJSONCodec.class);
         JSON outputJSON = JSONMarshaler.marshalObject(config);
         System.out.println("Output JSON:" + outputJSON);
 

src/test/java/cc/plural/jsonij/reflect/JavaTypeTest.java

 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import cc.plural.jsonij.reflect.JavaType;
+import cc.plural.jsonij.reflect.ReflectType;
 import static org.junit.Assert.*;
 
 /**
     public void testSetPrimitive() {
         System.out.println("setPrimitive");
         boolean primitive = false;
-        JavaType instance = JavaType.INTEGER;
+        ReflectType instance = ReflectType.INTEGER;
         instance.setPrimitive(primitive);
         assertEquals(instance.isPrimitive(), primitive);
     }
     public void testIsPrimitive() {
         System.out.println("isPrimitive");
         boolean primitive = true;
-        JavaType instance = JavaType.INTEGER;
+        ReflectType instance = ReflectType.INTEGER;
         instance.setPrimitive(primitive);
         assertEquals(instance.isPrimitive(), primitive);
     }
     public void inspectObjectType_boolean() {
         System.out.println("inspectObjectType_boolean");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = boolean.class;
-        expResult = JavaType.BOOLEAN;
+        expResult = ReflectType.BOOLEAN;
 
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         System.out.println(String.format("Found Class: \"%s\"", c));
         assertEquals(expResult, result);
 
     public void testInspectObjectType_Boolean() {
         System.out.println("inspectObjectType_Boolean");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = Boolean.class;
-        expResult = JavaType.BOOLEAN;
+        expResult = ReflectType.BOOLEAN;
 
         System.out.println(String.format("Found Class: \"%s\"", c));
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         assertEquals(expResult, result);
 
         boolean expResultPrimitive = false;
     public void inspectObjectType_byte() {
         System.out.println("inspectObjectType_byte");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = byte.class;
-        expResult = JavaType.BYTE;
+        expResult = ReflectType.BYTE;
 
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         System.out.println(String.format("Found Class: \"%s\"", c));
         assertEquals(expResult, result);
 
     public void testInspectObjectType_Byte() {
         System.out.println("inspectObjectType_Byte");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = Byte.class;
-        expResult = JavaType.BYTE;
+        expResult = ReflectType.BYTE;
 
         System.out.println(String.format("Found Class: \"%s\"", c));
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         assertEquals(expResult, result);
 
         boolean expResultPrimitive = false;
     public void inspectObjectType_short() {
         System.out.println("inspectObjectType_short");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = short.class;
-        expResult = JavaType.SHORT;
+        expResult = ReflectType.SHORT;
 
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         System.out.println(String.format("Found Class: \"%s\"", c));
         assertEquals(expResult, result);
 
     public void testInspectObjectType_Short() {
         System.out.println("inspectObjectType_Short");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = Short.class;
-        expResult = JavaType.SHORT;
+        expResult = ReflectType.SHORT;
 
         System.out.println(String.format("Found Class: \"%s\"", c));
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         assertEquals(expResult, result);
 
         boolean expResultPrimitive = false;
     public void testInspectObjectType_int() {
         System.out.println("inspectObjectType_int");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = int.class;
-        expResult = JavaType.INTEGER;
+        expResult = ReflectType.INTEGER;
 
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         System.out.println(String.format("Found Class: \"%s\"", c));
         assertEquals(expResult, result);
 
     public void testInspectObjectType_Integer() {
         System.out.println("inspectObjectType_Integer");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = Integer.class;
-        expResult = JavaType.INTEGER;
+        expResult = ReflectType.INTEGER;
 
         System.out.println(String.format("Found Class: \"%s\"", c));
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         assertEquals(expResult, result);
 
         boolean expResultPrimitive = false;
     public void testInspectObjectType_float() {
         System.out.println("inspectObjectType_float");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = float.class;
-        expResult = JavaType.FLOAT;
+        expResult = ReflectType.FLOAT;
 
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         System.out.println(String.format("Found Class: \"%s\"", c));
         assertEquals(expResult, result);
 
     public void testInspectObjectType_Float() {
         System.out.println("inspectObjectType_Integer");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = Float.class;
-        expResult = JavaType.FLOAT;
+        expResult = ReflectType.FLOAT;
 
         System.out.println(String.format("Found Class: \"%s\"", c));
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         assertEquals(expResult, result);
 
         boolean expResultPrimitive = false;
     public void testInspectObjectType_long() {
         System.out.println("inspectObjectType_long");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = long.class;
-        expResult = JavaType.LONG;
+        expResult = ReflectType.LONG;
 
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         System.out.println(String.format("Found Class: \"%s\"", c));
         assertEquals(expResult, result);
 
     public void testInspectObjectType_Long() {
         System.out.println("inspectObjectType_Long");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = Long.class;
-        expResult = JavaType.LONG;
+        expResult = ReflectType.LONG;
 
         System.out.println(String.format("Found Class: \"%s\"", c));
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         assertEquals(expResult, result);
 
         boolean expResultPrimitive = false;
     public void testInspectObjectType_double() {
         System.out.println("inspectObjectType_double");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = double.class;
-        expResult = JavaType.DOUBLE;
+        expResult = ReflectType.DOUBLE;
 
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         System.out.println(String.format("Found Class: \"%s\"", c));
         assertEquals(expResult, result);
 
     public void testInspectObjectType_Double() {
         System.out.println("inspectObjectType_Double");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = Double.class;
-        expResult = JavaType.DOUBLE;
+        expResult = ReflectType.DOUBLE;
 
         System.out.println(String.format("Found Class: \"%s\"", c));
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         assertEquals(expResult, result);
 
         boolean expResultPrimitive = false;
     public void testInspectObjectType_String() {
         System.out.println("inspectObjectType_String");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = String.class;
-        expResult = JavaType.STRING;
+        expResult = ReflectType.STRING;
 
         System.out.println(String.format("Found Class: \"%s\"", c));
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         assertEquals(expResult, result);
     }
 
     public void testInspectObjectType_List() {
         System.out.println("inspectObjectType_List");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = List.class;
-        expResult = JavaType.LIST;
+        expResult = ReflectType.LIST;
 
         System.out.println(String.format("Found Class: \"%s\"", c));
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         assertEquals(expResult, result);
     }
 
     public void testInspectObjectType_ArrayList() {
         System.out.println("inspectObjectType_ArrayList");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = ArrayList.class;
-        expResult = JavaType.LIST;
+        expResult = ReflectType.LIST;
 
         System.out.println(String.format("Found Class: \"%s\"", c));
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         assertEquals(expResult, result);
     }
     
     public void testInspectObjectType_Map() {
         System.out.println("inspectObjectType_Map");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = Map.class;
-        expResult = JavaType.MAP;
+        expResult = ReflectType.MAP;
 
         System.out.println(String.format("Found Class: \"%s\"", c));
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         assertEquals(expResult, result);
     }
     
     public void testInspectObjectType_HashMap() {
         System.out.println("inspectObjectType_HashMap");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = HashMap.class;
-        expResult = JavaType.MAP;
+        expResult = ReflectType.MAP;
 
         System.out.println(String.format("Found Class: \"%s\"", c));
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         assertEquals(expResult, result);
     }
     
     public void testInspectObjectType_HashDate() {
         System.out.println("inspectObjectType_HashDate");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = Date.class;
-        expResult = JavaType.OBJECT;
+        expResult = ReflectType.OBJECT;
 
         System.out.println(String.format("Found Class: \"%s\"", c));
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         assertEquals(expResult, result);
     }
     
     public void inspectObjectType_boolean_Array() {
         System.out.println("inspectObjectType_boolean_Array");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = boolean[].class;
-        expResult = JavaType.ARRAY_BOOLEAN;
+        expResult = ReflectType.ARRAY_BOOLEAN;
 
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         System.out.println(String.format("Found Class: \"%s\"", c));
         assertEquals(expResult, result);
 
     public void testInspectObjectType_Boolean_Array() {
         System.out.println("inspectObjectType_Boolean_Array");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = Boolean[].class;
-        expResult = JavaType.ARRAY_BOOLEAN;
+        expResult = ReflectType.ARRAY_BOOLEAN;
 
         System.out.println(String.format("Found Class: \"%s\"", c));
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         assertEquals(expResult, result);
 
         boolean expResultPrimitive = false;
     public void inspectObjectType_byte_Array() {
         System.out.println("inspectObjectType_byte_Array");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = byte[].class;
-        expResult = JavaType.ARRAY_BYTE;
+        expResult = ReflectType.ARRAY_BYTE;
 
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         System.out.println(String.format("Found Class: \"%s\"", c));
         assertEquals(expResult, result);
 
     public void testInspectObjectType_Byte_Array() {
         System.out.println("inspectObjectType_Byte_Array");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = Byte[].class;
-        expResult = JavaType.ARRAY_BYTE;
+        expResult = ReflectType.ARRAY_BYTE;
 
         System.out.println(String.format("Found Class: \"%s\"", c));
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         assertEquals(expResult, result);
 
         boolean expResultPrimitive = false;
     public void inspectObjectType_short_Array() {
         System.out.println("inspectObjectType_short_Array");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = short[].class;
-        expResult = JavaType.ARRAY_SHORT;
+        expResult = ReflectType.ARRAY_SHORT;
 
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         System.out.println(String.format("Found Class: \"%s\"", c));
         assertEquals(expResult, result);
 
     public void testInspectObjectType_Short_Array() {
         System.out.println("inspectObjectType_Short_Array");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = Short[].class;
-        expResult = JavaType.ARRAY_SHORT;
+        expResult = ReflectType.ARRAY_SHORT;
 
         System.out.println(String.format("Found Class: \"%s\"", c));
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         assertEquals(expResult, result);
 
         boolean expResultPrimitive = false;
     public void testInspectObjectType_int_Array() {
         System.out.println("inspectObjectType_int");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = int[].class;
-        expResult = JavaType.ARRAY_INTEGER;
+        expResult = ReflectType.ARRAY_INTEGER;
 
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         System.out.println(String.format("Found Class: \"%s\"", c));
         assertEquals(expResult, result);
 
     public void testInspectObjectType_Integer_Array() {
         System.out.println("inspectObjectType_Integer");
         Class<?> c = null;
-        JavaType expResult = null;
+        ReflectType expResult = null;
 
         c = Integer[].class;
-        expResult = JavaType.ARRAY_INTEGER;
+        expResult = ReflectType.ARRAY_INTEGER;
 
         System.out.println(String.format("Found Class: \"%s\"", c));
-        JavaType result = JavaType.inspectObjectType(c);
+        ReflectType result = ReflectType.inspectObjectType(c);
         assertEquals(expResult, result);
 
         boolean expResultPrimitive = false;
     public void testInspectObjectType_float_Array() {
         System.out.println("inspectObjectType_float_Array");
         Class<?> c = null;