/** * 返回jsp视图 * @param path * @return */ public static String jsp(String path) { return path.concat(".jsp"); }
/** Returns a key for the members of {@code type}. */ public static String getMembersKey(Class<?> key) { // for classes key.getName() is equivalent to get(key) return "members/".concat(key.getName()); }
public static void assertClassSourcesGeneratedToOutput(Class<?> clazz) { String canonicalName = clazz.getCanonicalName(); String filePath = canonicalName.replace(".", "/").concat(".java"); File generatedSourcesDir = new File(OUTPUT_DIRECTORY); File generatedSourceFile = new File(generatedSourcesDir, filePath); File sourcesDir = new File(MAIN_SOURCE_FOLDER); File expectedResult = new File(sourcesDir, filePath); assertOutput(expectedResult, generatedSourceFile); }
public static void assertClassSourcesNotGeneratedToOutput(Class<?> clazz) { String canonicalName = clazz.getCanonicalName(); String filePath = canonicalName.replace(".", "/").concat(".java"); File generatedSourcesDir = new File(OUTPUT_DIRECTORY); File output = new File(generatedSourcesDir, filePath); assertFalse(output.exists()); }
/** * {@inheritDoc} */ public String getName() { return NAME_PREFIX.concat(String.valueOf(getIndex())); }
@Override protected ModuleAdapter<?> create(Class<?> type) { ModuleAdapter<?> result = instantiate(type.getName().concat(MODULE_ADAPTER_SUFFIX), type.getClassLoader()); if (result == null) { throw new IllegalStateException("Module adapter for " + type + " could not be loaded. " + "Please ensure that code generation was run for this module."); } return result; } };
/** * Find a {@code VersionStrategy} for the request path of the requested resource. * @return an instance of a {@code VersionStrategy} or null if none matches that request path */ @Nullable protected VersionStrategy getStrategyForPath(String requestPath) { String path = "/".concat(requestPath); List<String> matchingPatterns = new ArrayList<>(); for (String pattern : this.versionStrategyMap.keySet()) { if (this.pathMatcher.match(pattern, path)) { matchingPatterns.add(pattern); } } if (!matchingPatterns.isEmpty()) { Comparator<String> comparator = this.pathMatcher.getPatternComparator(path); matchingPatterns.sort(comparator); return this.versionStrategyMap.get(matchingPatterns.get(0)); } return null; }
/** * Find a {@code VersionStrategy} for the request path of the requested resource. * @return an instance of a {@code VersionStrategy} or null if none matches that request path */ @Nullable protected VersionStrategy getStrategyForPath(String requestPath) { String path = "/".concat(requestPath); List<String> matchingPatterns = new ArrayList<>(); for (String pattern : this.versionStrategyMap.keySet()) { if (this.pathMatcher.match(pattern, path)) { matchingPatterns.add(pattern); } } if (!matchingPatterns.isEmpty()) { Comparator<String> comparator = this.pathMatcher.getPatternComparator(path); matchingPatterns.sort(comparator); return this.versionStrategyMap.get(matchingPatterns.get(0)); } return null; }
@Override public OssCallbackResult callback(HttpServletRequest request) { OssCallbackResult result= new OssCallbackResult(); String filename = request.getParameter("filename"); filename = "http://".concat(ALIYUN_OSS_BUCKET_NAME).concat(".").concat(ALIYUN_OSS_ENDPOINT).concat("/").concat(filename); result.setFilename(filename); result.setSize(request.getParameter("size")); result.setMimeType(request.getParameter("mimeType")); result.setWidth(request.getParameter("width")); result.setHeight(request.getParameter("height")); return result; }
@Override public String saveStaticFile(InputStream fileStream, String fileName) throws IOException { //文件后缀 String suffix = fileName.contains(".") ? fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length()) : ""; StorePath path = fastFileStorageClient.uploadFile(fileStream, fileStream.available(), suffix, new HashSet<>()); return staticLocation.concat(path.getFullPath()); }
@Override public StaticInjection getStaticInjection(Class<?> injectedClass) { StaticInjection result = instantiate( injectedClass.getName().concat(STATIC_INJECTION_SUFFIX), injectedClass.getClassLoader()); if (result != null) { return result; } return ReflectiveStaticInjection.create(injectedClass); } }
protected String createLockName(String expression) { try { if (StringUtils.isEmpty(expression)) { return interceptorHolder.getMethod().getName().concat("_").concat(interceptorHolder.getId()); } return ExpressionUtils.analytical(expression, interceptorHolder.getArgs(), "spel"); } catch (Exception e) { throw new RuntimeException(e); } }
private void initI18n(){ for (ExecutorBlockStrategyEnum item:ExecutorBlockStrategyEnum.values()) { item.setTitle(I18nUtil.getString("jobconf_block_".concat(item.name()))); } }
protected void applyBasicAuthParam(OAuth2Request request) { request.param(client_id, serverConfig.getClientId()); request.param(client_secret, serverConfig.getClientSecret()); request.param(redirect_uri, serverConfig.getRedirectUri()); request.header(authorization, encodeAuthorization(serverConfig.getClientId().concat(":").concat(serverConfig.getClientSecret()))); }
@Override public ProducerRecord<String, String> onSend(ProducerRecord<String, String> record) { ONSEND_COUNT.incrementAndGet(); return new ProducerRecord<>( record.topic(), record.partition(), record.key(), record.value().concat(appendStr)); }
@Override public ProducerRecord<Integer, String> onSend(ProducerRecord<Integer, String> record) { onSendCount++; if (throwExceptionOnSend) throw new KafkaException("Injected exception in AppendProducerInterceptor.onSend"); return new ProducerRecord<>( record.topic(), record.partition(), record.key(), record.value().concat(appendStr)); }