当前位置: 首页>>代码示例>>Java>>正文


Java StrKit.notBlank方法代码示例

本文整理汇总了Java中com.jfinal.kit.StrKit.notBlank方法的典型用法代码示例。如果您正苦于以下问题:Java StrKit.notBlank方法的具体用法?Java StrKit.notBlank怎么用?Java StrKit.notBlank使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jfinal.kit.StrKit的用法示例。


在下文中一共展示了StrKit.notBlank方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configRoute

import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
/**
 * 路由配置
 */
@SuppressWarnings("unchecked")
public void configRoute(Routes routes) {
	List<Class<Controller>> controllerClassList = ClassScaner.scanSubClass(Controller.class);
	if (controllerClassList != null) {
		for (Class<?> clazz : controllerClassList) {
			UrlMapping urlMapping = clazz.getAnnotation(UrlMapping.class);
			if (null != urlMapping && StringUtils.isNotBlank(urlMapping.url())) {
				if (StrKit.notBlank(urlMapping.viewPath())) {
					routes.add(urlMapping.url(), (Class<? extends Controller>) clazz, urlMapping.viewPath());
				} else {
					routes.add(urlMapping.url(), (Class<? extends Controller>) clazz);
				}
			}
		}
	}
}
 
开发者ID:lusparioTT,项目名称:OooO,代码行数:20,代码来源:AppConfig.java

示例2: wirtToFile

import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
/**
 * 若 model 文件存在,则不生成,以免覆盖用户手写的代码
 */
protected void wirtToFile(TableMeta tableMeta) throws IOException {
	
	String pre =tableMeta.name.toLowerCase().replace("_", "").replace(tableMeta.modelName.toLowerCase(), "");
	
	String outDir =serviceOutputDir;
	if(StrKit.notBlank(pre)){
	 outDir = serviceOutputDir + File.separator + pre;
	}
	
	File dir = new File(outDir);
	if (!dir.exists()) dir.mkdirs();
	String target = outDir + File.separator + tableMeta.modelName+"Service" + ".java";

	File file = new File(target);
	if (file.exists()) {
		return; // 若 serivce 存在,不覆盖
	}

	FileWriter fw = new FileWriter(file);
	try {
		fw.write(tableMeta.modelContent);
	} finally {
		fw.close();
	}
}
 
开发者ID:jayqqaa12,项目名称:jbase,代码行数:29,代码来源:JbaseServiceGenerator.java

示例3: wirtToFile

import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
protected void wirtToFile(TableMeta tableMeta) throws IOException {

		String pre = tableMeta.name.toLowerCase().replace("_", "").replace(tableMeta.modelName.toLowerCase(), "");

		String outDir = baseModelOutputDir;
		if (StrKit.notBlank(pre)) {
			outDir = baseModelOutputDir + File.separator + pre;
		}

		File dir = new File(outDir);
		if (!dir.exists()) dir.mkdirs();

		String target = outDir + File.separator + tableMeta.baseModelName + ".java";
		FileWriter fw = new FileWriter(target);
		try {
			fw.write(tableMeta.baseModelContent);
		} finally {
			fw.close();
		}
	}
 
开发者ID:jayqqaa12,项目名称:jbase,代码行数:21,代码来源:JbaseBaseModelGenerator.java

示例4: create

import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
public void create() {
  Project project = getModel(Project.class, "project");
  if(StrKit.notBlank(project.getName())) {
    project.save();
    redirect("/project?projectId=" + project.getId());
    return;
  }
  render("create.html");
}
 
开发者ID:slashchenxiaojun,项目名称:wall.e,代码行数:10,代码来源:HomeController.java

示例5: invoke

import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
@Deprecated
public void invoke() {
  Integer interfaceId = getParaToInt("interface.id");

  checkNotNull(interfaceId, "interface.id");

  Interface interfaces = Interface.dao.findById(interfaceId);
  if ( interfaces == null ) {
    Error(500, "Oop! interface not exist.");
    return;
  }
  // http-client 因为接口调度会比较频繁,所以使用conntion-pool来操作
  /**
   * 使用连接池可以根据以往接口的调用频率来决策,因为连接池采取的都是长连接
   */
  String url = interfaces.getRelativeUrl();
  if ( StrKit.isBlank(url) ) {
    Error(500, "Oop! interface url not exist.");
    return;
  }
  if ( interfaces.get("data") == null ) {
    Error(500, "Oop! interface data not exist.");
    return;
  }
  // 使用baseUrl瓶装真实的接口url
  if ( !url.startsWith("http") ) {
    String baseUrl = Project.dao.findById(interfaces.getWProjectId()).getBaseUrl();
    if ( StrKit.notBlank(baseUrl) ) {
      if ( url.startsWith("/") )
        url = baseUrl + url;
      else
        url = baseUrl + "/" + url;
    }
  }
  String result = HttpKit.post(url, interfaces.get("data").toString());
  LOG.info(String.format("ID[%n]-interface:[%s (%s)] invoke result:[%s]", interfaces.getId(), interfaces.getName(), interfaces.getCode(), result));
  OK(JSON.parse(result));
}
 
