com.tc.util.Assert.assertNotNull()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(200)

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

Assert.assertNotNull介绍

[英]If o is null, throw assertion error
[中]如果o为null,则抛出断言错误

代码示例

代码示例来源:origin: org.terracotta/terracotta-ee

public ElementReturn(SchemaParticle particle, boolean isOptional) {
 Assert.assertNotNull(particle);
 this.particle = particle;
 this.isOptional = isOptional;
}

代码示例来源:origin: org.terracotta/terracotta-ee

public StandardXMLFileConfigurationCreator(final TCLogger logger, final ConfigurationSpec configurationSpec,
                      final ConfigBeanFactory beanFactory, PwProvider pwProvider) {
 Assert.assertNotNull(beanFactory);
 this.logger = logger;
 this.beanFactory = beanFactory;
 this.configurationSpec = configurationSpec;
 this.pwProvider = pwProvider;
}

代码示例来源:origin: org.terracotta/terracotta-ee

public ManagedObjectImpl(final ObjectID id, ManagedObjectPersistor persistor) {
 Assert.assertNotNull(id);
 this.id = id;
 this.persistor = persistor;
}

代码示例来源:origin: org.terracotta/terracotta-l1

@Override
public Timer getRestoreConnectTimer() {
 Assert.assertNotNull(this.restoreConnectTimer);
 return this.restoreConnectTimer;
}

代码示例来源:origin: org.terracotta/terracotta-l1

public StandardXMLFileConfigurationCreator(final TCLogger logger, final ConfigurationSpec configurationSpec,
                      final ConfigBeanFactory beanFactory, PwProvider pwProvider) {
 Assert.assertNotNull(beanFactory);
 this.logger = logger;
 this.beanFactory = beanFactory;
 this.configurationSpec = configurationSpec;
 this.pwProvider = pwProvider;
}

代码示例来源:origin: org.terracotta/terracotta-l1

public ConfigurationSpec(String baseConfigSpec, String serverTopologyOverrideConfigSpec, ConfigMode configMode,
             File workingDir) {
 Assert.assertNotNull(baseConfigSpec);
 Assert.assertNotBlank(baseConfigSpec);
 Assert.assertNotNull(workingDir);
 this.baseConfigSpec = baseConfigSpec;
 this.serverTopologyOverrideConfigSpec = serverTopologyOverrideConfigSpec;
 this.configMode = configMode;
 this.workingDir = workingDir;
}

代码示例来源:origin: org.terracotta/terracotta-l1

public ChildBeanRepository(BeanRepository parent, Class requiredBeanClass, ChildBeanFetcher childFetcher) {
 Assert.assertNotNull(parent);
 Assert.assertNotNull(requiredBeanClass);
 Assert.assertNotNull(childFetcher);
 this.parent = parent;
 this.requiredBeanClass = requiredBeanClass;
 this.childFetcher = childFetcher;
 this.listeners = new ConfigurationChangeListenerSet();
 this.parent.addListener(this);
}

代码示例来源:origin: org.terracotta/terracotta-ee

public StandardBeanRepository(Class requiredClass) {
 Assert.assertNotNull(requiredClass);
 this.requiredClass = requiredClass;
 this.listenerSet = new ConfigurationChangeListenerSet();
 this.validators = new HashSet();
 this.bean = null;
}

代码示例来源:origin: org.terracotta/terracotta-ee

public CommonL1ConfigObject(ConfigContext context) {
 super(context);
 Assert.assertNotNull(context);
 this.context.ensureRepositoryProvides(Client.class);
}

代码示例来源:origin: org.terracotta/terracotta-ee

/**
 * Constructor for when you want a transport that you can specify a connection (e.g., in a server). This constructor
 * will create an open MessageTransport ready for use.
 */
public ServerMessageTransport(ConnectionID connectionId, TCConnection conn,
               TransportHandshakeErrorHandler handshakeErrorHandler,
               TransportHandshakeMessageFactory messageFactory) {
 super(MessageTransportState.STATE_START, handshakeErrorHandler, messageFactory, true, smtLogger);
 this.connectionId = connectionId;
 Assert.assertNotNull(conn);
 wireNewConnection(conn);
}

代码示例来源:origin: org.terracotta/terracotta-ee

public ResourceConfigurationSource(String path, Class relativeTo) {
 Assert.assertNotBlank(path);
 Assert.assertNotNull(relativeTo);
 this.path = path;
 this.relativeTo = relativeTo;
}

