Java Code Examples for org.springframework.util.StringUtils#unqualify()
The following examples show how to use
org.springframework.util.StringUtils#unqualify() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MobileService.java From agent with MIT License | 6 votes |
public Response installApp(MultipartFile app, String mobileId) { Device device = DeviceHolder.getConnectedDevice(mobileId); if (device == null) { return Response.fail(mobileId + "未连接"); } String fileName = app.getOriginalFilename(); if (fileName.contains(".")) { fileName = UUIDUtil.getUUID() + "." + StringUtils.unqualify(fileName); } else { fileName = UUIDUtil.getUUID(); } File appFile = new File(fileName); try { FileUtils.copyInputStreamToFile(app.getInputStream(), appFile); ((MobileDevice) device).installApp(appFile); return Response.success("安装成功"); } catch (Exception e) { log.error("[{}]安装app失败", mobileId, e); return Response.fail(e.getMessage()); } finally { FileUtils.deleteQuietly(appFile); } }
Example 2
Source File: BaseJpaDaoImpl.java From herd with Apache License 2.0 | 6 votes |
@Override public <T> List<T> findByNamedProperties(Class<T> entityClass, Map<String, ?> params) { Validate.notNull(entityClass); Validate.notEmpty(params); StringBuilder queryStringBuilder = new StringBuilder("select type from " + StringUtils.unqualify(entityClass.getName()) + " type where "); Iterator<String> iterator = params.keySet().iterator(); int index = 0; while (iterator.hasNext()) { String propertyName = iterator.next(); if (index > 0) { queryStringBuilder.append(" and "); } queryStringBuilder.append("(type.").append(propertyName).append(" = :").append(propertyName).append(')'); index++; } return queryByNamedParams(queryStringBuilder.toString(), params); }
Example 3
Source File: HttpUtil.java From agent with MIT License | 5 votes |
public static File downloadFile(String url, boolean renameFile) throws IOException { String fileName = url.substring(url.lastIndexOf("/") + 1); if (renameFile) { if (fileName.contains(".")) { fileName = UUIDUtil.getUUID() + "." + StringUtils.unqualify(fileName); } else { fileName = UUIDUtil.getUUID(); } } File file = new File(fileName); downloadFile(url, file); return file; }
Example 4
Source File: ClassFieldDeclarationRule.java From springmvc-raml-plugin with Apache License 2.0 | 5 votes |
public ClassFieldDeclarationRule(String restTemplateFieldName, Class<?> fieldClazz) { if (fieldClazz != null) { this.fieldClazz = fieldClazz; } else { throw new IllegalStateException("Class not specified"); } if (StringUtils.hasText(restTemplateFieldName)) { this.fieldName = restTemplateFieldName; } else { this.fieldName = StringUtils.unqualify(fieldClazz.getSimpleName()); } }