private Object wrap(final Context context, final Scriptable scope, final String key, final Object value) {

		if (value instanceof Iterable) {
			return new StructrArray(scope, key, wrapIterable(context, scope, key, (Iterable)value));
		}

		if (value instanceof Object[]) {
			return new StructrArray(scope, key, (Object[])value);
		}

		if (value instanceof GraphObjectMap) {
			return new GraphObjectMapWrapper(context, scope, (GraphObjectMap)value);
		}

		if (value instanceof GraphObject) {
			return new GraphObjectWrapper(context, scope, (GraphObject)value);
		}

		if (value instanceof HttpServletRequest) {
			return new HttpServletRequestWrapper((HttpServletRequest)value);
		}

		if (value != null && value.getClass().isEnum()) {

			return ((Enum)value).name();
		}

		if (value instanceof NativeObject) {

			return (NativeObject)value;
		}

		if (value instanceof Map && !(value instanceof PropertyMap)) {

			return new MapWrapper(context, scope, (Map)value);
		}

		if (value instanceof Date) {

			return context.newObject(scope, "Date", new Object[] {((Date)value).getTime()});
		}

		if (value instanceof NativeJavaObject) {

			return wrap(context, scope, key, ((NativeJavaObject)value).unwrap());
		}

		return value;
	}
private Object wrap ( final Context context , final Scriptable scope , final String key , final Object value ) { if ( value instanceof Iterable ) { return new StructrArray ( scope , key , wrapIterable ( context , scope , key , ( Iterable ) value ) ) ; } if ( value instanceof Object [ ] ) { return new StructrArray ( scope , key , ( Object [ ] ) value ) ; } if ( value instanceof GraphObjectMap ) { return new GraphObjectMapWrapper ( context , scope , ( GraphObjectMap ) value ) ; } if ( value instanceof GraphObject ) { return new GraphObjectWrapper ( context , scope , ( GraphObject ) value ) ; } if ( value instanceof HttpServletRequest ) { return new HttpServletRequestWrapper ( ( HttpServletRequest ) value ) ; } if ( value != null && value . getClass ( ) . isEnum ( ) ) { return ( ( Enum ) value ) . name ( ) ; } if ( value instanceof NativeObject ) { return ( NativeObject ) value ; } if ( value instanceof Map && ! ( value instanceof PropertyMap ) ) { return new MapWrapper ( context , scope , ( Map ) value ) ; } if ( value instanceof Date ) { return context . newObject ( scope , "Date" , new Object [ ] { ( ( Date ) value ) . getTime ( ) } ) ; } if ( value instanceof NativeJavaObject ) { return wrap ( context , scope , key , ( ( NativeJavaObject ) value ) . unwrap ( ) ) ; } return value ; }
----- private methods -----