minor cleanup
diff --git a/src/main/java/com/fasterxml/jackson/databind/jsonFormatVisitors/JsonValueFormat.java b/src/main/java/com/fasterxml/jackson/databind/jsonFormatVisitors/JsonValueFormat.java
index dbf3ebf..7ba4698 100644
--- a/src/main/java/com/fasterxml/jackson/databind/jsonFormatVisitors/JsonValueFormat.java
+++ b/src/main/java/com/fasterxml/jackson/databind/jsonFormatVisitors/JsonValueFormat.java
@@ -27,73 +27,73 @@
DDThh:mm:ssZ in UTC time. This is the recommended form of date/
timestamp.
*/
- DATE_TIME("date-time"),
+ DATE_TIME("date-time"),
- /**
- * This SHOULD be an email address.
- */
- EMAIL("email"),
+ /**
+ * This SHOULD be an email address.
+ */
+ EMAIL("email"),
- /**
- * This SHOULD be a host-name.
- */
- HOST_NAME("host-name"),
+ /**
+ * This SHOULD be a host-name.
+ */
+ HOST_NAME("host-name"),
- /**
- * This SHOULD be an ip version 4 address.
- */
- IP_ADDRESS("ip-address"),
+ /**
+ * This SHOULD be an ip version 4 address.
+ */
+ IP_ADDRESS("ip-address"),
- /**
- * This SHOULD be an ip version 6 address.
- */
- IPV6("ipv6"),
+ /**
+ * This SHOULD be an ip version 6 address.
+ */
+ IPV6("ipv6"),
- /**
- * This SHOULD be a phone number (format MAY follow E.123).
- */
- PHONE("phone"),
+ /**
+ * This SHOULD be a phone number (format MAY follow E.123).
+ */
+ PHONE("phone"),
- /**
- * A regular expression, following the regular expression
- specification from ECMA 262/Perl 5.
- */
- REGEX("regex"),
+ /**
+ * A regular expression, following the regular expression
+ * specification from ECMA 262/Perl 5.
+ */
+ REGEX("regex"),
- /**
- * This is a CSS style definition (like "color: red; background-
- color:#FFF"), based on CSS 2.1 [W3C.CR-CSS21-20070719].
- */
- STYLE("style"),
+ /**
+ * This is a CSS style definition (like "color: red; background-
+ * color:#FFF"), based on CSS 2.1 [W3C.CR-CSS21-20070719].
+ */
+ STYLE("style"),
- /**
- * This SHOULD be a time in the format of hh:mm:ss. It is
- recommended that you use the "date-time" format instead of "time"
- unless you need to transfer only the time part.
- */
- TIME("time"),
+ /**
+ * This SHOULD be a time in the format of hh:mm:ss. It is
+ * recommended that you use the "date-time" format instead of "time"
+ * unless you need to transfer only the time part.
+ */
+ TIME("time"),
- /**
- * This value SHOULD be a URI..
- */
- URI("uri"),
+ /**
+ * This value SHOULD be a URI..
+ */
+ URI("uri"),
- /**
- * This SHOULD be the difference, measured in
+ /**
+ * This SHOULD be the difference, measured in
milliseconds, between the specified time and midnight, 00:00 of
January 1, 1970 UTC. The value SHOULD be a number (integer or
float).
- */
- UTC_MILLISEC("utc-millisec"),
- ;
+ */
+ UTC_MILLISEC("utc-millisec"),
+ ;
- private final String _desc;
-
- private JsonValueFormat(String desc) {
- _desc = desc;
- }
+ private final String _desc;
- @Override
- @JsonValue // since 2.7
- public String toString() { return _desc; }
+ private JsonValueFormat(String desc) {
+ _desc = desc;
+ }
+
+ @Override
+ @JsonValue // since 2.7
+ public String toString() { return _desc; }
}
diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/ByteArraySerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/ByteArraySerializer.java
index 6c9f9cd..e19ba93 100644
--- a/src/main/java/com/fasterxml/jackson/databind/ser/std/ByteArraySerializer.java
+++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/ByteArraySerializer.java
@@ -9,6 +9,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JacksonStdImpl;
+import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonArrayFormatVisitor;
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatTypes;
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
@@ -61,7 +62,7 @@
public JsonNode getSchema(SerializerProvider provider, Type typeHint)
{
ObjectNode o = createSchemaNode("array", true);
- ObjectNode itemSchema = createSchemaNode("string"); //binary values written as strings?
+ ObjectNode itemSchema = createSchemaNode("byte"); //binary values written as strings?
return o.set("items", itemSchema);
}
@@ -69,7 +70,17 @@
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
throws JsonMappingException
{
- // while logically (and within JVM) binary, gets encoded as Base64 String
- visitArrayFormat(visitor, typeHint, JsonFormatTypes.STRING);
+ // 14-Mar-2016, tatu: while logically (and within JVM) binary, gets encoded as Base64 String,
+ // let's try to indicate it is array of Bytes... difficult, thanks to JSON Schema's
+ // lackluster listing of types
+ //
+ // TODO: for 2.8, make work either as String/base64, or array of numbers,
+ // with a qualifier that can be used to determine it's byte[]
+ if (visitor != null) {
+ JsonArrayFormatVisitor v2 = visitor.expectArrayFormat(typeHint);
+ if (v2 != null) {
+ v2.itemsFormat(JsonFormatTypes.INTEGER);
+ }
+ }
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/fasterxml/jackson/databind/seq/ReadValuesTest.java b/src/test/java/com/fasterxml/jackson/databind/seq/ReadValuesTest.java
index 59d45b5..23464bf 100644
--- a/src/test/java/com/fasterxml/jackson/databind/seq/ReadValuesTest.java
+++ b/src/test/java/com/fasterxml/jackson/databind/seq/ReadValuesTest.java
@@ -4,8 +4,8 @@
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.core.type.TypeReference;
+
import com.fasterxml.jackson.databind.BaseMapTest;
-import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.MappingIterator;
import com.fasterxml.jackson.databind.ObjectMapper;
diff --git a/src/test/java/com/fasterxml/jackson/failing/ReadValues1161Test.java b/src/test/java/com/fasterxml/jackson/failing/ReadValues1161Test.java
deleted file mode 100644
index 9761a01..0000000
--- a/src/test/java/com/fasterxml/jackson/failing/ReadValues1161Test.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.fasterxml.jackson.failing;
-
-import java.util.*;
-
-import com.fasterxml.jackson.core.*;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.BaseMapTest;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.MappingIterator;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-@SuppressWarnings("resource")
-public class ReadValues1161Test extends BaseMapTest
-{
- static class Data1161 {
- enum Type {
- A, B, C;
-
- @Override
- public String toString() {
- return name().toLowerCase();
- };
- };
-
- public Type type;
- public String value;
- }
-
- /*
- /**********************************************************
- /* Unit tests
- /**********************************************************
- */
-
- private final ObjectMapper MAPPER = new ObjectMapper();
-
- public void testDeserProps1161() throws Exception
- {
- final String src = "[ { \"type\": \"a\", \"value\": \"1\" }, { \"type\": \"b\", \"value\": \"2\" }]";
- MappingIterator<Data1161> iterator = MAPPER
- .reader()
- .with(DeserializationFeature.READ_ENUMS_USING_TO_STRING)
- .forType(Data1161.class)
- .readValues(src);
- assertTrue(iterator.hasNext());
- Data1161 item = iterator.nextValue();
- assertNotNull(item);
- assertSame(Data1161.Type.A, item.type);
- iterator.close();
- }
-}