org.javers.common.validation.Validate.argumentsAreNotNull()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(115)

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

Validate.argumentsAreNotNull介绍

暂无

代码示例

代码示例来源:origin: javers/javers

public Changes(List<Change> changes, PrettyValuePrinter valuePrinter) {
  Validate.argumentsAreNotNull(changes, valuePrinter);
  this.changes = changes;
  this.valuePrinter = valuePrinter;
}

代码示例来源:origin: javers/javers

SingleEdge(JaversProperty property, ObjectNode referencedNode) {
  super(property);
  Validate.argumentsAreNotNull(referencedNode);
  this.referencedNode = referencedNode;
}

代码示例来源:origin: javers/javers

public DehydrateMapFunction(GlobalIdFactory globalIdFactory, MapContentType mapContentType) {
  Validate.argumentsAreNotNull(globalIdFactory, mapContentType);
  this.globalIdFactory = globalIdFactory;
  this.mapContentType = mapContentType;
}

代码示例来源:origin: javers/javers

LevenshteinListChangeAppender(TypeMapper typeMapper, GlobalIdFactory globalIdFactory) {
  Validate.argumentsAreNotNull(typeMapper, globalIdFactory);
  this.typeMapper = typeMapper;
  this.globalIdFactory = globalIdFactory;
}

代码示例来源:origin: javers/javers

protected Cdo(GlobalId globalId, ManagedType managedType) {
  Validate.argumentsAreNotNull(globalId, managedType);
  this.globalId = globalId;
  this.managedType = managedType;
}

代码示例来源:origin: javers/javers

JsonConverter(Gson gson) {
  argumentsAreNotNull(gson);
  this.gson = gson;
  this.cdoSnapshotAssembler = new CdoSnapshotAssembler(this);
}

代码示例来源:origin: javers/javers

/**
 * @return ImmutableSet
 */
public static <F, T> Set<T> transform(Set<F> input, Function<F, T> transformation) {
  Validate.argumentsAreNotNull(input, transformation);
  return input.stream().map(transformation::apply).collect(toImmutableSet());
}

代码示例来源:origin: javers/javers

public CommitMetadata(String author, Map<String, String> properties, LocalDateTime commitDate,
           Instant commitDateInstant,
           CommitId id) {
  Validate.argumentsAreNotNull(author, properties, commitDate, id);
  this.author = author;
  this.properties = new HashMap<>(properties);
  this.commitDate = commitDate;
  this.id = id;
  this.commitDateInstant = initCommitDateInstant(commitDate, commitDateInstant);
}

代码示例来源:origin: javers/javers

/**
 * @since 3.1
 * @see JsonDeserializer
 */
public JsonConverterBuilder registerNativeGsonHierarchyDeserializer(Class targetType, JsonDeserializer<?> jsonDeserializer) {
  Validate.argumentsAreNotNull(targetType, jsonDeserializer);
  gsonBuilder.registerTypeHierarchyAdapter(targetType, jsonDeserializer);
  return this;
}

代码示例来源:origin: javers/javers

@Override
public Diff compare(Object oldVersion, Object currentVersion) {
  argumentsAreNotNull(oldVersion, currentVersion);
  return diffFactory.compare(oldVersion, currentVersion);
}

代码示例来源:origin: javers/javers

@Override
public Object map(Object sourceArray, EnumerableFunction mapFunction, OwnerContext owner) {
  Validate.argumentsAreNotNull(sourceArray, mapFunction, owner);
  int len = Array.getLength(sourceArray);
  Object targetArray = newPrimitiveOrObjectArray(len);
  EnumerationAwareOwnerContext enumerationContext = new IndexableEnumerationOwnerContext(owner);
  for (int i=0; i<len; i++){
    Object sourceVal = Array.get(sourceArray,i);
    Array.set(targetArray, i, mapFunction.apply(sourceVal, enumerationContext));
  }
  return targetArray;
}

代码示例来源:origin: javers/javers