代码示例来源:origin: org.terracotta/terracotta-ee

@Override
public Set<ConnectionID> loadConnectionIDs() {
 Assert.assertNotNull(uid);
 Set<ConnectionID> connections = new HashSet<ConnectionID>();
 for (final ChannelID channelID : clientStateStore.loadClientIDs()) {
  connections.add(new ConnectionID(ConnectionID.NULL_JVM_ID, (channelID).toLong(), uid));
 }
 return connections;
}

代码示例来源:origin: org.terracotta/terracotta-ee

private void addSpec(final TransparencyClassSpec spec) {
 synchronized (specLock) {
  Assert.eval(!classSpecs.containsKey(spec.getClassName()));
  Assert.assertNotNull(spec);
  classSpecs.put(spec.getClassName(), spec);
 }
}

代码示例来源:origin: org.terracotta/terracotta-ee

public static void assertDoesNotContainsElement(Object[] objectArray, Object element) {
 assertNotNull(objectArray);
 for (int pos = 0; pos < objectArray.length; pos++) {
  if (objectArray[pos] == element) {
   failure("Element<" + element + "> was found in array " + StringUtil.toString(objectArray, ",", "<", ">"));
  }
 }
}

代码示例来源:origin: org.terracotta/terracotta-ee

public ConnectionHealthCheckerImpl(HealthCheckerConfig healthCheckerConfig, TCConnectionManager connManager) {
 Assert.assertNotNull(healthCheckerConfig);
 Assert.eval(healthCheckerConfig.isHealthCheckerEnabled());
 logger = TCLogging.getLogger(ConnectionHealthCheckerImpl.class.getName() + ": "
                + healthCheckerConfig.getHealthCheckerName());
 logger.setLevel(LogLevelImpl.DEBUG);
 monitorThreadEngine = getHealthMonitorThreadEngine(healthCheckerConfig, connManager, logger);
 monitorThread = new Thread(monitorThreadEngine, "HealthChecker");
 monitorThread.setDaemon(true);
}

代码示例来源:origin: org.terracotta/terracotta-l1

@Override
public void close() {
 if (!status.getAndSetIsClosed()) {
  Assert.assertNotNull(this.sendLayer);
  this.sendLayer.close();
  fireChannelClosedEvent();
 }
}

代码示例来源:origin: org.terracotta/terracotta-l1

@Override
 public ServerEventListenerManager createServerEventListenerManager(final DSOClientMessageChannel dsoChannel,
                                   final TaskRunner runner) {
  final GroupID[] defaultGroups = dsoChannel.getGroupIDs();
  Assert.assertNotNull(defaultGroups);
  Assert.assertEquals(1, defaultGroups.length);
  return new ServerEventListenerManagerImpl(runner);
 }
}

代码示例来源:origin: org.terracotta/terracotta-ee

public char[] getPassword() {
 char[] password = null;
 if (securityInfo.hasCredentials()) {
  Assert.assertNotNull("TCSecurityManager should not be null", pwProvider);
  // use user-password of first server in the group
  ConnectionInfo connectionInfo = addressProvider.getIterator().next();
  password = pwProvider.getPasswordForTC(securityInfo.getUsername(), connectionInfo.getHostname(),
                     connectionInfo.getPort());
  Assert.assertNotNull("password is null from securityInfo " + securityInfo, password);
 }
 return password;
}

代码示例来源:origin: org.terracotta/terracotta-ee

private State moveToWaiter(State oldState) {
 Assert.assertNotNull(oldState);
 Assert.assertTrue(oldState.getType() == Type.HOLDER);
 Assert.assertTrue(oldState.getLockLevel() == ServerLockLevel.WRITE);
 switch (oldState.getLockLevel()) {
  case WRITE:
   return State.WAITER;
  default:
   // should never come here
   throw new IllegalStateException("Should never come here");
 }
}

代码示例来源:origin: org.terracotta/terracotta-ee

private TCObject lookupOrCreateIfNecesary(final Object pojo, final NonPortableEventContext context, final GroupID gid) {
 Assert.assertNotNull(pojo);
 TCObject obj = basicLookup(pojo);
 if (obj == null || obj.isNew()) {
  executePreCreateMethods(pojo);
  obj = create(pojo, context, gid);
 }
 return obj;
}

相关文章