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


Java StringUtils类代码示例

本文整理汇总了Java中org.thymeleaf.util.StringUtils的典型用法代码示例。如果您正苦于以下问题:Java StringUtils类的具体用法?Java StringUtils怎么用?Java StringUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: list

import org.thymeleaf.util.StringUtils; //导入依赖的package包/类
@RequiresPermissions("admin:index")
@ResponseBody
@RequestMapping(value = "/admins", method = RequestMethod.GET)
public ResponseDTO list() {
    ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
    HttpServletRequest request = attributes.getRequest();
    Integer pageSize = Integer.valueOf(Objects.nonNull(request.getParameter("pageSize")) ? request.getParameter("pageSize") : "20");
    Integer pageNumber = Integer.valueOf(Objects.nonNull(request.getParameter("pageIndex")) ? request.getParameter("pageIndex") : "1");
    String userName = request.getParameter("userName");
    String email = request.getParameter("email");
    String reservation = request.getParameter("reservation");
    logger.info("查询条件为,userName:{},email:{},reservation:{}", userName, email, reservation);
    Map<String, Object> params = new HashMap();
    if (!StringUtils.isEmpty(userName)) {
        params.put("userName", userName);
    }
    if (!StringUtils.isEmpty(email)) {
        params.put("userEmail", email);
    }
    Pagination<AdminDO> pagination = adminService.pageAdminsByConditions(pageNumber, pageSize, params);
    return new ResponseDTO(0, "success", pagination);
}
 
开发者ID:wu05281,项目名称:admin-shiro,代码行数:23,代码来源:AdminCtl.java

示例2: createPerson

import org.thymeleaf.util.StringUtils; //导入依赖的package包/类
@Override
protected Person createPerson(String personType) {
    if (StringUtils.isEmpty(personType)) {
        return new NullPerson();
    }

    switch (personType.toLowerCase()) {
        case "w":
        case "work":
        case "worker":
            return new Worker();

        case "m":
        case "manager":
            return new Manager();

        default:
            return new NullPerson();
    }
}
 
开发者ID:bmariesan,项目名称:iStudent,代码行数:21,代码来源:FactoryMethodCompany.java

示例3: hasAllRoles

import org.thymeleaf.util.StringUtils; //导入依赖的package包/类
public static boolean hasAllRoles(final Collection<String> roles) {
	if (SecurityUtils.getSubject() != null) {
		if (roles.isEmpty()) {
			return false;
		}

		final Subject subject = SecurityUtils.getSubject();
		for (final String role : roles) {
			if (!subject.hasRole(StringUtils.trim(role))) {
				return false;
			}
		}
		return true;
	}
	return false;
}
 
开发者ID:usydapeng,项目名称:thymeleaf3-shiro,代码行数:17,代码来源:ShiroFacade.java

示例4: apiDocumentationV2Security

import org.thymeleaf.util.StringUtils; //导入依赖的package包/类
@Bean
@ConditionalOnProperty(value="appverse.frontfacade.swagger.docket.enable", matchIfMissing=true)
public Docket apiDocumentationV2Security() {
	Docket docket =  new Docket(DocumentationType.SWAGGER_2);
	if (!StringUtils.isEmpty(swaggerHost)){
		docket.host(swaggerHost);
	}
	docket.groupName("default-group").apiInfo(apiInfo()).select().paths(defaultGroup()).build();
	if (swaggerOauth2SupportEnabled) {
		// This causes duplicated contextpath in Swagger UI 
		// .pathMapping(apiPath)
		docket.securitySchemes(Arrays.asList(securitySchema()))
				.securityContexts(Arrays.asList(securityContext()));
	}

	return docket;
}
 
开发者ID:Appverse,项目名称:appverse-server,代码行数:18,代码来源:SwaggerDefaultSetup.java

示例5: hasAllRoles

import org.thymeleaf.util.StringUtils; //导入依赖的package包/类
public static boolean hasAllRoles(final Collection<String> roles) {
    if (SecurityUtils.getSubject() != null) {
        if (roles.isEmpty()) {
            return false;
        }

        final Subject subject = SecurityUtils.getSubject();
        for (final String role : roles) {
            if (!subject.hasRole(StringUtils.trim(role))) {
                return false;
            }
        }
        return true;
    }
    return false;
}
 
开发者ID:theborakompanioni,项目名称:thymeleaf-extras-shiro,代码行数:17,代码来源:ShiroFacade.java

示例6: getPerson

import org.thymeleaf.util.StringUtils; //导入依赖的package包/类
public Person getPerson(String s) {

        if (StringUtils.isEmpty(s)) {
            return new NullPerson();
        }

        switch (s.toLowerCase()) {
            case "st":
            case "student":
                return new Student();

            case "sec":
            case "secr":
            case "secretary":
                return new Secretary();

            case "t":
            case "teacher":
            case "p":
            case "prof":
            case "professor":
                return new Professor();

            default:
                return new NullPerson();
        }
    }
 
开发者ID:bmariesan,项目名称:iStudent,代码行数:28,代码来源:FactorySimple.java

示例7: createPerson

import org.thymeleaf.util.StringUtils; //导入依赖的package包/类
@Override
protected Person createPerson(String personType) {
    if (StringUtils.isEmpty(personType)) {
        return new NullPerson();
    }

    /**
     * TODO Extract this creation logic.
     */
    switch (personType.toLowerCase()) {
        case "st":
        case "student":
            return new Student();

        case "sec":
        case "secr":
        case "secretary":
            return new Secretary();

        case "t":
        case "teacher":
        case "p":
        case "prof":
        case "professor":
            return new Professor();

        default:
            return new NullPerson();
    }
}
 