开发者ID:slashchenxiaojun,项目名称:wall.e,代码行数:39,代码来源:ProjectController.java

示例6: intercept

import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
@Override
public void intercept(Invocation inv) {
	try {
		inv.invoke();
	} catch(Exception e) {
		BaseController controller = (BaseController)inv.getController();
		String exceptionMessage = "Oop~ Server Exception";
		Throwable t = e.getCause();
		if(t != null) exceptionMessage = t.getMessage();
		else if(StrKit.notBlank(e.getMessage())) exceptionMessage = e.getMessage();
		else e.printStackTrace();
		controller.Error(500, isDebug ? exceptionMessage : null);
	}
}
 
开发者ID:slashchenxiaojun,项目名称:wall.e,代码行数:15,代码来源:ErrorInterceptor.java

示例7: configRoute

import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
@Override
public void configRoute(Routes routes) {

    List<Class<Controller>> controllerClassList = ClassScanner.scanSubClass(Controller.class);
    if (controllerClassList == null) {
        return;
    }

    for (Class<Controller> clazz : controllerClassList) {
        RequestMapping mapping = clazz.getAnnotation(RequestMapping.class);
        if (mapping == null || mapping.value() == null) {
            continue;
        }

        if (StrKit.notBlank(mapping.viewPath())) {
            routes.add(mapping.value(), clazz, mapping.viewPath());
        } else {
            routes.add(mapping.value(), clazz);
        }
    }

    JbootSwaggerConfig swaggerConfig = Jboot.config(JbootSwaggerConfig.class);
    if (swaggerConfig.isConfigOk()) {
        routes.add(swaggerConfig.getPath(), JbootSwaggerController.class, swaggerConfig.getPath());
    }

    JbootAppListenerManager.me().onJfinalRouteConfig(routes);

    for (Routes.Route route : routes.getRouteItemList()) {
        JbootControllerManager.me().setMapping(route.getControllerKey(), route.getControllerClass());
    }

    routeList.addAll(routes.getRouteItemList());
}
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:35,代码来源:JbootAppConfig.java

示例8: getTicket

import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
/**
 * http GET请求获得jsapi_ticket(有效期7200秒,开发者必须在自己的服务全局缓存jsapi_ticket)
 *
 * @param jsApiType jsApi类型
 * @return JsTicket
 */
public static JsTicket getTicket(JsApiType jsApiType) {
    String access_token = AccessTokenApi.getAccessTokenStr();
    String appId = ApiConfigKit.getApiConfig().getAppId();
    String key = appId + ':' + jsApiType.name();
    final ParaMap pm = ParaMap.create("access_token", access_token).put("type", jsApiType.name());

    // 2016.07.21修改By L.cm 为了更加方便扩展
    String jsTicketJson = ApiConfigKit.getAccessTokenCache().get(key);
    JsTicket jsTicket = null;
    if (StrKit.notBlank(jsTicketJson)) {
        jsTicket = new JsTicket(jsTicketJson);
    }
    if (null == jsTicket || !jsTicket.isAvailable()) {
        // 最多三次请求
        jsTicket = RetryUtils.retryOnException(3, new Callable<JsTicket>() {

            @Override
            public JsTicket call() throws Exception {
                return new JsTicket(HttpUtils.get(apiUrl, pm.getData()));
            }

        });

        if (null != jsApiType) {
            ApiConfigKit.getAccessTokenCache().set(key, jsTicket.getCacheJson());
        }

    }
    return jsTicket;
}
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:37,代码来源:WechatApis.java

示例9: dologin

import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
public void dologin() {
    ResultData result = new ResultData();
    String addr = getPara("addr");
    String password = getPara("password");
    String pwd = PropKit.use("user.properties").get("root");
    if (StrKit.isBlank(password) || !password.equals(pwd)) {
        result.setSuccess(false);
        result.setMessage("请输入正确的密码登陆!");
        renderJson(result);
    } else {
        if (StrKit.notBlank(addr)) {
            try {
                ZKPlugin zkPlugin = new ZKPlugin(addr);
                if (getSessionAttr("zk-client") == null) {
                    setSessionAttr("zk-client", zkPlugin.getClient());
                    setSessionAttr("addr", addr);
                }
            } catch (Exception e) {
                log.error("ZKPlugin error.", e);
                result.setSuccess(false);
                result.setMessage("连接到ZooKeeper失败,请复核!");
            }

        } else {
            result.setSuccess(false);
            result.setMessage("ZooKeeper 地址不能为空!");
        }
        renderJson(result);
    }
}
 
开发者ID:iminto,项目名称:zooadmin,代码行数:31,代码来源:IndexController.java

示例10: start

