• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Completion类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getAllPossibleValues

import org.springframework.shell.core.Completion; //导入依赖的package包/类
@Override
public boolean getAllPossibleValues(List<Completion> completions, Class<?> targetType,
    String[] existingData, String context, MethodTarget target) {
  String adjustedUserInput = convertUserInputIntoAFullyQualifiedPath(
      (existingData != null) ? existingData[existingData.length - 1] : "");

  String directoryData =
      adjustedUserInput.substring(0, adjustedUserInput.lastIndexOf(File.separator) + 1);
  adjustedUserInput =
      adjustedUserInput.substring(adjustedUserInput.lastIndexOf(File.separator) + 1);

  populate(completions, adjustedUserInput,
      ((existingData != null) ? existingData[existingData.length - 1] : ""), directoryData);

  return true;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:17,代码来源:DirConverter.java


示例2: populate

import org.springframework.shell.core.Completion; //导入依赖的package包/类
protected void populate(final List<Completion> completions, final String adjustedUserInput,
    final String originalUserInput, final String directoryData) {
  File directory = new File(directoryData);

  if (!directory.isDirectory()) {
    return;
  }

  for (File file : directory.listFiles()) {
    if (adjustedUserInput == null || adjustedUserInput.length() == 0
        || file.getName().toLowerCase().startsWith(adjustedUserInput.toLowerCase())) {

      String completion = "";
      if (directoryData.length() > 0)
        completion += directoryData;
      completion += file.getName();

      completion = convertCompletionBackIntoUserInputStyle(originalUserInput, completion);

      if (file.isDirectory()) {
        completions.add(new Completion(completion + File.separator));
      }
    }
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:26,代码来源:DirConverter.java


示例3: getAllPossibleValues

import org.springframework.shell.core.Completion; //导入依赖的package包/类
public boolean getAllPossibleValues(final List<Completion> completions,
    final Class<?> requiredType, final String existingData, final String optionContext,
    final MethodTarget target) {
  Class<Enum> enumClass = (Class<Enum>) requiredType;
  for (Enum enumValue : enumClass.getEnumConstants()) {
    String candidate = enumValue.name();
    // GemFire/gfsh addition - check 'existingData == null'. GfshParser can
    // pass existingData as null
    if ("".equals(existingData) || existingData == null || candidate.startsWith(existingData)
        || existingData.startsWith(candidate)
        || candidate.toUpperCase().startsWith(existingData.toUpperCase())
        || existingData.toUpperCase().startsWith(candidate.toUpperCase())) {
      completions.add(new Completion(candidate));
    }
  }
  return true;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:18,代码来源:EnumConverter.java


示例4: getAllPossibleValues

import org.springframework.shell.core.Completion; //导入依赖的package包/类
@Override
public boolean getAllPossibleValues(List<Completion> completions, Class<?> targetType,
    String existingData, String optionContext, MethodTarget target) {
  if (String.class.equals(targetType) && ConverterHint.DISKSTORE_ALL.equals(optionContext)) {
    Set<String> diskStoreNames = getDiskStoreNames();

    for (String diskStoreName : diskStoreNames) {
      if (existingData != null) {
        if (diskStoreName.startsWith(existingData)) {
          completions.add(new Completion(diskStoreName));
        }
      } else {
        completions.add(new Completion(diskStoreName));
      }
    }
  }

  return !completions.isEmpty();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:20,代码来源:DiskStoreNameConverter.java


示例5: getAllPossibleValues

import org.springframework.shell.core.Completion; //导入依赖的package包/类
@Override
public boolean getAllPossibleValues(List<Completion> completions,
    Class<?> targetType, String[] existingData, String context,
    MethodTarget target) {
  String adjustedUserInput = convertUserInputIntoAFullyQualifiedPath((existingData != null) ? existingData[existingData.length - 1]
      : "");

  String directoryData = adjustedUserInput.substring(0,
      adjustedUserInput.lastIndexOf(File.separator) + 1);
  adjustedUserInput = adjustedUserInput.substring(adjustedUserInput
      .lastIndexOf(File.separator) + 1);

  populate(completions, adjustedUserInput,
      ((existingData != null) ? existingData[existingData.length - 1] : ""),
      directoryData);

  return true;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:19,代码来源:DirConverter.java


示例6: getAllPossibleValues

import org.springframework.shell.core.Completion; //导入依赖的package包/类
public boolean getAllPossibleValues(final List<Completion> completions, 
    final Class<?> requiredType, final String existingData, 
    final String optionContext, final MethodTarget target) {
	Class<Enum> enumClass = (Class<Enum>) requiredType;
	for (Enum enumValue : enumClass.getEnumConstants()) {
		String candidate = enumValue.name();
     // GemFire/gfsh addition - check 'existingData == null'. GfshParser can 
		// pass existingData as null  
     if ("".equals(existingData) || existingData == null
         || candidate.startsWith(existingData)
         || existingData.startsWith(candidate)
         || candidate.toUpperCase().startsWith(existingData.toUpperCase())
         || existingData.toUpperCase().startsWith(candidate.toUpperCase())) {
			completions.add(new Completion(candidate));
		}
	}
	return true;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:19,代码来源:EnumConverter.java


示例7: getAllPossibleValues

import org.springframework.shell.core.Completion; //导入依赖的package包/类
@Override
public boolean getAllPossibleValues(List<Completion> completions,
    Class<?> targetType, String existingData, String optionContext,
    MethodTarget target) {
  if (String.class.equals(targetType) && ConverterHint.DISKSTORE_ALL.equals(optionContext)) {
    Set<String> diskStoreNames = getDiskStoreNames();
    
    for (String diskStoreName : diskStoreNames) {
      if (existingData != null) {
        if (diskStoreName.startsWith(existingData)) {
          completions.add(new Completion(diskStoreName));
        }
      } else {
        completions.add(new Completion(diskStoreName));
      }
    }
  }
  
  return !completions.isEmpty();
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:21,代码来源:DiskStoreNameConverter.java


示例8: getAllPossibleValues

import org.springframework.shell.core.Completion; //导入依赖的package包/类
public boolean getAllPossibleValues(List<Completion> completions, Class<?> targetType, String existingData, String optionContext, MethodTarget target)
{
    if ((String.class.equals(targetType)) && (StringUtils.contains(optionContext, "param.context.region")))
    {
        Set<String> regionPathSet = getAllRegionPaths();
        for (String regionPath : regionPathSet)
        {
            if (existingData != null)
            {
                if (regionPath.startsWith(existingData))
                {
                    completions.add(new Completion(regionPath));
                }
            }
            else
            {
                completions.add(new Completion(regionPath));
            }
        }
    }
    return !completions.isEmpty();
}
 
开发者ID:iisi-nj,项目名称:GemFireLite,代码行数:23,代码来源:RegionConverter.java


示例9: getAllPossibleValues

import org.springframework.shell.core.Completion; //导入依赖的package包/类
@Override
public boolean getAllPossibleValues(List<Completion> completions, Class<?> targetType, String existingData, String optionContext, MethodTarget target)
{
    if ((String.class.equals(targetType)) && (StringUtils.contains(optionContext, "param.context.job.status")))
    {
        Set<String> status = new HashSet<String>();
        status.add("STARTED");
        status.add("COMPLETED");
        for (String regionPath : status)
        {
            if (existingData != null)
            {
                if (regionPath.startsWith(existingData))
                {
                    completions.add(new Completion(regionPath));
                }
            }
            else
            {
                completions.add(new Completion(regionPath));
            }
        }
    }
    return !completions.isEmpty();
}
 
开发者ID:iisi-nj,项目名称:GemFireLite,代码行数:26,代码来源:JobStatusConverter.java


示例10: getAllPossibleValues

import org.springframework.shell.core.Completion; //导入依赖的package包/类
public boolean getAllPossibleValues(List<Completion> completions, Class<?> targetType, String existingData, String optionContext, MethodTarget target)
{
    if ((String.class.equals(targetType)) && (StringUtils.contains(optionContext, "param.context.service.name")))
    {
        Set<ObjectInstance> beans = jmxService.listMBeans();
        for (ObjectInstance bean : beans)
        {
            String name = bean.getObjectName().getCanonicalName();
            if (existingData != null)
            {
                if (name.startsWith(existingData))
                {
                    completions.add(new Completion(name));
                }
            }
            else
            {
                completions.add(new Completion(name));
            }
        }
    }
    return !completions.isEmpty();
}
 
开发者ID:iisi-nj,项目名称:GemFireLite,代码行数:24,代码来源:ServiceNameConverter.java


示例11: getAllPossibleValues

import org.springframework.shell.core.Completion; //导入依赖的package包/类
@Override
public boolean getAllPossibleValues(List<Completion> completions, Class<?> targetType, String existingData,
        String optionContext, MethodTarget target) {
    log.info("Listing possible values. TargetType: {}, Existing data: {}, Option context: {}, Target {}",
            targetType, existingData, optionContext, target);
    boolean completedValues = false;
    try {
        List<StratioStream> streams = cachedStreamsDAO.listStreams();
        log.info("Listed {} streams", streams.size());
        for (int i = 0; i < streams.size(); i++) {
            if (existingData.equals("") || streams.get(i).getStreamName().startsWith(existingData)) {
                log.info("Stream {} start with {}", streams.get(i).getStreamName(), existingData);
                completions.add(new Completion(streams.get(i).getStreamName()));
                if (existingData.equals(streams.get(i).getStreamName())) {
                    log.info("Stream match! {} ", streams.get(i).getStreamName());
                    break;
                }
            }
        }
        return completedValues;
    } catch (Exception e) {
        log.error("Error reading streams", e);
        return false;
    }
}
 
开发者ID:Stratio,项目名称:Decision,代码行数:26,代码来源:StreamConverter.java


示例12: getAllPossibleValues

import org.springframework.shell.core.Completion; //导入依赖的package包/类
@Override
public boolean getAllPossibleValues(List<Completion> completions, Class<?> targetType, String existingData,
		String optionContext, MethodTarget target) {
	for (AppRegistrationResource app : dataFlowShell.getDataFlowOperations().appRegistryOperations().list()) {
		String value = app.getType() + ":" + app.getName();
		completions.add(new Completion(value, app.getName(), pretty(app.getType()), 0));
	}
	return true;

}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:11,代码来源:QualifiedApplicationNameConverter.java


示例13: getAllPossibleValues

import org.springframework.shell.core.Completion; //导入依赖的package包/类
@Override
public boolean getAllPossibleValues(List<Completion> completions, Class<?> targetType, String existingData,
		String optionContext, MethodTarget target) {
	String start = (existingData.startsWith("'") || existingData.startsWith("\"")) ? existingData.substring(1)
			: existingData;

	try {
		int successiveInvocations = determineNumberOfInvocations(optionContext);
		String kind = completionKind(optionContext);
		CompletionProposalsResource candidates;
		switch (kind) {
			case "stream":
				candidates = completionOperations().streamCompletions(start, successiveInvocations);
				break;
			case "task":
				candidates = completionOperations().taskCompletions(start, successiveInvocations);
				break;
			default:
				throw new IllegalArgumentException("Unsupported completion kind: " + kind);
		}
		for (CompletionProposalsResource.Proposal candidate : candidates.getProposals()) {
			completions.add(new Completion(candidate.getText()));
		}
		return false;
	}
	// Protect from exception in non-command code
	catch (Exception e) {
		return false;
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:31,代码来源:CompletionConverter.java


示例14: getAllPossibleValues

import org.springframework.shell.core.Completion; //导入依赖的package包/类
@Override
public boolean getAllPossibleValues(List<Completion> completions, Class<?> targetType,
    String existingData, String optionContext, MethodTarget target) {
  if (String.class.equals(targetType) && ConverterHint.TIER_STORE_PATH.equals(optionContext)) {
    final Integer opt = OPT_MAP.get(target.getKey());
    Set<String> tierStorePaths = getAllTierStorePaths(opt == null ? 0 : opt);
    Gfsh gfsh = Gfsh.getCurrentInstance();
    String currentContextPath = "";
    if (gfsh != null) {
      currentContextPath = gfsh.getEnvProperty(Gfsh.ENV_APP_CONTEXT_PATH);
      if (currentContextPath != null && !DEFAULT_APP_CONTEXT_PATH.equals(currentContextPath)) {
        tierStorePaths.remove(currentContextPath);
        tierStorePaths.add(DEFAULT_APP_CONTEXT_PATH);
      }
    }

    for (String tierStorePath : tierStorePaths) {
      if (existingData != null) {
        if (tierStorePath.startsWith(existingData)) {
          completions.add(new Completion(tierStorePath));
        }
      } else {
        completions.add(new Completion(tierStorePath));
      }
    }
  }

  return !completions.isEmpty();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:30,代码来源:TierStorePathConverter.java


示例15: getAllPossibleValues

import org.springframework.shell.core.Completion; //导入依赖的package包/类
@Override
public boolean getAllPossibleValues(List<Completion> completions, Class<?> targetType,
    String existingData, String optionContext, MethodTarget target) {
  if (String.class.equals(targetType) && ConverterHint.REGIONPATH.equals(optionContext)) {
    Set<String> regionPathSet = getAllRegionPaths();
    Gfsh gfsh = Gfsh.getCurrentInstance();
    String currentContextPath = "";
    if (gfsh != null) {
      currentContextPath = gfsh.getEnvProperty(Gfsh.ENV_APP_CONTEXT_PATH);
      if (currentContextPath != null
          && !org.apache.geode.management.internal.cli.converters.RegionPathConverter.DEFAULT_APP_CONTEXT_PATH
              .equals(currentContextPath)) {
        regionPathSet.remove(currentContextPath);
        regionPathSet.add(
            org.apache.geode.management.internal.cli.converters.RegionPathConverter.DEFAULT_APP_CONTEXT_PATH);
      }
    }

    // Removing metaregion name from listing
    regionPathSet.remove("/" + MTableUtils.AMPL_META_REGION_NAME);

    for (String regionPath : regionPathSet) {
      if (existingData != null) {
        if (regionPath.startsWith(existingData)) {
          completions.add(new Completion(regionPath));
        }
      } else {
        completions.add(new Completion(regionPath));
      }
    }
  }

  return !completions.isEmpty();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:35,代码来源:RegionPathConverter.java


示例16: getAllPossibleValues

import org.springframework.shell.core.Completion; //导入依赖的package包/类
@Override
public boolean getAllPossibleValues(List<Completion> completions, Class<?> targetType,
    String existingData, String optionContext, MethodTarget target) {

  if (String.class.equals(targetType) && ConverterHint.INDEX_TYPE.equals(optionContext)) {
    completions.add(new Completion("range"));
    completions.add(new Completion("key"));
    completions.add(new Completion("hash"));
  }
  return !completions.isEmpty();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:12,代码来源:IndexTypeConverter.java


示例17: getAllPossibleValues

import org.springframework.shell.core.Completion; //导入依赖的package包/类
@Override
public boolean getAllPossibleValues(List<Completion> completions, Class<?> targetType,
    String existingData, String optionContext, MethodTarget target) {
  if (ConnectionEndpoint.JMXMANAGER_OPTION_CONTEXT.equals(optionContext)) {
    completions.add(new Completion(DEFAULT_JMX_ENDPOINTS));
  } else if (ConnectionEndpoint.LOCATOR_OPTION_CONTEXT.equals(optionContext)) {
    completions.add(new Completion(DEFAULT_LOCATOR_ENDPOINTS));
  }

  return completions.size() > 0;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:12,代码来源:ConnectionEndpointConverter.java


示例18: getAllPossibleValues

import org.springframework.shell.core.Completion; //导入依赖的package包/类
@Override
public boolean getAllPossibleValues(List<Completion> completions, Class<?> targetType,
    String existingData, String optionContext, MethodTarget target) {
  if (String.class.equals(targetType) && ConverterHint.MEMBERIDNAME.equals(optionContext)) {
    Set<String> memberIdAndNames = getMemberIdAndNames();

    for (String string : memberIdAndNames) {
      completions.add(new Completion(string));
    }
  }

  return !completions.isEmpty();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:14,代码来源:MemberIdNameConverter.java


示例19: LogLevelConverter

import org.springframework.shell.core.Completion; //导入依赖的package包/类
public LogLevelConverter() {
  logLevels = new LinkedHashSet<Completion>();
  int[] alllevels = LogWriterImpl.allLevels;
  for (int level : alllevels) {
    logLevels.add(new Completion(LogWriterImpl.levelToString(level)));
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:8,代码来源:LogLevelConverter.java


示例20: getAllPossibleValues

import org.springframework.shell.core.Completion; //导入依赖的package包/类
@Override
public boolean getAllPossibleValues(List<Completion> completions, Class<?> targetType,
    String existingData, String optionContext, MethodTarget target) {
  if (String.class.equals(targetType) && ConverterHint.GATEWAY_SENDER_ID.equals(optionContext)) {
    Set<String> gatewaySenderIds = getGatewaySenderIds();

    for (String gatewaySenderId : gatewaySenderIds) {
      completions.add(new Completion(gatewaySenderId));
    }
  }

  return !completions.isEmpty();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:14,代码来源:GatewaySenderIdConverter.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StreamState类代码示例发布时间:2022-05-22
下一篇:
Java Node类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap