public synchronized Inbox.Reader getReader() { E.unsupportedIfNot("imaps".equalsIgnoreCase(protocol), "Protocol not supported:" + protocol); if (null == reader) { reader = new ImapInboxReader(); } return reader; }
public synchronized Inbox.Reader getReader() { E.unsupportedIfNot("imaps".equalsIgnoreCase(protocol), "Protocol not supported:" + protocol); if (null == reader) { reader = new ImapInboxReader(); } return reader; }
public Map<String, Object> loadFixture(String fixtureName, DaoLocator daoLocator) { boolean isJson = fixtureName.endsWith(".json"); boolean isYaml = !isJson && (fixtureName.endsWith(".yaml") || fixtureName.endsWith(".yml")); E.unsupportedIfNot(isJson || isYaml, "fixture resource file type not supported: " + fixtureName); String content = getResourceAsString(fixtureName); if (null == content) { return C.Map(); } return isJson ? parseJson(content, daoLocator) : parse(content, daoLocator); }
public Map<String, Object> loadFixture(String fixtureName, DaoLocator daoLocator) { boolean isJson = fixtureName.endsWith(".json"); boolean isYaml = !isJson && (fixtureName.endsWith(".yaml") || fixtureName.endsWith(".yml")); E.unsupportedIfNot(isJson || isYaml, "fixture resource file type not supported: " + fixtureName); String content = getResourceAsString(fixtureName); if (null == content) { return C.Map(); } return isJson ? parseJson(content, daoLocator) : parse(content, daoLocator); }
@Override public <T> T read(InputStream is, Type targetType, MimeType mimeType, Object hint) { if (targetType instanceof Class) { Class clazz = (Class) targetType; if (Map.class.isAssignableFrom(clazz)) { return (T) readIntoMap(is, Map.class, mimeType, hint); } else if (List.class.isAssignableFrom(clazz)) { return (T) readIntoList(is, List.class, mimeType, hint); } else { throw new UnsupportedOperationException(); } } else if (targetType instanceof ParameterizedType){ E.unsupportedIfNot(support(targetType)); ParameterizedType ptype = $.cast(targetType); Type rawType = ptype.getRawType(); boolean isMap = Map.class.isAssignableFrom((Class) rawType); if (isMap) { Type[] typeParams = ptype.getActualTypeArguments(); E.unsupportedIf(typeParams.length != 2); Type keyType = typeParams[0]; E.unsupportedIf(keyType != String.class); return (T) readIntoMap(is, targetType, mimeType, hint); } else { return (T) readIntoList(is, targetType, mimeType, hint); } } else { throw E.unsupport(); } }
$.Var<File> fileBag = $.var(); if (isDir(url, entryBag, jarFileBag, fileBag)) { E.unsupportedIfNot(Map.class.isAssignableFrom(spec.rawType()), "Does not support loading directory into " + spec); JarEntry entry = entryBag.get(); Map map = $.cast(Act.getInstance(spec.rawType())); if (keyType instanceof Class) { isKeyword = Keyword.class == keyType; E.unsupportedIfNot(isKeyword || String.class == keyType, "Map spec not supported: " + spec); } else { throw E.unsupport("Map spec not supported: " + spec);
$.Var<File> fileBag = $.var(); if (isDir(url, entryBag, jarFileBag, fileBag)) { E.unsupportedIfNot(Map.class.isAssignableFrom(spec.rawType()), "Does not support loading directory into " + spec); JarEntry entry = entryBag.get(); Map map = $.cast(Act.getInstance(spec.rawType())); if (keyType instanceof Class) { isKeyword = Keyword.class == keyType; E.unsupportedIfNot(isKeyword || String.class == keyType, "Map spec not supported: " + spec); } else { throw E.unsupport("Map spec not supported: " + spec);