开发者ID:bmariesan,项目名称:iStudent,代码行数:31,代码来源:FactoryMethodUniversity.java

示例8: isUserServerMod

import org.thymeleaf.util.StringUtils; //导入依赖的package包/类
protected static boolean isUserServerMod(CommandEvent commandEvent, Config config) {
    boolean isServerMod = false;
    final String modPermissionGroup = config.getModPermissionGroup();
    if (!StringUtils.isEmpty(modPermissionGroup)) {
        for (Role role : commandEvent.getMember().getRoles()) {
            if (modPermissionGroup.trim().toLowerCase().equalsIgnoreCase(role.getName().toLowerCase())) {
                isServerMod = true;
                break;
            }
        }
    }
    return isServerMod;
}
 
开发者ID:magnusmickelsson,项目名称:pokeraidbot,代码行数:14,代码来源:ConfigAwareCommand.java

示例9: hasAnyRoles

import org.thymeleaf.util.StringUtils; //导入依赖的package包/类
public static boolean hasAnyRoles(final Collection<String> roles) {
	if (SecurityUtils.getSubject() != null) {
		final Subject subject = SecurityUtils.getSubject();
		for (final String role : roles) {
			if (subject.hasRole(StringUtils.trim(role))) {
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:usydapeng,项目名称:thymeleaf3-shiro,代码行数:12,代码来源:ShiroFacade.java

示例10: evaluateAsStringsWithDelimiter

import org.thymeleaf.util.StringUtils; //导入依赖的package包/类
public static List<String> evaluateAsStringsWithDelimiter(ITemplateContext arguments, String rawValue, String delimiter) {
    notNull(arguments, "arguments must not be null");
    notEmpty(rawValue, "rawValue must not be empty");
    notEmpty(delimiter, "delimiter must not be empty");

    final List<String> result = new ArrayList<String>();
    final List<Object> iterates = evaluateAsIterableOrRawValue(arguments, rawValue);

    for (Object o : iterates) {
        result.addAll(asList(StringUtils.split(o, delimiter)));
    }

    return unmodifiableList(result);
}
 
开发者ID:theborakompanioni,项目名称:thymeleaf-extras-shiro,代码行数:15,代码来源:ThymeleafFacade.java

示例11: hasAnyRoles

import org.thymeleaf.util.StringUtils; //导入依赖的package包/类
public static boolean hasAnyRoles(final Collection<String> roles) {
    if (SecurityUtils.getSubject() != null) {
        final Subject subject = SecurityUtils.getSubject();
        for (final String role : roles) {
            if (subject.hasRole(StringUtils.trim(role))) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:theborakompanioni,项目名称:thymeleaf-extras-shiro,代码行数:12,代码来源:ShiroFacade.java

示例12: changeAnswer

import org.thymeleaf.util.StringUtils; //导入依赖的package包/类
private static List<String> changeAnswer(String answer){
    if(answer==null|| StringUtils.trim(answer).length()==0)return null;
    String[] strings=answer.split(",");
    return Arrays.asList(strings);
}
 
开发者ID:ju5t1nhhh,项目名称:CMSdemo,代码行数:6,代码来源:FeedbackUtil.java

示例13: getMessageHtml

import org.thymeleaf.util.StringUtils; //导入依赖的package包/类
public String getMessageHtml() {
    return StringUtils.escapeXml(message).replace("\n", "<br />\n");
}
 
开发者ID:checkstyle,项目名称:contribution,代码行数:4,代码来源:CheckstyleRecord.java

示例14: getFieldSetter

import org.thymeleaf.util.StringUtils; //导入依赖的package包/类
/**
 * Find the fields setter method. This is a simple search and it looks for get plus the variable name capitalised.
 * For example
 * name     => setName
 * bigName  => setBigName
 *
 * @param objectClass - The object we are searching in
 * @param fieldName   - The name of the field we want to find the setter for
 * @param fieldType   the field type
 * @return - The setter method
 * @throws NoSuchMethodException the no such method exception
 */
private Method getFieldSetter(final Class<?> objectClass,
                              final String fieldName,
                              final Class fieldType) throws NoSuchMethodException {
    return objectClass.getMethod("set" + StringUtils.capitalize(fieldName), fieldType);
}
 
开发者ID:mhaddon,项目名称:Sound.je,代码行数:18,代码来源:FormParse.java

示例15: getFieldGetter

import org.thymeleaf.util.StringUtils; //导入依赖的package包/类
/**
 * Find the fields getter method. This is a simple search and it looks for get plus the variable name capitalised.
 * For example
 * name     => getName
 * bigName  => getBigName
 *
 * @param objectClass - The object we are searching in
 * @param fieldName   - The name of the field we want to find the getter for
 * @return - The getter method
 * @throws NoSuchMethodException the no such method exception
 */
private Method getFieldGetter(final Class<?> objectClass, final String fieldName) throws NoSuchMethodException {
    return objectClass.getMethod("get" + StringUtils.capitalize(fieldName));
}
 
开发者ID:mhaddon,项目名称:Sound.je,代码行数:15,代码来源:FormParse.java


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