当前位置: 首页>>代码示例>>Java>>正文


Java StringUtils类代码示例

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


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

示例1: applyCommon

import org.apache.velocity.util.StringUtils; //导入依赖的package包/类
/**
 * Applies common fields
 *
 * @param fieldModel mutable FieldModel
 * @return fieldModel
 */
public <A extends VariableFieldModel> A applyCommon(final A fieldModel) {
    fieldModel.accessible = !element.getModifiers().contains(Modifier.PRIVATE);

    fieldModel.name = element.getSimpleName().toString();
    fieldModel.accessorMethod = GET + StringUtils.capitalizeFirstLetter(fieldModel.name);
    fieldModel.alias = DFUtil.compileAlias(fieldModel.name, "");
    fieldModel.type = element.asType().toString();

    box(fieldModel, element.asType());

    onAnnotation(DeltaField.class, a -> fieldModel.alias = DFUtil.compileAlias(fieldModel.name, a.alias()) );

    printMessage(Kind.NOTE, "created field model:" + fieldModel.toString());

    return fieldModel;
}
 
开发者ID:maxns,项目名称:deltaforce,代码行数:23,代码来源:VariableFieldModelBuilder.java

示例2: newArticle

import org.apache.velocity.util.StringUtils; //导入依赖的package包/类
private Article newArticle(String articleId, JPublishContext context) {
    Article article = null;

    if (articleId != null) {
        Map articleProperties = (Map) context.get(articleId);
        List tags = (List) articleProperties.get(TAGS);
        article = new Article(articleId);

        for (int i = 0; i < tags.size(); i++) {
            String sTag = (String) tags.get(i);
            String[] props = StringUtils.split(sTag, tagSeparator);

            //Tag tag =
            article.addTag(props[0], Long.parseLong(props[1]));
            // tag.setProperty("score", props[2]);
            // todo think about implementing an API used to store arbitrary TAG attributes as defined by the user
        }
        article.calculateTags(normalizer);
    }
    return article;
}
 
开发者ID:florinpatrascu,项目名称:jpublish,代码行数:22,代码来源:TagCloudComponent.java

示例3: registerDateConverter

import org.apache.velocity.util.StringUtils; //导入依赖的package包/类
/**
 * 定义Apache BeanUtils日期Converter的格式,可注册多个格式,以','分隔
 */
public static void registerDateConverter(String patterns) {
	DateConverter dc = new DateConverter();
	dc.setUseLocaleFormat(true);
	dc.setPatterns(StringUtils.split(patterns, ","));
	ConvertUtils.register(dc, Date.class);
}
 
开发者ID:wkeyuan,项目名称:DWSurvey,代码行数:10,代码来源:ObjectMapper.java

示例4: compileAlias

import org.apache.velocity.util.StringUtils; //导入依赖的package包/类
/**
 * @param name
 * @param aliasParam
 * @return
 */
public static String compileAlias(String name, String aliasParam) {
    /**
     *         #if( ${field.mapItem.substring(0,1)}=="+" )
     #set( $fnInMethod = "${field.alias.substring(0,1).toUpperCase()}${field.alias.substring(1)}${field.mapItem.substring(1)}" )
     #else
     #set ($fnInMethod = "${field.mapItem.substring(0,1).toUpperCase()}${field.mapItem.substring(1)}" )
     #end

     */
    String res = StringUtils.capitalizeFirstLetter(name);

    String[] aliasParts = StringUtils.split(aliasParam==null?"":aliasParam, ";");

    for(String alias:aliasParts) {
        if(alias.startsWith("+")) {
            res = res + StringUtils.capitalizeFirstLetter(alias.substring(1));
        }else if(alias.startsWith("-")) {
            if(res.endsWith(alias.substring(1))) {
                res = res.substring(0,res.length()-alias.length()+1);
            }
        }else {
            res = StringUtils.capitalizeFirstLetter(alias);
        }

    }
    return res;
}
 
开发者ID:maxns,项目名称:deltaforce,代码行数:33,代码来源:DFUtil.java

示例5: prepareAssignmentRelatedTaskInstruction

