org.drools.core.util.StringUtils.isEmpty()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(179)

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

StringUtils.isEmpty介绍

[英]Checks if a String is empty ("") or null.

StringUtils.isEmpty(null)      = true 
StringUtils.isEmpty("")        = true 
StringUtils.isEmpty(" ")       = false 
StringUtils.isEmpty("bob")     = false 
StringUtils.isEmpty("  bob  ") = false

NOTE: This method changed in Lang version 2.0. It no longer trims the String. That functionality is available in isBlank().
[中]检查字符串是否为空(“”)或null。

StringUtils.isEmpty(null)      = true 
StringUtils.isEmpty("")        = true 
StringUtils.isEmpty(" ")       = false 
StringUtils.isEmpty("bob")     = false 
StringUtils.isEmpty("  bob  ") = false

注意:在Lang 2.0版中,此方法发生了更改。它不再修剪绳子。该功能在isBlank()中可用。

代码示例

代码示例来源:origin: kiegroup/jbpm

@Override
public OrganizationalEntity persistOrgEntity(OrganizationalEntity orgEntity) {
  check();
  if (!StringUtils.isEmpty(orgEntity.getId())) {
    try {
      this.em.persist( orgEntity );
      if( this.pessimisticLocking ) {
        this.em.flush();
        return this.em.find(OrganizationalEntityImpl.class, orgEntity.getId(), LockModeType.PESSIMISTIC_WRITE );
      }
    } catch (EntityExistsException e) {
      throw new RuntimeException("Organizational entity already exists with " + orgEntity
          + " id, please check that there is no group and user with same id");
    }
  }
  return orgEntity;
}

代码示例来源:origin: kiegroup/jbpm

protected void addGroupFromCallbackOperation(String groupId, TaskContext context) {
  Group group = context.getPersistenceContext().findGroup(groupId);
  boolean groupExists = group != null;
  if (!StringUtils.isEmpty(groupId) && !groupExists) {
    group = TaskModelProvider.getFactory().newGroup();
    ((InternalOrganizationalEntity) group).setId(groupId);
    persistIfNotExists(group, context);
  }    
}

代码示例来源:origin: kiegroup/jbpm

protected User addUserFromCallbackOperation(String userId, TaskContext context) {
  User user = context.getPersistenceContext().findUser(userId);
  boolean userExists = user != null;
  if (!StringUtils.isEmpty(userId) && !userExists) {
    user = TaskModelProvider.getFactory().newUser();
    ((InternalOrganizationalEntity) user).setId(userId);
    
    persistIfNotExists(user, context);
  } 
  
  return user;
}

代码示例来源:origin: kiegroup/jbpm