import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public boolean start() {
    List<Class<? extends Model>> modelClasses = ClassSearcher.of(Model.class).libDir(libDir).classpath(classpath)
            .scanPackages(scanPackages).injars(includeJars).includeAllJarsInLib(includeAllJarsInLib).search();
    TableBind tb;
    for (Class modelClass : modelClasses) {
        if (excludeClasses.contains(modelClass)) {
            continue;
        }
        tb = (TableBind) modelClass.getAnnotation(TableBind.class);
        String tableName;
        String arpConfName = Reflect.on(this).get("configName");
        if (tb == null) {
            if (!autoScan) {
                continue;
            }
            tableName = nameStyle.name(modelClass.getSimpleName());
            this.addMapping(tableName, modelClass);
            log.debug(arpConfName + " addMapping(" + tableName + ", " + modelClass.getName() + ")");
        } else {
            String tbConfName = tb.configName();
            if (StrKit.notBlank(tbConfName) && !tbConfName.equals(arpConfName)) continue;
            tableName = tb.tableName();
            if (StrKit.notBlank(tb.pkName())) {
                this.addMapping(tableName, tb.pkName(), modelClass);
                log.debug(arpConfName + " addMapping(" + tableName + ", " + tb.pkName() + "," + modelClass.getName() + ")");
            } else {
                this.addMapping(tableName, modelClass);
                log.debug(arpConfName + " addMapping(" + tableName + ", " + modelClass.getName() + ")");
            }
        }
    }
    return super.start();
}
 
开发者ID:gumutianqi,项目名称:jfinal-plus,代码行数:36,代码来源:AutoTableBindPlugin.java

示例11: getUrl

import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
public static String getUrl(HttpServletRequest request) {
    String url = request.getRequestURL().toString();
    String parmas = request.getQueryString();
    if (StrKit.notBlank(parmas)) {
        url = url + "?" + parmas;
    }
    return url;
}
 
开发者ID:gumutianqi,项目名称:jfinal-plus,代码行数:9,代码来源:ServletKit.java

示例12: decodeScopes

import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
public static Set<String> decodeScopes(String s) {
    Set<String> scopes = new HashSet<String>();
    if (StrKit.notBlank(s)) {
        StringTokenizer tokenizer = new StringTokenizer(s, " ");

        while (tokenizer.hasMoreElements()) {
            scopes.add(tokenizer.nextToken());
        }
    }
    return scopes;

}
 
开发者ID:OpeningO,项目名称:jfinal-oauth2.0-server,代码行数:13,代码来源:OAuthKit.java

示例13: execPostExcelProcessor

import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
@SuppressWarnings({"rawtypes", "unchecked"})
private void execPostExcelProcessor(Object obj) {
    String postExcelProcessorClassName = rule.getPostExcelProcessor();
    if (StrKit.notBlank(postExcelProcessorClassName)) {
        PostExcelProcessor postExcelProcessor = Reflect.on(postExcelProcessorClassName).create().get();
        postExcelProcessor.process(obj);
    }
}
 
开发者ID:OpeningO,项目名称:JFinal-ext2,代码行数:9,代码来源:ExcelUploadInterceptor.java

示例14: fillModel

import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
public static Model<?> fillModel(Class<?> clazz, List<String> list, Rule rule) {
    Model<?> model = Reflect.on(clazz).create().get();
    String[] values = list.toArray(new String[]{});
    String message = "";
    for (int i = 0; i < values.length; i++) {
        String value = values[i];
        Rule.Cell cell = matchCell(rule, i);
        String name = cell.getAttribute();
        String validateClassName = cell.getValidate();
        boolean valid = true;
        if (StrKit.notBlank(validateClassName)) {
            CellValidate cellValidate = Reflect.on(validateClassName).create().get();
            valid = cellValidate.validate(value);
            if (!valid) {
                message = message + "value(" + value + ") is invalid in column " + cell.getIndex() + "</br>";
            }
        }
        if (valid) {
            Object convertedValue = value;
            String convertClassName = cell.getConvert();
            if (StrKit.notBlank(convertClassName)) {
                CellConvert cellConvert = Reflect.on(convertClassName).get();
                convertedValue = cellConvert.convert(value, model);
            }
            model.set(name, convertedValue);
        }
    }
    if (StrKit.notBlank(message)) {
        throw new ExcelException(message);
    }
    return model;
}
 
开发者ID:jayqqaa12,项目名称:jbase,代码行数:33,代码来源:PoiImporter.java

示例15: validateNotAllowedParameters

import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
@Override
public void validateNotAllowedParameters(T request) throws OAuthProblemException {
    List<String> notAllowedParameters = new ArrayList<String>();
    for (String requiredParam : notAllowedParams) {
        String val = request.getParameter(requiredParam);
        if (StrKit.notBlank(val)) {
            notAllowedParameters.add(requiredParam);
        }
    }
    if (!notAllowedParameters.isEmpty()) {
        throw OAuthKit.handleNotAllowedParametersOAuthException(notAllowedParameters);
    }
}
 
开发者ID:OpeningO,项目名称:jfinal-oauth2.0-server,代码行数:14,代码来源:OAuthBaseValidator.java


注:本文中的com.jfinal.kit.StrKit.notBlank方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。