org.nakedobjects.metamodel.commons.ensure.Assert.assertTrue()方法的使用及代码示例

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

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

Assert.assertTrue介绍

暂无

代码示例

代码示例来源:origin: org.nakedobjects/metamodel

public static void assertFalse(final String message, final boolean flag) {
  assertTrue(message, !flag);
}

代码示例来源:origin: org.nakedobjects/metamodel

public static void assertNotNull(final String message, final Object target, final Object object) {
  assertTrue(message, target, object != null);
}

代码示例来源:origin: org.nakedobjects/metamodel

public static void assertEquals(final String message, final Object expected, final Object actual) {
  assertTrue(message + ": expected " + expected + " but was " + actual, (expected == null && actual == null)
      || (expected != null && expected.equals(actual)));
}

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

public static void assertEquals(final String message, final Object expected, final Object actual) {
  assertTrue(message + ": expected " + expected + " but was " + actual, (expected == null && actual == null)
      || (expected != null && expected.equals(actual)));
}

代码示例来源:origin: org.nakedobjects.core/runtime

public void copyFrom(final Oid oid) {
  Assert.assertTrue(oid instanceof SerialOid);
  final SerialOid from = (SerialOid) oid;
  this.serialNo = from.serialNo;
  this.state = from.state;
  cacheState();
}

代码示例来源:origin: org.nakedobjects.core/runtime

/**
 * Should be called prior to {@link #makePersistent()}
 */
public void setId(final long serialNo) {
  Assert.assertTrue(state.isTransient());
  this.newSerialNo = serialNo;
}

代码示例来源:origin: org.nakedobjects.core/runtime

public void makePersistent() {
  Assert.assertTrue(state.isTransient());
  Assert.assertTrue(newSerialNo != 0);
  previous = new SerialOid(this.serialNo, state);
  this.serialNo = newSerialNo;
  this.state = State.PERSISTENT;
  cacheState();
}

代码示例来源:origin: org.nakedobjects/metamodel

public <T> List<T> allMatches(final Class<T> type, final T pattern) {
  Assert.assertTrue("pattern not compatible with type", type.isAssignableFrom(pattern.getClass()));
  return allMatches(new QueryFindByPattern<T>(type, pattern));
}

代码示例来源:origin: org.nakedobjects.core/runtime

private void tokenizeLine(final Map<String,List<String>> map, final String line) {
  final StringTokenizer tokens = new StringTokenizer(line, ":", false);
  Assert.assertTrue(tokens.countTokens() == 2);
  final String token1 = tokens.nextToken();
  final String token2 = tokens.nextToken();
  final Identifier identifier = memberFromString(token1.trim());
  final List<String> roles = tokenizeRoles(token2);
  String identityString = identifier.toIdentityString(Identifier.CLASS_MEMBERNAME_PARMS);
  map.put(identityString, roles);
}

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

public <T> List<T> allMatches(final Class<T> type, final T pattern) {
  Assert.assertTrue("pattern not compatible with type", type.isAssignableFrom(pattern.getClass()));
  return allMatches(new QueryFindByPattern<T>(type, pattern));
}

代码示例来源:origin: org.nakedobjects.core/remoting

/**
 * Called client-side only:
 * <ul>
 * <li>by {@link ClientSideTransactionManager#endTransaction()}
 * </ul>
 */
public ObjectData encodeMakePersistentGraph(final NakedObject adapter, final KnownObjectsRequest knownObjects) {
  Assert.assertTrue("transient", adapter.isTransient());
  return (ObjectData) encode(adapter, clientSideAddGraphDepth, knownObjects);
}

代码示例来源:origin: org.nakedobjects/remoting

/**
 * Called client-side only:
 * <ul>
 * <li>by {@link ClientSideTransactionManager#endTransaction()}
 * </ul>
 */
public ObjectData encodeMakePersistentGraph(final NakedObject adapter, final KnownObjectsRequest knownObjects) {
  Assert.assertTrue("transient", adapter.isTransient());
  return (ObjectData) encode(adapter, clientSideAddGraphDepth, knownObjects);
}