@Override
public Map<String, WorkItemHandler> getWorkItemHandlers(RuntimeEngine runtime) {
  KieSessionModel ksessionModel = null;
  if(StringUtils.isEmpty(ksessionName)) {
    ksessionModel = ((KieContainerImpl)kieContainer).getKieProject().getDefaultKieSession();
    if (ksessionModel == null) {

代码示例来源:origin: kiegroup/jbpm

if ( ! StringUtils.isEmpty(strategyClassName) ) { 
  strategy = context.resolverStrategyFactory.getStrategyObject(strategyClassName);
  if( strategy == null ) {

代码示例来源:origin: kiegroup/jbpm

private static RuntimeEnvironmentBuilder setupClasspathKmoduleBuilder( KieContainer kieContainer,
                                    String kbaseName,
                                    String ksessionName ) {
  if (StringUtils.isEmpty(kbaseName)) {
    KieBaseModel defaultKBaseModel = ((KieContainerImpl)kieContainer).getKieProject().getDefaultKieBaseModel();
    if (defaultKBaseModel != null) {
      kbaseName = defaultKBaseModel.getName();
    } else {
      kbaseName = DEFAULT_KBASE_NAME;
    }
  }
  InternalKieModule module = (InternalKieModule) ((KieContainerImpl)kieContainer).getKieModuleForKBase(kbaseName);
  if (module == null) {
    throw new IllegalStateException("Cannot find kbase with name " + kbaseName);
  }
  KieBase kbase = kieContainer.getKieBase(kbaseName);
  return getDefault()
      .knowledgeBase(kbase)
      .classLoader(kieContainer.getClassLoader())
      .registerableItemsFactory(new KModuleRegisterableItemsFactory(kieContainer, ksessionName));
}

代码示例来源:origin: kiegroup/jbpm

DeploymentDescriptor descriptor = merger.merge(descriptorHierarchy, MergeMode.MERGE_COLLECTIONS);
if (StringUtils.isEmpty(kbaseName)) {
  KieBaseModel defaultKBaseModel = ((KieContainerImpl)kieContainer).getKieProject().getDefaultKieBaseModel();
  if (defaultKBaseModel != null) {

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.drools

public String getFullName() {
  if ( StringUtils.isEmpty(namespace) ) {
    return name;
  } else {
    return namespace + "." + name;
  }
}

代码示例来源:origin: org.drools/drools-spring

private static String checkAndSetID(Element parent, Element element) {
    String id = element.getAttribute("id");
    if ( StringUtils.isEmpty(id)) {
      // this is an anonymous (no id) bean, set a temp id to ensure we can reference it internally.
      id = parent.getAttribute("id")+"_fl"+i;
      element.setAttribute("id", id);
      i++;
    }
    return id;
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.drools

private static String checkAndSetID(Element parent, Element element) {
    String id = element.getAttribute("id");
    if ( StringUtils.isEmpty(id)) {
      // this is an anonymous (no id) bean, set a temp id to ensure we can reference it internally.
      id = parent.getAttribute("id")+"_fl"+i;
      element.setAttribute("id", id);
      i++;
    }
    return id;
  }
}

代码示例来源:origin: org.drools/drools-templates

public String getCondition(String condition, int index) {
  if (index == -1) {
    StringBuffer conditionString = new StringBuffer("ArrayCell(row == r, column == $param");
    if (!StringUtils.isEmpty(condition)) {
      conditionString.append(", value ").append(condition);
    }
    conditionString.append(")");
    return conditionString.toString();
  } else {
    return type.getCondition(condition, index);
  }
}

代码示例来源:origin: org.jbpm/jbpm-human-task-services

private void addUserFromCallbackOperation(String userId) {
  try {
    boolean userExists = em.find(User.class, userId) != null;
    if (!StringUtils.isEmpty(userId) && !userExists) {
      User user = new User(userId);
      em.persist(user);
    }
  } catch (Throwable t) {
    //logger.log(Level.SEVERE, "Unable to add user " + userId);
  }
}

代码示例来源:origin: org.jbpm/jbpm-human-task-services

private void addGroupFromCallbackOperation(String groupId) {
    try {
      boolean groupExists = em.find(Group.class, groupId) != null;
      if (!StringUtils.isEmpty(groupId) && !groupExists) {
        Group group = new Group(groupId);
        em.persist(group);
      }
    } catch (Throwable t) {
      //logger.log(Level.WARNING, "UserGroupCallback has not been registered.");
    }
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.drools

public Byte getDefaultValueAsByte( ) {
  try {
    return initExpr == null ? 0 : Byte.parseByte(initExpr);
  } catch (NumberFormatException nfe) {
    return StringUtils.isEmpty( initExpr ) ? 0 : MVEL.eval( initExpr, Byte.class );
  }
}
public Character getDefaultValueAsChar() {

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.drools

public Short getDefaultValueAsShort( ) {
  try {
    return initExpr == null ? 0 : Short.parseShort(initExpr);
  } catch (NumberFormatException nfe) {
    return StringUtils.isEmpty( initExpr ) ? 0 : MVEL.eval( initExpr, Short.class );
  }
}

代码示例来源:origin: org.drools/drools-templates

public String getCondition(String condition, int index) {
  StringBuffer conditionString = new StringBuffer(getCellType());
  conditionString.append("(row == r, column == $param");
  if (index != -1) {
    conditionString.append(", index == ").append(index);
  }
  if (!StringUtils.isEmpty(condition)) {
    conditionString.append(", value ").append(condition);
  }
  conditionString.append(")");
  return conditionString.toString();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.drools

public short getDefaultValueAs_short() {
  try {
    return initExpr == null ? 0 : Short.parseShort(initExpr);
  } catch (NumberFormatException nfe) {
    return StringUtils.isEmpty( initExpr ) ? 0 : MVEL.eval( initExpr, Short.class ).shortValue();
  }
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-bpmn-backend

@Override
public String getDocumentation() {
  String documentation = super.getDocumentation();
  if (StringUtils.isEmpty(documentation)) {
    String defaultDocumentation = workItemDefinition.getDocumentation();
    return defaultDocumentation == null ? "" : defaultDocumentation;
  } else {
    return documentation;
  }
}

代码示例来源:origin: org.drools/drools-camel-legacy5

@After
public void after() throws Exception {
  if ( !StringUtils.isEmpty( copyToDataFormat ) ) {
    writer.close();
  }
}

代码示例来源:origin: org.kie/kie-camel

@After
public void after() throws Exception {
  if (!StringUtils.isEmpty(copyToDataFormat)) {
    writer.close();
  }
}

相关文章

微信公众号

最新文章

更多