本文整理汇总了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);
}
示例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();
}
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例13: getMessageHtml
import org.thymeleaf.util.StringUtils; //导入依赖的package包/类
public String getMessageHtml() {
return StringUtils.escapeXml(message).replace("\n", "<br />\n");
}
示例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);
}
示例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));
}