热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.eclipse.xtext.util.Strings.toFirstUpper()方法的使用及代码示例

本文整理了Java中org.eclipse.xtext.util.Strings.toFirstUpper()方法的一些代码示例,展示了Strings.to

本文整理了Java中org.eclipse.xtext.util.Strings.toFirstUpper()方法的一些代码示例,展示了Strings.toFirstUpper()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Strings.toFirstUpper()方法的具体详情如下:
包路径:org.eclipse.xtext.util.Strings
类名称:Strings
方法名:toFirstUpper

Strings.toFirstUpper介绍

暂无

代码示例

代码示例来源:origin: org.eclipse/xtext

private String normalizeEntryRuleName(String entryRuleName) {
String antlrEntryRuleName;
if (!entryRuleName.startsWith("entryRule")) {
if (!entryRuleName.startsWith("rule")) {
antlrEntryRuleName = "entryRule" + entryRuleName;
} else {
antlrEntryRuleName = "entry" + Strings.toFirstUpper(entryRuleName);
}
} else {
antlrEntryRuleName = entryRuleName;
}
return antlrEntryRuleName;
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xtext.generator

public static String getContentAssistRuleName(AbstractRule rule) {
String ruleName = getRuleName(rule);
if (ruleName.startsWith("rule"))
return "rule__" + Strings.toFirstUpper(ruleName.substring(4, ruleName.length()));
return ruleName;
}

代码示例来源:origin: io.sarl.maven/io.sarl.maven.docs.generator

private static String toTestName(File inputFile) {
return Strings.toFirstUpper(FileSystem.shortBasename(inputFile).replaceAll("[^a-zA-Z0-9]+", "")); //$NON-NLS-1$ //$NON-NLS-2$
}

代码示例来源:origin: org.eclipse.xtext.ui.codetemplates/ui

private String getAssignedFeature(RuleCall call) {
Assignment ass = GrammarUtil.containingAssignment(call);
if (ass != null) {
String result = ass.getFeature();
if (result.equals(result.toLowerCase()))
result = Strings.toFirstUpper(result);
return result;
}
return null;
}

代码示例来源:origin: org.eclipse.xtext/ui

private String getAssignedFeature(RuleCall call) {
Assignment ass = GrammarUtil.containingAssignment(call);
if (ass != null) {
String result = ass.getFeature();
if (result.equals(result.toLowerCase()))
result = Strings.toFirstUpper(result);
return result;
}
return null;
}

代码示例来源:origin: org.eclipse.xtext/ui

@Override
public void completeAssignment(Assignment assignment, ContentAssistContext contentAssistContext,
ICompletionProposalAcceptor acceptor) {
ParserRule parserRule = GrammarUtil.containingParserRule(assignment);
String methodName = "complete" + Strings.toFirstUpper(parserRule.getName()) + "_"
+ Strings.toFirstUpper(assignment.getFeature());
invokeMethod(methodName, acceptor, contentAssistContext.getCurrentModel(), assignment, contentAssistContext);
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xtext.generator

/**
* @since 2.9
*/
public static String getEntryRuleName(ParserRule rule) {
RuleWithParameterValues parameterValues = RuleWithParameterValues.findInEmfObject(rule);
if (parameterValues != null) {
if (parameterValues.getParamValues().isEmpty()) {
AbstractRule original = parameterValues.getOriginal();
RuleNames ruleNames = RuleNames.getRuleNames(original);
return "entry" + Strings.toFirstUpper(ruleNames.getAntlrRuleName(original));
}
return null;
} else {
RuleNames ruleNames = RuleNames.getRuleNames(rule);
return "entry" + Strings.toFirstUpper(ruleNames.getAntlrRuleName(rule));
}
}

代码示例来源:origin: org.eclipse/xtext

@Check
public void checkGeneratedPackageForNameClashes(GeneratedMetamodel metamodel) {
EPackage pack = metamodel.getEPackage();
Multimap cOnstantNameToElement= HashMultimap.create();
Multimap accessorNameToElement = HashMultimap.create();
if (pack != null) {
for(EClassifier classifier: pack.getEClassifiers()) {
String accessorName = classifier.getName();
if ("Class".equals(accessorName) || "Name".equals(accessorName))
accessorName += "_";
accessorNameToElement.put("get" + accessorName, classifier);
String classifierCOnstantName= CodeGenUtil.format(classifier.getName(), '_', null, true, true).toUpperCase();
constantNameToElement.put(classifierConstantName, classifier);
if (classifier instanceof EClass) {
for(EStructuralFeature feature: ((EClass) classifier).getEAllStructuralFeatures()) {
String featureCOnstantPart= CodeGenUtil.format(feature.getName(), '_', null, false, false).toUpperCase();
String featureCOnstantName= classifierConstantName + "__" + featureConstantPart;
constantNameToElement.put(featureConstantName, feature);
String featureAccessorName = "get" + classifier.getName() + "_" + Strings.toFirstUpper(feature.getName());
accessorNameToElement.put(featureAccessorName, feature);
}
}
}
}
createMessageForNameClashes(constantNameToElement);
createMessageForNameClashes(accessorNameToElement);
}

代码示例来源:origin: org.codehaus.openxma/dsl-generator

ObjectProperty property = (ObjectProperty)ref;
if (property.eContainer() instanceof Component) {
sb.append("get"+Strings.toFirstUpper(property.getName())+"()");
} else {
sb.append(Strings.toFirstLower(property.getName())+".");

代码示例来源:origin: com.reprezen.genflow/genflow-api

/**
* @deprecated use {@link CommonServices#getRequestTypeName(TypedRequest)} or
* {@link CommonServices#getResponseTypeName(TypedResponse)} instead
* @param message typed message
* @return generated type name for XSD generator that avoid name clashes
*/
@Deprecated
public static String getMessageTypeName(TypedMessage message) {
Method method = (Method) message.eContainer();
String methodName = method.getHttpMethod().getName().toLowerCase()
+ method.getContainingResourceDefinition().getName();
final Structure type = message.getActualType();
ImmutableList list = ImmutableList.copyOf(Iterators.filter(
Iterators.filter(method.getContainingResourceDefinition().eAllContents(), TypedMessage.class),
new Predicate() {
@Override
public boolean apply(TypedMessage input) {
return input.getActualType() == type;
}
}));
String baseName = Strings.toFirstUpper(methodName) + '_' + message.getActualType().getName();
if (list.size() > 1) {
return baseName + '_' + (list.indexOf(message) + 1);
}
return baseName;
}

代码示例来源:origin: org.codehaus.openxma/dsl-generator

ObjectProperty property = (ObjectProperty)ref;
if (property.eContainer() instanceof Component) {
sb.append("set"+Strings.toFirstUpper(property.getName())+"(");
} else {
SimpleType t = property.getType();

代码示例来源:origin: org.eclipse.xtext.ui.codetemplates/ui

private void createStringProposal(ContentAssistContext context, ICompletionProposalAcceptor acceptor,
String feature, RuleCall ruleCall) {
String proposalText = feature != null ? feature : Strings.toFirstUpper(ruleCall.getRule().getName().toLowerCase());
proposalText = getValueConverter().toString(proposalText, ruleCall.getRule().getName());
String displayText = proposalText;
if (feature != null)
displayText = displayText + " - " + ruleCall.getRule().getName();
ICompletionProposal proposal = createCompletionProposal(proposalText, displayText, null, context);
if (proposal instanceof ConfigurableCompletionProposal) {
ConfigurableCompletionProposal cOnfigurable= (ConfigurableCompletionProposal) proposal;
configurable.setSelectionStart(configurable.getReplacementOffset() + 1);
configurable.setSelectionLength(proposalText.length() - 2);
configurable.setAutoInsertable(false);
configurable.setSimpleLinkedMode(context.getViewer(), proposalText.charAt(0), '\t');

}
acceptor.accept(proposal);
}

代码示例来源:origin: org.eclipse.xtext/ui

private void createStringProposal(ContentAssistContext context, ICompletionProposalAcceptor acceptor,
String feature, RuleCall ruleCall) {
String proposalText = feature != null ? feature : Strings.toFirstUpper(ruleCall.getRule().getName().toLowerCase());
proposalText = getValueConverter().toString(proposalText, ruleCall.getRule().getName());
String displayText = proposalText;
if (feature != null)
displayText = displayText + " - " + ruleCall.getRule().getName();
ICompletionProposal proposal = createCompletionProposal(proposalText, displayText, null, context);
if (proposal instanceof ConfigurableCompletionProposal) {
ConfigurableCompletionProposal cOnfigurable= (ConfigurableCompletionProposal) proposal;
configurable.setSelectionStart(configurable.getReplacementOffset() + 1);
configurable.setSelectionLength(proposalText.length() - 2);
configurable.setAutoInsertable(false);
configurable.setSimpleLinkedMode(context.getViewer(), proposalText.charAt(0), '\t');

}
acceptor.accept(proposal);
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

result.setVisibility(JvmVisibility.PUBLIC);
result.setReturnType(references.getTypeForName(Void.TYPE,sourceElement));
result.setSimpleName("set" + Strings.toFirstUpper(propertyName));
result.getParameters().add(toParameter(sourceElement, propertyName, typeRef));
setBody(result, new Procedures.Procedure1() {

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

result.setVisibility(JvmVisibility.PUBLIC);
String prefix = (isPrimitiveBoolean(typeRef) ? "is" : "get");
result.setSimpleName(prefix + Strings.toFirstUpper(propertyName));
result.setReturnType(cloneWithProxies(typeRef));
setBody(result, new Procedures.Procedure1() {

代码示例来源:origin: org.eclipse.xtext/ui

ContentAssistContext myCOntext= context.copy().setMatcher(newMatcher).toContext();
String feature = getAssignedFeature(ruleCall);
String proposalText = feature != null ? feature : Strings.toFirstUpper(ruleCall.getRule().getName().toLowerCase());
String displayText = proposalText;
if (feature != null)

推荐阅读
author-avatar
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有