/** * Obtain the set of types given the supplied name or iterable container of names. * * @param typeName the String or Symbol representation of a single type name, or an Iterable&?> list of names * @return the set of types that correspond to the supplied names; never null but possibly an empty set */ public static EnumSet<Type> typesWithNames( Object typeName ) { if (typeName instanceof List) { List<Type> result = new ArrayList<Type>(); Iterable<?> typeNames = (Iterable<?>)typeName; for (Object tname : typeNames) { if (tname == null) continue; String name = tname.toString(); Type type = byName(name); if (type != null) result.add(type); } if (!result.isEmpty()) { return EnumSet.copyOf(result); } } else if (typeName instanceof String || typeName instanceof Symbol) { String name = typeName.toString(); Type type = byName(name); return EnumSet.of(type); } return EnumSet.noneOf(Type.class); } }
/** * Obtain the set of types given the supplied name or iterable container of names. * * @param typeName the String or Symbol representation of a single type name, or an Iterable&?> list of names * @return the set of types that correspond to the supplied names; never null but possibly an empty set */ public static EnumSet<Type> typesWithNames( Object typeName ) { if (typeName instanceof List) { List<Type> result = new ArrayList<Type>(); Iterable<?> typeNames = (Iterable<?>)typeName; for (Object tname : typeNames) { if (tname == null) continue; String name = tname.toString(); Type type = byName(name); if (type != null) result.add(type); } if (!result.isEmpty()) { return EnumSet.copyOf(result); } } else if (typeName instanceof String || typeName instanceof Symbol) { String name = typeName.toString(); Type type = byName(name); return EnumSet.of(type); } return EnumSet.noneOf(Type.class); } }
if (value instanceof String) { Type type = JsonSchema.Type.byName((String)value); if (type == Type.ANY || type == Type.UNKNOWN) return; validators.add(new TypeValidator(type)); validator = create(schemaOrRef, parentPath.with("type")); } else if (obj instanceof String) { Type type = JsonSchema.Type.byName((String)obj); if (type == Type.ANY || type == Type.UNKNOWN) continue; validator = new TypeValidator(type);
if (value instanceof String) { Type type = JsonSchema.Type.byName((String)value); if (type == Type.ANY || type == Type.UNKNOWN) return; validators.add(new TypeValidator(type)); validator = create(schemaOrRef, parentPath.with("type")); } else if (obj instanceof String) { Type type = JsonSchema.Type.byName((String)obj); if (type == Type.ANY || type == Type.UNKNOWN) continue; validator = new TypeValidator(type);