本文整理汇总了Java中org.jboss.forge.furnace.util.Strings类的典型用法代码示例。如果您正苦于以下问题:Java Strings类的具体用法?Java Strings怎么用?Java Strings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Strings类属于org.jboss.forge.furnace.util包,在下文中一共展示了Strings类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createCommitMessage
import org.jboss.forge.furnace.util.Strings; //导入依赖的package包/类
/**
* Lets generate a commit message with the command name and all the parameters we specify
*/
public static String createCommitMessage(String name, ExecutionRequest executionRequest) {
StringBuilder builder = new StringBuilder(name);
List<Map<String, Object>> inputList = executionRequest.getInputList();
for (Map<String, Object> map : inputList) {
Set<Map.Entry<String, Object>> entries = map.entrySet();
for (Map.Entry<String, Object> entry : entries) {
String key = entry.getKey();
String textValue = null;
Object value = entry.getValue();
if (value != null) {
textValue = value.toString();
}
if (!Strings.isNullOrEmpty(textValue) && !textValue.equals("0") && !textValue.toLowerCase().equals("false")) {
builder.append(" --");
builder.append(key);
builder.append("=");
builder.append(textValue);
}
}
}
return builder.toString();
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:26,代码来源:ExecutionRequest.java
示例2: getGogsURL
import org.jboss.forge.furnace.util.Strings; //导入依赖的package包/类
protected String getGogsURL(boolean external) {
StopWatch watch = new StopWatch();
String namespace = kubernetesClient.getNamespace();
if (Strings.isNullOrEmpty(namespace)) {
namespace = KubernetesHelper.defaultNamespace();
}
String serviceName = GOGS;
String answer = KubernetesHelper.getServiceURL(kubernetesClient, serviceName, namespace, "http", external);
if (Strings.isNullOrEmpty(answer)) {
String kind = external ? "external" : "internal";
throw new IllegalStateException("Could not find external URL for " + kind + " service: gogs!");
}
if (!external) {
// lets stick with the service name instead as its easier to grok
return "http://" + serviceName + "/";
}
LOG.info("getGogsURL took " + watch.taken());
return answer;
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:22,代码来源:GitUserHelper.java
示例3: preprocessRequest
import org.jboss.forge.furnace.util.Strings; //导入依赖的package包/类
@Override
public UserDetails preprocessRequest(String name, ExecutionRequest executionRequest, HttpServletRequest request) {
StopWatch watch = new StopWatch();
UserDetails userDetails = gitUserHelper.createUserDetails(request);
// TODO this isn't really required if there's a secret associated with the BuildConfig source
if (Strings.isNullOrEmpty(userDetails.getUser()) || Strings.isNullOrEmpty(userDetails.getUser())) {
throw new NotAuthorizedException("You must authenticate to be able to perform this command");
}
if (Objects.equals(name, Constants.PROJECT_NEW_COMMAND)) {
List<Map<String, Object>> inputList = executionRequest.getInputList();
if (inputList != null) {
Map<String, Object> page1 = inputList.get(0);
if (page1 != null) {
if (page1.containsKey(Constants.TARGET_LOCATION_PROPERTY)) {
page1.put(Constants.TARGET_LOCATION_PROPERTY, projectFileSystem.getUserProjectFolderLocation(userDetails));
}
}
}
}
LOG.info("preprocessRequest took " + watch.taken());
return userDetails;
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:27,代码来源:GitCommandCompletePostProcessor.java
示例4: initializeUI
import org.jboss.forge.furnace.util.Strings; //导入依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) throws Exception
{
ConnectionProfileManager manager = managerProvider.getConnectionProfileManager();
profiles = manager.loadConnectionProfiles();
ArrayList<String> profileNames = new ArrayList<String>();
profileNames.add("");
profileNames.addAll(profiles.keySet());
connectionProfile.setValueChoices(profileNames);
connectionProfile.setValue("");
connectionProfilePassword.setEnabled(new Callable<Boolean>()
{
@Override
public Boolean call() throws Exception
{
String connectionProfileName = connectionProfile.getValue();
if (Strings.isNullOrEmpty(connectionProfileName))
return false;
return !profiles.get(connectionProfileName).isSavePassword();
}
});
builder.add(connectionProfile).add(connectionProfilePassword);
}
开发者ID:forge,项目名称:db-migration-addon,代码行数:25,代码来源:SetPropertiesCommand.java
示例5: apply
import org.jboss.forge.furnace.util.Strings; //导入依赖的package包/类
@Override
public void apply(Configuration config)
{
// Main Class
config.removeConfigurationElement(MAIN_CLASS_CONFIGURATION_ELEMENT);
if (!Strings.isNullOrEmpty(getMainClass()) && !MAIN_CLASS_DEFAULT_VALUE.equals(getMainClass()))
{
config.addConfigurationElement(ConfigurationElementBuilder.create()
.setName(MAIN_CLASS_CONFIGURATION_ELEMENT).setText(getMainClass()));
}
// Properties
ConfigurationElementBuilder properties = ConfigurationElementBuilder.create().setName("properties");
this.properties.forEach((key, value) -> properties.addChild(key).setText(value));
config.removeConfigurationElement("properties");
if (properties.hasChildren())
{
config.addConfigurationElement(properties);
}
}
开发者ID:forge,项目名称:wildfly-swarm-addon,代码行数:21,代码来源:WildFlySwarmConfigurationBuilder.java
示例6: getSpecificationVersionFor
import org.jboss.forge.furnace.util.Strings; //导入依赖的package包/类
/**
* Returns the Specification version for the given {@link Class}
*
* @param type the {@link Class} with the corresponding package
* @return {@link Version} representation from the {@link Package#getSpecificationVersion()} returned from
* {@link Class#getPackage()}
*/
public static Version getSpecificationVersionFor(Class<?> type)
{
Assert.notNull(type, "Type must not be null.");
final Version result;
Package pkg = type.getPackage();
if (pkg == null)
{
result = EmptyVersion.getInstance();
}
else
{
String version = pkg.getSpecificationVersion();
if (Strings.isNullOrEmpty(version))
{
result = EmptyVersion.getInstance();
}
else
{
result = SingleVersion.valueOf(version);
}
}
return result;
}
开发者ID:forge,项目名称:furnace,代码行数:31,代码来源:Versions.java
示例7: getImplementationVersionFor
import org.jboss.forge.furnace.util.Strings; //导入依赖的package包/类
/**
* Returns the Implementation version for the given {@link Class}
*
* @param type the {@link Class} with the corresponding package
* @return {@link Version} representation from the {@link Package#getImplementationVersion()} returned from
* {@link Class#getPackage()}
*/
public static Version getImplementationVersionFor(Class<?> type)
{
Assert.notNull(type, "Type must not be null.");
final Version result;
Package pkg = type.getPackage();
if (pkg == null)
{
result = EmptyVersion.getInstance();
}
else
{
String version = pkg.getImplementationVersion();
if (Strings.isNullOrEmpty(version))
{
result = EmptyVersion.getInstance();
}
else
{
result = SingleVersion.valueOf(version);
}
}
return result;
}
开发者ID:forge,项目名称:furnace,代码行数:31,代码来源:Versions.java
示例8: messageFrom
import org.jboss.forge.furnace.util.Strings; //导入依赖的package包/类
private static String messageFrom(Result result)
{
if (result != null)
{
if (!Strings.isNullOrEmpty(result.getMessage()))
{
return result.getMessage();
}
if (result instanceof Failed)
{
return FAILURE_MESSAGE;
}
}
return SUCCESS_MESSAGE;
}
开发者ID:forge,项目名称:intellij-idea-plugin,代码行数:17,代码来源:ForgeNotifications.java
示例9: extractDataSourceMetadata
import org.jboss.forge.furnace.util.Strings; //导入依赖的package包/类
private void extractDataSourceMetadata(GraphRewrite event, JavaTypeReferenceModel javaTypeReference)
{
javaTypeReference.getFile().setGenerateSourceReport(true);
JavaAnnotationTypeReferenceModel annotationTypeReference = (JavaAnnotationTypeReferenceModel) javaTypeReference;
JavaClassModel datasourceClass = getJavaClass(javaTypeReference);
String dataSourceName = getAnnotationLiteralValue(annotationTypeReference, "name");
if (Strings.isNullOrEmpty(dataSourceName))
{
dataSourceName = datasourceClass.getClassName();
}
String isXaString = getAnnotationLiteralValue(annotationTypeReference, "transactional");
boolean isXa = isXaString == null || Boolean.getBoolean(isXaString);
Service<DataSourceModel> dataSourceService = new GraphService<>(event.getGraphContext(), DataSourceModel.class);
DataSourceModel dataSourceModel = dataSourceService.create();
Set<ProjectModel> applications = ProjectTraversalCache.getApplicationsForProject(event.getGraphContext(), javaTypeReference.getFile().getProjectModel());
dataSourceModel.setApplications(applications);
dataSourceModel.setName(dataSourceName);
dataSourceModel.setXa(isXa);
dataSourceModel.setJndiLocation(dataSourceName);
}
开发者ID:windup,项目名称:windup,代码行数:27,代码来源:DiscoverDataSourceAnnotationRuleProvider.java
示例10: extractEJBMetadata
import org.jboss.forge.furnace.util.Strings; //导入依赖的package包/类
private void extractEJBMetadata(GraphRewrite event, JavaTypeReferenceModel javaTypeReference)
{
javaTypeReference.getFile().setGenerateSourceReport(true);
JavaAnnotationTypeReferenceModel annotationTypeReference = (JavaAnnotationTypeReferenceModel) javaTypeReference;
JavaClassModel ejbClass = getJavaClass(javaTypeReference);
String ejbName = getAnnotationLiteralValue(annotationTypeReference, "name");
if (Strings.isNullOrEmpty(ejbName))
{
ejbName = ejbClass.getClassName();
}
String sessionType = javaTypeReference.getResolvedSourceSnippit()
.substring(javaTypeReference.getResolvedSourceSnippit().lastIndexOf(".") + 1);
Service<EjbSessionBeanModel> sessionBeanService = new GraphService<>(event.getGraphContext(), EjbSessionBeanModel.class);
EjbSessionBeanModel sessionBean = sessionBeanService.create();
Set<ProjectModel> applications = ProjectTraversalCache.getApplicationsForProject(event.getGraphContext(), javaTypeReference.getFile().getProjectModel());
sessionBean.setApplications(applications);
sessionBean.setBeanName(ejbName);
sessionBean.setEjbClass(ejbClass);
sessionBean.setSessionType(sessionType);
}
开发者ID:windup,项目名称:windup,代码行数:26,代码来源:DiscoverEjbAnnotationsRuleProvider.java
示例11: hasTags
import org.jboss.forge.furnace.util.Strings; //导入依赖的package包/类
@Override
public boolean hasTags(String tag, String... tags)
{
Set<String> expected = new HashSet<>();
if (!Strings.isNullOrEmpty(tag))
expected.add(tag);
if (tags != null)
{
for (String t : tags)
{
if (!Strings.isNullOrEmpty(tag))
expected.add(t);
}
}
return getTags().containsAll(expected);
}
开发者ID:windup,项目名称:windup,代码行数:19,代码来源:AbstractRulesetMetadata.java
示例12: getGithubRepositoryNameValue
import org.jboss.forge.furnace.util.Strings; //导入依赖的package包/类
protected String getGithubRepositoryNameValue() {
String repository = gitHubRepositoryName.getValue();
if (Strings.isNullOrEmpty(repository)) {
repository = named.getValue();
}
return repository;
}
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:8,代码来源:ProjectInfoStep.java
示例13: getSystemPropertyOrDefault
import org.jboss.forge.furnace.util.Strings; //导入依赖的package包/类
public static String getSystemPropertyOrDefault(String envVarName, String defaultValue) {
String answer = System.getenv(envVarName);
if (Strings.isNullOrEmpty(answer)) {
return defaultValue;
}
return answer;
}
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:8,代码来源:JenkinsPipelineLibrary.java
示例14: GitCommandCompletePostProcessor
import org.jboss.forge.furnace.util.Strings; //导入依赖的package包/类
@Inject
public GitCommandCompletePostProcessor(KubernetesClient kubernetes,
GitUserHelper gitUserHelper,
ProjectFileSystem projectFileSystem) {
this.kubernetes = kubernetes;
this.gitUserHelper = gitUserHelper;
this.projectFileSystem = projectFileSystem;
this.useLocalGitHost = true;
String useExternalGit = System.getenv("USE_EXTERNAL_GIT_ADDRESS");
if (!Strings.isNullOrEmpty(useExternalGit) && useExternalGit.toLowerCase().equals("true")){
useLocalGitHost = false;
}
LOG.info("Using " + (useLocalGitHost ? "internal" : "external") + " URLs for hosted git repositories");
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:15,代码来源:GitCommandCompletePostProcessor.java
示例15: firstNotBlank
import org.jboss.forge.furnace.util.Strings; //导入依赖的package包/类
public static String firstNotBlank(String... texts) {
for (String text : texts) {
if (!Strings.isNullOrEmpty(text)) {
return text;
}
}
return null;
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:9,代码来源:GitCommandCompletePostProcessor.java
示例16: findSingleFileInDirectory
import org.jboss.forge.furnace.util.Strings; //导入依赖的package包/类
private String findSingleFileInDirectory(File baseDir, String directoryPath, String... extensions) {
File dir = baseDir;
if (!Strings.isNullOrEmpty(directoryPath)) {
dir = new File(baseDir, directoryPath);
}
if (dir.isDirectory()) {
File[] files = dir.listFiles();
if (files != null) {
for (File file : files) {
for (String extension : extensions) {
if (file.getName().endsWith(extension)) {
try {
return Files.getRelativePath(baseDir, file);
} catch (IOException e) {
LOG.warn("Failed to calculate relative path of " + file + ". " + e, e);
}
}
}
}
System.out.println("No files with extensions " + Arrays.asList(extensions) + " for files: " + Arrays.asList(files));
} else {
System.out.println("No files in directory: " + dir.getAbsolutePath());
}
} else {
System.out.println("Not a direcotry: " + dir.getAbsolutePath());
}
return null;
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:29,代码来源:GetOverviewCommand.java
示例17: execute
import org.jboss.forge.furnace.util.Strings; //导入依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception {
UIContext uiContext = context.getUIContext();
Project project = (Project) uiContext.getAttributeMap().get(Project.class);
Archetype chosenArchetype = archetype.getValue();
String coordinate = chosenArchetype.getGroupId() + ":" + chosenArchetype.getArtifactId() + ":"
+ chosenArchetype.getVersion();
DependencyQueryBuilder depQuery = DependencyQueryBuilder.create(coordinate);
String repository = chosenArchetype.getRepository();
if (!Strings.isNullOrEmpty(repository)) {
if (repository.endsWith(".xml")) {
int lastRepositoryPath = repository.lastIndexOf('/');
if (lastRepositoryPath > -1)
repository = repository.substring(0, lastRepositoryPath);
}
if (!repository.isEmpty()) {
depQuery.setRepositories(new DependencyRepository("archetype", repository));
}
}
Dependency resolvedArtifact = dependencyResolver.resolveArtifact(depQuery);
FileResource<?> artifact = resolvedArtifact.getArtifact();
MetadataFacet metadataFacet = project.getFacet(MetadataFacet.class);
File fileRoot = project.getRoot().reify(DirectoryResource.class).getUnderlyingResourceObject();
ArchetypeHelper archetypeHelper = new ArchetypeHelper(artifact.getResourceInputStream(), fileRoot,
metadataFacet.getProjectGroupName(), metadataFacet.getProjectName(), metadataFacet.getProjectVersion());
JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
archetypeHelper.setPackageName(facet.getBasePackage());
archetypeHelper.execute();
return Results.success();
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:31,代码来源:FunktionArchetypeSelectionWizardStep.java
示例18: getGithubRepositoryNameValue
import org.jboss.forge.furnace.util.Strings; //导入依赖的package包/类
protected String getGithubRepositoryNameValue()
{
String repository = gitHubRepositoryName.getValue();
if (Strings.isNullOrEmpty(repository))
{
repository = named.getValue();
}
return repository;
}
开发者ID:fabric8-launcher,项目名称:launchpad-addon,代码行数:10,代码来源:ProjectInfoStep.java
示例19: isExported
import org.jboss.forge.furnace.util.Strings; //导入依赖的package包/类
/**
* @param scope the scope to be tested upon
* @return <code>true</code> if the scope indicates an exported dependency
*/
public static boolean isExported(String scope)
{
String artifactScope = Strings.isNullOrEmpty(scope) ? JavaScopes.COMPILE : scope;
switch (artifactScope)
{
case JavaScopes.COMPILE:
case JavaScopes.RUNTIME:
return true;
case JavaScopes.PROVIDED:
default:
return false;
}
}
开发者ID:forge,项目名称:furnace,代码行数:18,代码来源:MavenAddonDependencyResolver.java
示例20: validate
import org.jboss.forge.furnace.util.Strings; //导入依赖的package包/类
private void validate(Method deploymentMethod)
{
if (!Modifier.isStatic(deploymentMethod.getModifiers()))
{
throw new IllegalArgumentException("Method annotated with " + Deployment.class.getName() + " is not static. "
+ deploymentMethod);
}
if (!Archive.class.isAssignableFrom(deploymentMethod.getReturnType())
&& !Descriptor.class.isAssignableFrom(deploymentMethod.getReturnType()))
{
throw new IllegalArgumentException(
"Method annotated with " + Deployment.class.getName() +
" must have return type " + Archive.class.getName() + " or " + Descriptor.class.getName()
+ ". " + deploymentMethod);
}
if (deploymentMethod.getParameterTypes().length != 0)
{
throw new IllegalArgumentException("Method annotated with " + Deployment.class.getName()
+ " can not accept parameters. " + deploymentMethod);
}
String name = deploymentMethod.getAnnotation(Deployment.class).name();
try
{
if (!Strings.isNullOrEmpty(name) && !"_DEFAULT_".equals(name))
AddonId.fromCoordinates(name);
}
catch (IllegalArgumentException e)
{
throw new IllegalArgumentException("@" + Deployment.class.getName()
+ " requires name in the format \"name,version\", but was \"" + name + "\". ");
}
}
开发者ID:forge,项目名称:furnace,代码行数:35,代码来源:FurnaceDeploymentScenarioGenerator.java
注:本文中的org.jboss.forge.furnace.util.Strings类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论