@Override protected void dataSourceProvided(DataSource dataSource, DataSourceConfig dataSourceConfig, boolean readonly) { E.unsupportedIf(null == dataSource, "Hibernate require external data source provider"); super.dataSourceProvided(dataSource, dataSourceConfig, readonly); }
@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(); } }
private Node _search(H.Method method, String path) { Node node = root(method); assert node != null; E.unsupportedIf(null == node, "Method %s is not supported", method); if (path.length() == 1 && path.charAt(0) == '/') { return node; } String sUrl = path; List<String> paths = Path.tokenize(Unsafe.bufOf(sUrl)); int len = paths.size(); for (int i = 0; i < len - 1; ++i) { node = node.findChild(paths.get(i)); if (null == node) return null; } return node.findChild(paths.get(len - 1)); }
private Node _search(H.Method method, String path) { Node node = root(method); assert node != null; E.unsupportedIf(null == node, "Method %s is not supported", method); if (path.length() == 1 && path.charAt(0) == '/') { return node; } String sUrl = path; List<String> paths = Path.tokenize(Unsafe.bufOf(sUrl)); int len = paths.size(); for (int i = 0; i < len - 1; ++i) { node = node.findChild(paths.get(i)); if (null == node) return null; } return node.findChild(paths.get(len - 1)); }
@Override public MODEL_TYPE findLatest() { E.unsupportedIf(null == createdColumn, "no CreatedAt column defined"); return q().orderBy(createdColumn).first(); }
@Override public MODEL_TYPE findLastModified() { E.unsupportedIf(null == lastModifiedColumn, "no LastModifiedAt column defined"); return q().orderBy(lastModifiedColumn).first(); }
private Node _locate(final H.Method method, final String path, String action) { Node node = root(method); E.unsupportedIf(null == node, "Method %s is not supported", method); assert null != node; int pathLen = path.length(); if (0 == pathLen || (1 == pathLen && path.charAt(0) == '/')) { return node; } String sUrl = path; List<String> paths = Path.tokenize(Unsafe.bufOf(sUrl)); int len = paths.size(); for (int i = 0; i < len - 1; ++i) { String part = paths.get(i); if (checkIgnoreRestParts(node, part)) { return node; } node = node.addChild(part, path, action); } String part = paths.get(len - 1); if (checkIgnoreRestParts(node, part)) { return node; } return node.addChild(part, path, action); }
private Node _locate(final H.Method method, final String path, String action) { Node node = root(method); E.unsupportedIf(null == node, "Method %s is not supported", method); assert null != node; int pathLen = path.length(); if (0 == pathLen || (1 == pathLen && path.charAt(0) == '/')) { return node; } String sUrl = path; List<String> paths = Path.tokenize(Unsafe.bufOf(sUrl)); int len = paths.size(); for (int i = 0; i < len - 1; ++i) { String part = paths.get(i); if (checkIgnoreRestParts(node, part)) { return node; } node = node.addChild(part, path, action); } String part = paths.get(len - 1); if (checkIgnoreRestParts(node, part)) { return node; } return node.addChild(part, path, action); }
private RequestHandlerInfo resolveActionHandler(String action) { $.T2<String, String> t2 = splitActionStr(action); String directive = t2._1, payload = t2._2; if (S.empty(directive)) { if (payload.contains("/")) { directive = "resource"; } } if (S.notEmpty(directive)) { RequestHandlerResolver resolver = resolvers.get(directive); RequestHandler handler = null == resolver ? BuiltInHandlerResolver.tryResolve(directive, payload, app()) : resolver.resolve(payload, app()); E.unsupportedIf(null == handler, "cannot find action handler by directive %s on payload %s", directive, payload); return new RequestHandlerInfo(handler, action); } else { RequestHandler handler = handlerLookup.resolve(payload, app()); E.unsupportedIf(null == handler, "cannot find action handler: %s", action); actionNames.add(payload); return new RequestHandlerInfo(handler, action); } }
private RequestHandlerInfo resolveActionHandler(String action) { $.T2<String, String> t2 = splitActionStr(action); String directive = t2._1, payload = t2._2; if (S.empty(directive)) { if (payload.contains("/")) { directive = "resource"; } } if (S.notEmpty(directive)) { RequestHandlerResolver resolver = resolvers.get(directive); RequestHandler handler = null == resolver ? BuiltInHandlerResolver.tryResolve(directive, payload, app()) : resolver.resolve(payload, app()); E.unsupportedIf(null == handler, "cannot find action handler by directive %s on payload %s", directive, payload); return new RequestHandlerInfo(handler, action); } else { RequestHandler handler = handlerLookup.resolve(payload, app()); E.unsupportedIf(null == handler, "cannot find action handler: %s", action); actionNames.add(payload); return new RequestHandlerInfo(handler, action); } }
if (column.contains(".")) { List<String> l0 = S.fastSplit(column, "."); E.unsupportedIf(l0.size() != 2, "Multiple dot in column spec not supported."); String joinModel = l0.get(0); String field = l0.get(1); E.unsupportedIf(l0.size() != 2, "Multiple dot in column spec not supported."); String joinModel = l0.get(0); String field = l0.get(1);
public JPAQuery<MODEL_TYPE> q(SQL.Type type, String expression, Object... values) { E.unsupportedIf(SQL.Type.UPDATE == type, "UPDATE not supported in q() API"); JPAService jpa = jpa(); JPAQuery<MODEL_TYPE> q = new JPAQuery<>(jpa, em(jpa, readOnly(type)), modelClass, type, expression); int len = values.length; for (int i = 0; i < len; ++i) { q.setParameter(i + 1, values[i]); } return q; }
JSONObject obj = array.getJSONObject(i); String className = obj.getString("className"); E.unsupportedIf(S.isBlank(className), "Unsupported JSON resource, className required"); String key = obj.getString("key"); if (null == key) {
JSONObject obj = array.getJSONObject(i); String className = obj.getString("className"); E.unsupportedIf(S.isBlank(className), "Unsupported JSON resource, className required"); String key = obj.getString("key"); if (null == key) {