Browse files

Refactored method name validate() to createValidType().

  • Loading branch information...
1 parent 5a07888 commit 669001f0fa6b1f600778da62c14e36a412761bd1 @bbansal bbansal committed Jun 23, 2009
Showing with 5 additions and 5 deletions.
  1. +5 −5 src/java/voldemort/serialization/json/JsonTypeDefinition.java
View
10 src/java/voldemort/serialization/json/JsonTypeDefinition.java
@@ -50,7 +50,7 @@
private Object type;
public JsonTypeDefinition(Object type) {
- this.type = validate(type);
+ this.type = createValidType(type);
}
@@ -162,25 +162,25 @@ public static String format(Object type) {
}
public void validate() {
- validate(getType());
+ createValidType(getType());
}
- private Object validate(Object type) {
+ private Object createValidType(Object type) {
if(type == null) {
throw new IllegalArgumentException("Type or subtype cannot be null.");
} else if(type instanceof List<?>) {
List<?> l = (List<?>) type;
if(l.size() != 1)
throw new IllegalArgumentException("Lists in type definition must have length exactly one.");
- return Arrays.asList(validate(l.get(0)));
+ return Arrays.asList(createValidType(l.get(0)));
} else if(type instanceof Map<?, ?>) {
Map<String, ?> m = (Map<String, ?>) type;
// bbansal: sort keys here for consistent with fromJson()
Map<String, Object> newM = new LinkedHashMap<String, Object>(m.size());
List<String> keys = new ArrayList<String>((m.keySet()));
Collections.sort(keys);
for(String key: keys)
- newM.put(key, validate(m.get(key)));
+ newM.put(key, createValidType(m.get(key)));
return newM;
} else if(type instanceof JsonTypes) {
// this is good

0 comments on commit 669001f

Please sign in to comment.