import org.apache.velocity.util.StringUtils; //导入依赖的package包/类
private PcpChildWfTaskCreationInstruction<ItemApprovalSpecificContent> prepareAssignmentRelatedTaskInstruction(
	ApprovalSchemaBuilder.Result builderResult,
	EvaluatedAssignment<?> evaluatedAssignment, boolean assignmentRemoved, ModelContext<?> modelContext,
	PrismObject<UserType> requester, OperationResult result) throws SchemaException {

String objectOid = getFocusObjectOid(modelContext);
String objectName = getFocusObjectName(modelContext);

@SuppressWarnings("unchecked")
PrismObject<? extends ObjectType> target = (PrismObject<? extends ObjectType>) evaluatedAssignment.getTarget();
Validate.notNull(target, "assignment target is null");

String targetName = target.getName() != null ? target.getName().getOrig() : "(unnamed)";
String operation = (assignmentRemoved
		? "unassigning " + targetName + " from " :
		"assigning " + targetName + " to ")
		+ objectName;
String approvalTaskName = "Approve " + operation;

PcpChildWfTaskCreationInstruction<ItemApprovalSpecificContent> instruction =
		PcpChildWfTaskCreationInstruction.createItemApprovalInstruction(getChangeProcessor(), approvalTaskName,
				builderResult.schemaType, builderResult.attachedRules);

instruction.prepareCommonAttributes(this, modelContext, requester);

ObjectDelta<? extends FocusType> delta = assignmentToDelta(modelContext.getFocusClass(),
		evaluatedAssignment.getAssignmentType(), assignmentRemoved, objectOid);
instruction.setDeltasToProcess(delta);

instruction.setObjectRef(modelContext, result);
instruction.setTargetRef(createObjectRef(target), result);

String andExecuting = instruction.isExecuteApprovedChangeImmediately() ? "and execution " : "";
instruction.setTaskName("Approval " + andExecuting + "of " + operation);
instruction.setProcessInstanceName(StringUtils.capitalizeFirstLetter(operation));

itemApprovalProcessInterface.prepareStartInstruction(instruction);

return instruction;
  }
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:41,代码来源:PolicyRuleBasedAspect.java

示例6: createScript

import org.apache.velocity.util.StringUtils; //导入依赖的package包/类
/**
 * Create the actual script from the RF scripter.
 *
 * @return The complete test script.
 */
public String createScript() {
  for (User user : state.getUsers()) {
    scripter.addVariable(user.getId(), StringUtils.capitalizeFirstLetter(user.getName()));
  }
  script = scripter.createScript();
  return script;
}
 
开发者ID:mukatee,项目名称:osmo,代码行数:13,代码来源:OfflineScripter.java

示例7: getSourceRootPathList

import org.apache.velocity.util.StringUtils; //导入依赖的package包/类
public List<String> getSourceRootPathList(Project project, AnActionEvent event) {
    List<String> sourceRoots = Lists.newArrayList();
    String projectPath = StringUtils.normalizePath(project.getBasePath());
    for (VirtualFile virtualFile : getModuleRootManager(event).getSourceRoots(false)) {
        sourceRoots.add(StringUtils.normalizePath(virtualFile.getPath()).replace(projectPath, ""));
    }
    return sourceRoots;
}
 
开发者ID:cooliean,项目名称:android-codegenerator-plugin-intellij,代码行数:9,代码来源:ProjectHelper.java

示例8: getStringUtils

import org.apache.velocity.util.StringUtils; //导入依赖的package包/类
public StringUtils getStringUtils() {
    return STRING_UTILS;
}
 
开发者ID:maxns,项目名称:deltaforce,代码行数:4,代码来源:DFUtil.java

示例9: prepareObjectRelatedTaskInstruction