@Override
public void persist(Commit commit) {
  Validate.argumentsAreNotNull(commit);
  List<CdoSnapshot> snapshots = commit.getSnapshots();
  for (CdoSnapshot s : snapshots){
    persist(s);
  }
  logger.debug("{} snapshot(s) persisted", snapshots.size());
  head = commit.getId();
  commits.put(getHeadId(), counter.incrementAndGet());
}

代码示例来源:origin: javers/javers

@Override
public Optional<CdoSnapshot> getHistoricalSnapshot(Object localId, Class entity, LocalDateTime effectiveDate) {
  Validate.argumentsAreNotNull(localId, entity, effectiveDate);
  return repository.getHistorical(globalIdFactory.createInstanceId(localId, entity), effectiveDate);
}

代码示例来源:origin: javers/javers

public Commit create(String author, Map<String, String> properties, Object currentVersion){
  argumentsAreNotNull(author, currentVersion);
  LiveGraph currentGraph = createLiveGraph(currentVersion);
  return createCommit(author, properties, currentGraph);
}

代码示例来源:origin: javers/javers

public CdoSnapshotState deserialize(JsonElement stateElement, ManagedType managedType){
  Validate.argumentsAreNotNull(stateElement, managedType, context);
  JsonObject stateObject = (JsonObject) stateElement;
  CdoSnapshotStateBuilder builder = cdoSnapshotState();
  stateObject.entrySet().stream().forEach(e -> {
    builder.withPropertyValue(e.getKey(),
        decodePropertyValue(e.getValue(), context, managedType.findProperty(e.getKey())));
  });
  return builder.build();
}

代码示例来源:origin: javers/javers

/**
 * last snapshot with commitId <= given date
 */
public Optional<CdoSnapshot> getHistorical(GlobalId globalId, LocalDateTime timePoint) {
  argumentsAreNotNull(globalId, timePoint);
  return delegate.getStateHistory(globalId, QueryParamsBuilder.withLimit(1).to(timePoint).build())
      .stream().findFirst();
}

代码示例来源:origin: javers/javers

public Diff singleTerminal(GlobalId removedId, CommitMetadata commitMetadata){
  Validate.argumentsAreNotNull(removedId, commitMetadata);
  DiffBuilder diff = new DiffBuilder(javersCoreConfiguration.getPrettyValuePrinter());
  diff.addChange(new ObjectRemoved(removedId, empty(), of(commitMetadata)));
  return diff.build();
}

代码示例来源:origin: javers/javers

private void addFullMapping(Type javaType, JaversType newType){
  Validate.argumentsAreNotNull(javaType, newType);
  putToMap(javaType, newType);
  if (newType instanceof ManagedType){
    ManagedType managedType = (ManagedType)newType;
    mappedTypeNames.put(new DuckType(managedType.getName()), ReflectionUtil.extractClass(javaType));
    mappedTypeNames.put(new DuckType(managedType), ReflectionUtil.extractClass(javaType));
  }
  if (newType instanceof EntityType) {
    inferIdPropertyTypeForEntity((EntityType) newType);
  }
}

代码示例来源:origin: javers/javers

/**
 * last snapshot with commitId <= given timePoint
 */
public List<CdoSnapshot> getHistoricals(GlobalId globalId, CommitId timePoint, boolean withChildValueObjects, int limit) {
  argumentsAreNotNull(globalId, timePoint);
  return delegate.getStateHistory(globalId, QueryParamsBuilder
          .withLimit(limit)
          .withChildValueObjects(withChildValueObjects)
          .toCommitId(timePoint).build());
}

代码示例来源:origin: javers/javers

private JaversType spawnFromPrototype(JavaRichType javaRichType, JaversType prototype) {
  Validate.argumentsAreNotNull(javaRichType, prototype);
  if (prototype instanceof ManagedType) {
    ManagedType managedPrototype = (ManagedType) prototype;
    ManagedClass managedClass = managedClassFactory.createFromPrototype(javaRichType.javaClass, javaRichType.getScan(),
        managedPrototype.getManagedClass().getManagedPropertiesFilter());
    return managedPrototype.spawn(managedClass, javaRichType.getScan().typeName());
  } else {
    return prototype.spawn(javaRichType.javaType); //delegate to simple constructor
  }
}

相关文章