/** * New List and add values * * @param values list values * @param <T> list type * @return return array list */ @SafeVarargs public static <T> List<T> newLists(T... values) { if(null == values || values.length == 0){ Assert.notNull(values, "values not is null."); } return Arrays.asList(values); }
/** * New List and add values * * @param values list values * @param <T> list type * @return return array list */ @SafeVarargs public static <T> List<T> newLists(T... values) { if(null == values || values.length == 0){ Assert.notNull(values, "values not is null."); } return Arrays.asList(values); }
/** * New Set and add values * * @param values set values * @param <T> set type * @return return HashSet */ @SafeVarargs public static <T> Set<T> newSets(T... values) { if(null == values || values.length == 0){ Assert.notNull(values, "values not is null."); } return new HashSet<>(Arrays.asList(values)); }
/** * New Set and add values * * @param values set values * @param <T> set type * @return return HashSet */ @SafeVarargs public static <T> Set<T> newSets(T... values) { if(null == values || values.length == 0){ Assert.notNull(values, "values not is null."); } return new HashSet<>(Arrays.asList(values)); }
public void route(String path, Class<?> clazz, String methodName, HttpMethod httpMethod) { try { Assert.notNull(path, "Route path not is null!"); Assert.notNull(clazz, "Route type not is null!"); Assert.notNull(methodName, "Method name not is null"); Assert.notNull(httpMethod, "Request Method not is null"); Method[] methods = classMethodPool.computeIfAbsent(clazz.getName(), k -> clazz.getMethods()); if (null == methods) { return; } for (Method method : methods) { if (method.getName().equals(methodName)) { Object controller = controllerPool.computeIfAbsent(clazz, k -> ReflectKit.newInstance(clazz)); addRoute(httpMethod, path, controller, clazz, method); } } } catch (Exception e) { log.error("Add route method error", e); } }
public void route(String path, Class<?> clazz, String methodName, HttpMethod httpMethod) { try { Assert.notNull(path, "Route path not is null!"); Assert.notNull(clazz, "Route type not is null!"); Assert.notNull(methodName, "Method name not is null"); Assert.notNull(httpMethod, "Request Method not is null"); Method[] methods = classMethodPool.computeIfAbsent(clazz.getName(), k -> clazz.getMethods()); if (null == methods) { return; } for (Method method : methods) { if (method.getName().equals(methodName)) { Object controller = controllerPool.computeIfAbsent(clazz, k -> ReflectKit.newInstance(clazz)); addRoute(httpMethod, path, controller, clazz, method); } } } catch (Exception e) { log.error("Add route method error", e); } }
public void route(String path, Class<?> clazz, String methodName) { Assert.notNull(methodName, "Method name not is null"); HttpMethod httpMethod = HttpMethod.ALL; if (methodName.contains(":")) { String[] methodArr = methodName.split(":"); httpMethod = HttpMethod.valueOf(methodArr[0].toUpperCase()); methodName = methodArr[1]; } this.route(path, clazz, methodName, httpMethod); }
public void route(String path, Class<?> clazz, String methodName) { Assert.notNull(methodName, "Method name not is null"); HttpMethod httpMethod = HttpMethod.ALL; if (methodName.contains(":")) { String[] methodArr = methodName.split(":"); httpMethod = HttpMethod.valueOf(methodArr[0].toUpperCase()); methodName = methodArr[1]; } this.route(path, clazz, methodName, httpMethod); }
@Test(expected = IllegalArgumentException.class) public void testNotEmpty() { Assert.notEmpty("", "Not Empty"); Assert.notEmpty(new String[]{}, "Arr Empty"); Assert.notNull(null, "Not null"); }
/** Create a new TokenQueue. @param data string of data to back queue. */ public TokenQueue(String data) { Assert.notNull(data); queue = data; }
/** * Setting a ioc container * * @param ioc object * @return return blade */ public Blade container(Ioc ioc) { Assert.notNull(ioc); this.ioc = ioc; return this; }
public ViewSettings JSONParser(JSONParser jsonParser) { Assert.notNull(jsonParser); LOGGER.debug("Switch JSONParser With [{}]", jsonParser); this.jsonParser = jsonParser; return this; }
/** * return register plugin object * * @param plugin plugin class * @return return blade */ public Blade plugin(Class<? extends Plugin> plugin) { Assert.notNull(plugin); plugins.add(plugin); return this; }
public Config load(Properties props) { Assert.notNull(props, "properties not null"); Iterator<Object> it = props.keySet().iterator(); while (it.hasNext()){ String key = it.next().toString(); String value = props.getProperty(key); config.put(key, value); } return this; }
/** * Add user-defined objects */ @Override public void addBean(Object bean) { Assert.notNull(bean); addBean(bean.getClass().getName(), bean); }
/** * Add user-defined objects */ public void addBean(Class<?> beanClass, Object bean) { Assert.notNull(beanClass); addBean(beanClass.getName(), bean); }
/** * Register @Component marked objects */ public Object addBean(Class<?> type, boolean singleton) { Assert.notNull(type); return addBean(type.getName(), type, singleton); }
public void route(String path, Class<?> clazz, String methodName) { Assert.notNull(methodName, "Method name not is null"); HttpMethod httpMethod = HttpMethod.ALL; if (methodName.contains(":")) { String[] methodArr = methodName.split(":"); httpMethod = HttpMethod.valueOf(methodArr[0].toUpperCase()); methodName = methodArr[1]; } this.route(path, clazz, methodName, httpMethod); }
public void route(String path, Class<?> clazz, String methodName) { Assert.notNull(methodName, "Method name not is null"); HttpMethod httpMethod = HttpMethod.ALL; if (methodName.contains(":")) { String[] methodArr = methodName.split(":"); httpMethod = HttpMethod.valueOf(methodArr[0].toUpperCase()); methodName = methodArr[1]; } this.route(path, clazz, methodName, httpMethod); }
public ByteArray(byte[] bytes, int offset, int length) { Assert.notNull(bytes, "bytes"); Assert.isTrue(offset >= 0, "offset", offset); if (length == Integer.MIN_VALUE) { length = bytes.length - offset; } Assert.isTrue(length >= 0 && length <= bytes.length - offset, "length"); this.bytes = bytes; this.offset = offset; this.length = length; }