import org.apache.velocity.util.StringUtils; //导入依赖的package包/类
private PcpChildWfTaskCreationInstruction prepareObjectRelatedTaskInstruction(ApprovalSchemaBuilder.Result builderResult,
		ObjectDelta<?> focusDelta, Set<ItemPath> paths, ModelContext<?> modelContext,
		PrismObject<UserType> requester, OperationResult result) throws SchemaException {

	//String objectOid = getFocusObjectOid(modelContext);
	String objectName = getFocusObjectName(modelContext);

	String opName;
	if (focusDelta.isAdd()) {
		opName = "addition";
	} else if (focusDelta.isDelete()) {
		opName = "deletion";
	} else {
		opName = "modification";
	}

	if (focusDelta.isAdd()) {
		if (focusDelta.getObjectToAdd().getOid() == null) {
			String newOid = OidUtil.generateOid();
			focusDelta.getObjectToAdd().setOid(newOid);
			((LensFocusContext<?>) modelContext.getFocusContext()).setOid(newOid);
		}
	}

	String approvalTaskName = "Approve " + opName + " of " + objectName;

	PcpChildWfTaskCreationInstruction<ItemApprovalSpecificContent> instruction =
			PcpChildWfTaskCreationInstruction.createItemApprovalInstruction(getChangeProcessor(), approvalTaskName,
					builderResult.schemaType, builderResult.attachedRules);

	instruction.prepareCommonAttributes(this, modelContext, requester);

	@SuppressWarnings("unchecked")
	ObjectDelta<? extends FocusType> delta = (ObjectDelta<? extends FocusType>) subtractModifications(focusDelta, paths);
	instruction.setDeltasToProcess(delta);

	instruction.setObjectRef(modelContext, result);

	String andExecuting = instruction.isExecuteApprovedChangeImmediately() ? "and execution " : "";
	instruction.setTaskName("Approval " + andExecuting + "of " + opName + " of " + objectName);
	instruction.setProcessInstanceName(StringUtils.capitalizeFirstLetter(opName) + " of " + objectName);

	itemApprovalProcessInterface.prepareStartInstruction(instruction);

	return instruction;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:47,代码来源:PolicyRuleBasedAspect.java

示例10: createVelocityContext

import org.apache.velocity.util.StringUtils; //导入依赖的package包/类
private static VelocityContext createVelocityContext() {
  VelocityContext context = new VelocityContext();
  context.put("StringUtils", StringUtils.class);
  return context;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:FileTemplateUtil.java

示例11: getFolderPath

import org.apache.velocity.util.StringUtils; //导入依赖的package包/类
public String getFolderPath(String sourcePath, String packageName) {
    String normalizePath = StringUtils.normalizePath(sourcePath + "/" + StringUtils.getPackageAsPath(packageName));
    return org.apache.commons.lang3.StringUtils.strip(normalizePath, "/");
}
 
开发者ID:cooliean,项目名称:android-codegenerator-plugin-intellij,代码行数:5,代码来源:PathHelper.java

示例12: execute

import org.apache.velocity.util.StringUtils; //导入依赖的package包/类
/**
 * Runs this action.
 * @param mapping action mapping
 * @param formIn form submitted values
 * @param request http request object
 * @param response http response object
 * @return an action forward object
 */
@Override
public ActionForward execute(ActionMapping mapping, ActionForm formIn,
    HttpServletRequest request, HttpServletResponse response) {
    RequestContext context = new RequestContext(request);
    DynaActionForm form = (DynaActionForm) formIn;
    StrutsDelegate strutsDelegate = getStrutsDelegate();
    User user = context.getCurrentUser();
    ActionErrors errors = new ActionErrors();
    int successCount = 0;

    if (context.isSubmitted() && context.wasDispatched(
            "ssm.provisioning.powermanagement.configuration.update")) {
        List<SystemOverview> systemOverviews = getResult(context);
        for (SystemOverview systemOverview : systemOverviews) {
            try {
                Server server = SystemManager.lookupByIdAndUser(systemOverview.getId(),
                    user);
                CobblerPowerSettingsUpdateCommand command = PowerManagementAction
                    .getPowerSettingsUpdateCommandSSM(form, user, server);
                if (command.store() == null) {
                    successCount += 1;
                }
            }
            catch (XmlRpcException e) {
                log.error(StringUtils.stackTrace(e));
                log.error(StringUtils.stackTrace(e.getCause()));
            }
        }

        createSuccessMessage(request,
            "ssm.provisioning.powermanagement.configuration.saved", "" + successCount);
    }

    Map<String, String> types = PowerManagementAction.setUpPowerTypes(request,
            strutsDelegate, errors);
    PowerManagementAction.ensureAgentInstalled(request, strutsDelegate, errors);
    if (!types.isEmpty()) {
        types.put(
            LocalizationService.getInstance().getPlainText(
                "ssm.provisioning.powermanagement.configuration.dontchange"), "");
    }

    ListHelper helper = new ListHelper(this, request);
    helper.execute();

    return strutsDelegate.forwardParams(mapping.findForward(RhnHelper.DEFAULT_FORWARD),
        request.getParameterMap());
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:57,代码来源:PowerManagementConfigurationAction.java

示例13: createPerson

import org.apache.velocity.util.StringUtils; //导入依赖的package包/类
public static Person createPerson(String username, Role... roles) {

        String name = StringUtils.capitalizeFirstLetter(username);

        Person person = TestDataCreator.createPerson(username, name, name, username + "@test.de");

        person.setPermissions(Arrays.asList(roles));

        return person;
    }
 
开发者ID:synyx,项目名称:urlaubsverwaltung,代码行数:11,代码来源:TestDataCreator.java


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