org.apache.isis.core.commons.ensure.Assert.assertNotNull()方法的使用及代码示例

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

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

Assert.assertNotNull介绍

暂无

代码示例

代码示例来源:origin: org.apache.isis.runtimes.dflt/runtime

public AggregateAdapters(final ObjectAdapter rootAdapter) {
  Assert.assertNotNull(rootAdapter);
  this.rootAdapter = rootAdapter;
}

代码示例来源:origin: org.apache.isis.runtimes.dflt.objectstores/xml

public ServiceElement(final SerialOid oid, final String id) {
    Assert.assertNotNull("oid", oid);
    Assert.assertNotNull("id", id);
    this.oid = oid;
    this.id = id;
  }
}

代码示例来源:origin: org.apache.isis.runtimes.dflt/runtime

public void addCollectionAdapter(final OneToManyAssociation otma, final ObjectAdapter collectionAdapter) {
  Assert.assertNotNull(otma);
  Assert.assertNotNull(collectionAdapter);
  collectionAdapters.put(otma, collectionAdapter);
}

代码示例来源:origin: org.apache.isis.core/isis-core-runtime

private void addCollectionAdapter(final OneToManyAssociation otma, final ObjectAdapter collectionAdapter) {
  Assert.assertNotNull(otma);
  Assert.assertNotNull(collectionAdapter);
  collectionAdapters.put(otma, collectionAdapter);
}

代码示例来源:origin: org.apache.isis.core/metamodel

@Override
public void injectDependencies(final Object object) {
  Assert.assertNotNull("no container", container);
  Assert.assertNotNull("no services", services);
  final List<Object> servicesCopy = Lists.newArrayList(services);
  servicesCopy.add(container);
  injectServices(object, servicesCopy);
}

代码示例来源:origin: org.apache.isis.core/metamodel

public AggregatedOid(final Oid oid, final String id) {
  Assert.assertNotNull("ID required", id);
  this.parentOid = oid;
  this.id = id;
  initialized();
}

代码示例来源:origin: org.apache.isis.runtimes.dflt.remoting/common

public final ReferenceData serializeAdapter(final ObjectAdapter adapter, final int depth, final KnownObjectsRequest knownObjects) {
  Assert.assertNotNull(adapter);
  return (ReferenceData) serializeObject2(adapter, depth, knownObjects);
}

代码示例来源:origin: org.apache.isis.core/isis-core-runtime

@SuppressWarnings("unchecked")
private <T extends Installer> T getInstaller(final Class<T> cls, final String implName) {
  Assert.assertNotNull("No name specified", implName);
  for (final Installer installer : installerList) {
    if (cls.isAssignableFrom(installer.getClass()) && installer.getName().equals(implName)) {
      return (T) installer;
    }
  }
  return (T) getInstaller(implName);
}

代码示例来源:origin: org.apache.isis.core/commons

public static Class<?> loadClass(final String className) {
  Assert.assertNotNull("Class to instantiate must be specified", className);
  try {
    return Thread.currentThread().getContextClassLoader().loadClass(className);
  } catch (final ClassNotFoundException e) {
    throw new UnavailableClassException("The default type '" + className + "' cannot be found");
  } catch (final NoClassDefFoundError e) {
    throw new InstanceCreationClassException("Default type '" + className + "' found, but is missing a dependent class: " + e.getMessage(), e);
  }
}

代码示例来源:origin: org.apache.isis.core/isis-core-runtime

public RootAndCollectionAdapters(
    final ObjectAdapter parentAdapter,
    final AdapterManager adapterManager) {
  Assert.assertNotNull(parentAdapter);
  this.rootAdapterOid = (RootOid) parentAdapter.getOid();
  this.parentAdapter = parentAdapter;
  addCollectionAdapters(adapterManager);
}

代码示例来源:origin: org.apache.isis.core/commons

public static <R, T extends R> Class<T> loadClass(final String className, final Class<R> requiredType) {
  Assert.assertNotNull("Class to instantiate must be specified", className);
  try {
    final Class<?> loadedClass = loadClass(className);
    if (requiredType != null && !requiredType.isAssignableFrom(loadedClass)) {
      throw new InstanceCreationClassException("Class '" + className + "' is not of type '" + requiredType + "'");
    }
    return CastUtils.cast(loadedClass);
  } catch (final NoClassDefFoundError e) {
    throw new InstanceCreationClassException("Default type '" + className + "' found, but is missing a dependent class: " + e.getMessage(), e);
  }
}

