leap.lang.Args.assertFalse()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(96)

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

Args.assertFalse介绍

[英]Ensures not the truth of an expression involving one or more parameters to the calling method.
[中]确保涉及调用方法的一个或多个参数的表达式不真实。

代码示例

代码示例来源:origin: org.leapframework/leap-core

/**
 * token + ":" + expires + ":" + md5Hex(token + ":" + expires + ":" + secret)
 */
protected String doEncodeToken(String token, String expires) {
  Args.assertFalse(token.contains(":"), "The token must not contains character ':'");
  
  String encoded = token + ":" + expires + ":" + sign(token, expires) ;
  
  //removes all the '=' characters
  StringBuilder sb = new StringBuilder(Base64.encode(encoded));
  while (sb.charAt(sb.length() - 1) == '=') {
    sb.deleteCharAt(sb.length() - 1);
  }
  
  return sb.toString();
}

代码示例来源:origin: org.leapframework/leap-db

public PropertyChange(T dbObject,String property, Object oldValue, Object newValue) {
  Args.notNull(dbObject,"dbObject");
  Args.notEmpty(property,"property");
  Args.assertFalse(Objects.equals(oldValue, newValue), "oldValue must not equals to newValue");
  
  this.dbObject = dbObject;
  this.property = property;
  this.oldValue = oldValue;
  this.newValue = newValue;
}

代码示例来源:origin: org.leapframework/leap-orm

Args.assertFalse(newOptimisticLockFieldName.equalsIgnoreCase(getFieldName()),
         "newOptimisticLockFieldName must not equals the field name");

代码示例来源:origin: org.leapframework/leap-lang

public TypeInfo(Class<?> type, Type genericType, MTypeKind kind,Class<?> elementType, TypeInfo elementTypeInfo) {
  Args.notNull(type,"type");
  Args.notNull(kind,"kind");
  
  if(null != elementType){
    Args.assertTrue(kind == MTypeKind.COLLECTION, "The element type must not be null if the kind is 'COLLECTION'");
    Args.assertTrue(elementTypeInfo != null,"The element type info must not be null if the element type is not null");
  }else{
    Args.assertFalse(kind == MTypeKind.COLLECTION, "The element type must be null if the kind is not 'COLLECTION'");
    Args.assertTrue(elementTypeInfo == null, "The element type info must be null if the element type is null");
  }
  
  this.type			 = type;
  this.genericType     = genericType;
  this.typeKind        = kind;
  this.elementType     = elementType;
  this.elementTypeInfo = elementTypeInfo;
}

代码示例来源:origin: org.leapframework/leap-orm

@Override
public EntityMappingBuilder createEntityMappingByClass(MetadataContext context, Class<?> cls, boolean allowEmptyFields) {
  Args.notNull(cls,"class");
  Args.assertFalse(isExplicitNonEntity(context,cls),
           "The class '" + cls.getName() + "' was declared as not an entity type explicitly");
  EntityMappingBuilder emb = new EntityMappingBuilder().setEntityClass(cls);
  preMappingEntity(context, emb);
  //mapping entity's properties
  BeanType beanType = BeanType.of(cls);
  log.debug("Creating entity mapping for type : " + cls.getName());
  mappingBeanProperties(context,emb,beanType);
  postMappingEntity(context, emb);
  finalMappingEntity(context, emb);
  //fields must be defined
  if(!allowEmptyFields && emb.getFieldMappings().isEmpty()){
    throw new MetadataException("Entity's fields must not be empty in the java type '" + cls.getName() + "'");
  }
  //primary keys must be defined
  /* todo : review this strategy.
  if(emb.getIdFieldMappings().isEmpty()){
    throw new MetadataException("Entity's primary key(s) must not be empty in the java type '" + cls.getName() + "'");
  }
  */
  return emb;
}

代码示例来源:origin: org.leapframework/leap-db

public DbTable(String         catalog, 
        String         schema,
        String         name, 
        String         type,
        boolean        quoted,
        String         comment, 
        String          primaryKeyName,
        String[]       primaryKeyColumnNames, 
        DbColumn[]     columns,
        DbForeignKey[] foreignKeys,
        DbIndex[]      indexes) {
  
  super(catalog, schema, name, quoted);
  
  Args.notEmpty(type,"table type");
  Args.notEmpty(columns,"columns' of table '" + name + "");
  
  Args.assertFalse(!Arrays2.isEmpty(primaryKeyColumnNames) && Strings.isEmpty(primaryKeyName),
           "primaryKeyName must not be empty if primary key exists");
  
  this.type                  = type;
  this.comment               = comment;
  this.columns               = columns;
  this.foreignKeys           = null == foreignKeys ? new DbForeignKey[]{} : foreignKeys;
  this.indexes               = null == indexes     ? new DbIndex[]{}      : indexes;
  this.primaryKey			   = Arrays2.isEmpty(primaryKeyColumnNames) ? null : new DbPrimaryKey(primaryKeyName, primaryKeyColumnNames);
  this.primaryKeyColumns     = fromNames(primaryKeyColumnNames);
}

相关文章

微信公众号

最新文章

更多