代码示例来源:origin: org.nakedobjects.plugins/htmlviewer-viewer

public TransientObjectMapping(final NakedObject adapter) {
  oid = adapter.getOid();
  Assert.assertTrue("OID is for persistent", oid.isTransient());
  Assert.assertTrue("adapter is for persistent", adapter.isTransient());
  memento = new Memento(adapter);
}

代码示例来源:origin: org.nakedobjects.plugins/html-viewer

public TransientObjectMapping(final NakedObject adapter) {
  oid = adapter.getOid();
  Assert.assertTrue("OID is for persistent", oid.isTransient());
  Assert.assertTrue("adapter is for persistent", adapter.isTransient());
  memento = new Memento(adapter);
}

代码示例来源:origin: org.nakedobjects.plugins/html-viewer

public void addTaskCrumb(final Task task) {
  while (crumbs.size() > 1 && !(crumbs.lastElement() instanceof ObjectCrumb)) {
    crumbs.pop();
  }
  Assert.assertNotNull(task);
  Assert.assertTrue(!isTask());
  task.init(this);
  crumbs.push(new TaskCrumb(task));
}

代码示例来源:origin: org.nakedobjects.plugins/htmlviewer-viewer

public void addTaskCrumb(final Task task) {
  while (crumbs.size() > 1 && !(crumbs.lastElement() instanceof ObjectCrumb)) {
    crumbs.pop();
  }
  Assert.assertNotNull(task);
  Assert.assertTrue(!isTask());
  task.init(this);
  crumbs.push(new TaskCrumb(task));
}

代码示例来源:origin: org.nakedobjects.core/runtime

public void changeState(final ResolveState newState) {
  
  boolean validToChangeTo = resolveState.isValidToChangeTo(newState);
  // don't call toString() since that could hit titleString() and we might be
  // in the process of transitioning to ghost
  Assert.assertTrue("oid= " + this.getOid() + "; can't change from " + resolveState.name() + " to " + newState.name(), validToChangeTo);
  if (LOG.isDebugEnabled()) {
    // don't call toString() in case in process of transitioning to ghost
    LOG.debug("oid= " +  this.getOid() + "; changing state to " + newState.name());
  }
  resolveState = newState;
}

代码示例来源:origin: org.nakedobjects.plugins/dndviewer

public static ImmediateObjectOption createOption(final NakedObjectAction action, final NakedObject object) {
  Assert.assertTrue("Only suitable for 0 param methods", action.getParameterCount() == 0);
  if (!action.isVisible(NakedObjectsContext.getAuthenticationSession(), object).isAllowed()) {
    return null;
  }
  final ImmediateObjectOption option = new ImmediateObjectOption(action, object);
  return option;
}

代码示例来源:origin: org.nakedobjects.plugins/dndviewer

public static ImmediateObjectOption createServiceOption(final NakedObjectAction action, final NakedObject object) {
  Assert.assertTrue("Only suitable for 1 param methods", action.getParameterCount() == 1);
  if (!action.isVisible(NakedObjectsContext.getAuthenticationSession(), object).isAllowed()) {
    return null;
  }
  final ImmediateObjectOption option = new ImmediateObjectOption(action, object);
  return option;
}

代码示例来源:origin: org.nakedobjects.plugins/dndviewer

public static DialoggedObjectOption createOption(final NakedObjectAction action, final NakedObject object) {
  final int paramCount = action.getParameterCount();
  Assert.assertTrue("Only for actions taking one or more params", paramCount > 0);
  if (!action.isVisible(NakedObjectsContext.getAuthenticationSession(), object).isAllowed()
      || !action.isVisible(NakedObjectsContext.getAuthenticationSession(), object).isAllowed()) {
    return null;
  }
  final DialoggedObjectOption option = new DialoggedObjectOption(action, object);
  return option;
}

相关文章