代码示例来源:origin: org.apache.isis.runtimes.dflt/runtime

@Override
@SuppressWarnings("unchecked")
public <T extends Installer> T getInstaller(final Class<T> cls, final String implName) {
  Assert.assertNotNull("No name specified", implName);
  for (final Installer installer : installerList) {
    if (cls.isAssignableFrom(installer.getClass()) && installer.getName().equals(implName)) {
      mergeConfigurationFor(installer);
      injectDependenciesInto(installer);
      return (T) installer;
    }
  }
  return (T) getInstaller(implName);
}

代码示例来源:origin: org.apache.isis.runtimes.dflt.objectstores/xml

@Override
public void resolveImmediately(final ObjectAdapter object) {
  final ObjectData data = (ObjectData) dataManager.loadData((SerialOid) object.getOid());
  Assert.assertNotNull("Not able to read in data during resolve", object, data);
  initObject(object, data);
}

代码示例来源:origin: org.apache.isis.runtimes.dflt/runtime

private ObjectAdapter map(final AggregateAdapters aggregateAdapters) {
  Assert.assertNotNull(aggregateAdapters);
  final ObjectAdapter adapter = aggregateAdapters.getRootAdapter();
  mapAndInjectServices(adapter);
  for (final ObjectAdapter collectionAdapter : aggregateAdapters) {
    mapAndInjectServices(collectionAdapter);
  }
  return adapter;
}

代码示例来源:origin: org.apache.isis.runtimes.dflt.objectstores/sql-impl

@Override
public void makePersistent() {
  Assert.assertTrue(state.isTransient());
  Assert.assertNotNull(newPrimaryKey);
  previous = new SqlOid(this.className, this.primaryKey, state);
  this.primaryKey = newPrimaryKey;
  this.state = State.PERSISTENT;
}

代码示例来源:origin: org.apache.isis.core/progmodel

@Override
public ObjectAdapter fromEncodedString(final String encodedData) {
  Assert.assertNotNull(encodedData);
  if (ENCODED_NULL.equals(encodedData)) {
    return null;
  } else {
    getDependencyInjector().injectDependenciesInto(encoderDecoder);
    final Object decodedObject = encoderDecoder.fromEncodedString(encodedData);
    return getAdapterManager().adapterFor(decodedObject);
  }
}

代码示例来源:origin: org.apache.isis.runtimes.dflt.remoting/common

private Data createMadePersistentCollection(final CollectionData collectionData, final ObjectAdapter collection) {
  final ReferenceData[] elementData = collectionData.getElements();
  final CollectionFacet facet = CollectionFacetUtils.getCollectionFacetFromSpec(collection);
  final Iterator elements = facet.iterator(collection);
  for (int i = 0; i < elementData.length; i++) {
    final ObjectAdapter element = (ObjectAdapter) elements.next();
    final Oid oid = element.getOid();
    Assert.assertNotNull(oid);
    elementData[i] = encodeMadePersistentGraph((ObjectData) elementData[i], element);
  }
  return collectionData;
}

代码示例来源:origin: org.apache.isis.runtimes.dflt.objectstores/sql-impl

@Override
public void convertTransientToPersistentOid(final Oid oid) {
  Assert.assertNotNull("No connection set up", connectionPool);
  final IntegerPrimaryKey primaryKey = new IntegerPrimaryKey((int) ids.nextPersistentId(connectionPool));
  ((SqlOid) oid).setId(primaryKey);
  ((SqlOid) oid).makePersistent();
}

代码示例来源:origin: org.apache.isis.runtimes.dflt.remoting/common

private ObjectAdapter getPersistentObjectAdapter(final ReferenceData object) {
  final ObjectSpecification spec = getSpecification(object.getType());
  final ObjectAdapter obj = getPersistenceSession().loadObject(object.getOid(), spec);
  Assert.assertNotNull(obj);
  return obj;
}

代码示例来源:origin: org.apache.isis.runtimes.dflt.remoting/common

/**
 * Creates a ReferenceData that contains the type, version and OID for the specified object. This can only be used
 * for persistent objects.
 * 
 * <p>
 * Called both client and server-side, in multiple locations.
 */
@Override
public final IdentityData encodeIdentityData(final ObjectAdapter object) {
  Assert.assertNotNull("OID needed for reference", object, object.getOid());
  return dataFactory.createIdentityData(object.getSpecification().getFullIdentifier(), object.getOid(),
    object.getVersion());
}

相关文章