org.teiid.core.util.Assertion.failed()方法的使用及代码示例

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

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

Assertion.failed介绍

暂无

代码示例

代码示例来源:origin: org.jboss.teiid/teiid-engine

void setComment(String comment){
  if (this.elementStarted) {
    Assertion.failed("Comment must not be added to Element after Element is started."); //$NON-NLS-1$
  }
  this.comment = comment;
}

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

public static final void assertTrue(boolean condition, String msgKey) {
  if(! condition) {
    final String msg = msgKey != null ?
              msgKey :
              CorePlugin.Util.getString("Assertion.Assertion_failed"); //$NON-NLS-1$ 
    failed(msg);
  }   
}

代码示例来源:origin: org.teiid/teiid-common-core

public static final void isNull(Object value, String message) {
  if ( value != null ) {
    final String msg = message != null ?
              message :
              CorePlugin.Util.getString("Assertion.isNull"); //$NON-NLS-1$
    failed(msg);
  }
}

代码示例来源:origin: org.teiid/teiid-common-core

public static final void assertTrue(boolean condition, String msgKey) {
  if(! condition) {
    final String msg = msgKey != null ?
              msgKey :
              CorePlugin.Util.getString("Assertion.Assertion_failed"); //$NON-NLS-1$ 
    failed(msg);
  }   
}

代码示例来源:origin: org.jboss.teiid/teiid-engine

/**
 * Set the underlying symbol
 * @param symbol New symbol
 */
public void setSymbol(Expression symbol) {
  if(symbol instanceof AliasSymbol || symbol == null){
    Assertion.failed(QueryPlugin.Util.getString("ERR.015.010.0029")); //$NON-NLS-1$
  }
  this.symbol = symbol;
}

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

public static final void isNotNull(Object value, String message) {
  if ( value == null ) {
    final String msg = message != null ?
              message :
              CorePlugin.Util.getString("Assertion.isNotNull"); //$NON-NLS-1$
    failed(msg);
  }
}

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

public static final void isNull(Object value, String message) {
  if ( value != null ) {
    final String msg = message != null ?
              message :
              CorePlugin.Util.getString("Assertion.isNull"); //$NON-NLS-1$
    failed(msg);
  }
}

代码示例来源:origin: org.teiid/teiid-common-core

public static final void isNotNull(Object value, String message) {
  if ( value == null ) {
    final String msg = message != null ?
              message :
              CorePlugin.Util.getString("Assertion.isNotNull"); //$NON-NLS-1$
    failed(msg);
  }
}

代码示例来源:origin: org.teiid/teiid-engine

/**
 * Set the underlying symbol
 * @param symbol New symbol
 */
public void setSymbol(Expression symbol) {
  if(symbol instanceof AliasSymbol || symbol == null){
    Assertion.failed(QueryPlugin.Util.getString("ERR.015.010.0029")); //$NON-NLS-1$
  }
  this.symbol = symbol;
}

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

/**
 * Set the underlying symbol
 * @param symbol New symbol
 */
public void setSymbol(Expression symbol) {
  if(symbol instanceof AliasSymbol || symbol == null){
    Assertion.failed(QueryPlugin.Util.getString("ERR.015.010.0029")); //$NON-NLS-1$
  }
  this.symbol = symbol;
}

代码示例来源:origin: org.jboss.teiid/teiid-engine

int getOperator(String opString) {
  if (opString.equals("=")) { //$NON-NLS-1$
    return CompareCriteria.EQ;
  } else if (opString.equals("<>") || opString.equals("!=")) { //$NON-NLS-1$ //$NON-NLS-2$
    return CompareCriteria.NE;
  } else if (opString.equals("<")) { //$NON-NLS-1$
    return CompareCriteria.LT;
  } else if (opString.equals(">")) { //$NON-NLS-1$
    return CompareCriteria.GT;
  } else if (opString.equals("<=")) { //$NON-NLS-1$
    return CompareCriteria.LE;
  } else if (opString.equals(">=")) { //$NON-NLS-1$
    return CompareCriteria.GE;
  }
  
  Assertion.failed("unknown operator"); //$NON-NLS-1$
  return 0;
}

代码示例来源:origin: org.teiid/teiid-engine

int getOperator(String opString) {
  if (opString.equals("=")) { //$NON-NLS-1$
    return CompareCriteria.EQ;
  } else if (opString.equals("<>") || opString.equals("!=")) { //$NON-NLS-1$ //$NON-NLS-2$
    return CompareCriteria.NE;
  } else if (opString.equals("<")) { //$NON-NLS-1$
    return CompareCriteria.LT;
  } else if (opString.equals(">")) { //$NON-NLS-1$
    return CompareCriteria.GT;
  } else if (opString.equals("<=")) { //$NON-NLS-1$
    return CompareCriteria.LE;
  } else if (opString.equals(">=")) { //$NON-NLS-1$
    return CompareCriteria.GE;
  }
  
  Assertion.failed("unknown operator"); //$NON-NLS-1$
  return 0;
}

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

int getOperator(String opString) {
  if (opString.equals("=")) { //$NON-NLS-1$
    return CompareCriteria.EQ;
  } else if (opString.equals("<>") || opString.equals("!=")) { //$NON-NLS-1$ //$NON-NLS-2$
    return CompareCriteria.NE;
  } else if (opString.equals("<")) { //$NON-NLS-1$
    return CompareCriteria.LT;
  } else if (opString.equals(">")) { //$NON-NLS-1$
    return CompareCriteria.GT;
  } else if (opString.equals("<=")) { //$NON-NLS-1$
    return CompareCriteria.LE;
  } else if (opString.equals(">=")) { //$NON-NLS-1$
    return CompareCriteria.GE;
  }
  
  Assertion.failed("unknown operator"); //$NON-NLS-1$
  return 0;
}

代码示例来源:origin: org.jboss.teiid/teiid-engine

void setAttribute(NodeDescriptor descriptor, String value){
  if (this.elementStarted) {
    Assertion.failed("Attributes must not be added to Element after Element is started."); //$NON-NLS-1$
  }
  if(attributes == null) {
    attributes = new AttributesImpl();
  }
  attributes.addAttribute(descriptor.getNamespaceURI(), descriptor.getName(), descriptor.getQName(), DEFAULT_ATTRIBUTE_TYPE, value);
}

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

/**
 * Finds the closest project columns in the current frame
 */
static List<Expression> findTopCols(PlanNode node) {
  PlanNode project = NodeEditor.findNodePreOrder(node, NodeConstants.Types.PROJECT, NodeConstants.Types.SOURCE);
  if (project == null) {
    project = NodeEditor.findParent(node, NodeConstants.Types.PROJECT, NodeConstants.Types.SOURCE);
  }
  if (project != null) {
    return (List<Expression>)project.getProperty(NodeConstants.Info.PROJECT_COLS);
  }
  Assertion.failed("no top cols in frame"); //$NON-NLS-1$
  return null;
}

代码示例来源:origin: org.jboss.teiid/teiid-engine

/**
 * Finds the closest project columns in the current frame
 */
static List<Expression> findTopCols(PlanNode node) {
  PlanNode project = NodeEditor.findNodePreOrder(node, NodeConstants.Types.PROJECT, NodeConstants.Types.SOURCE);
  if (project == null) {
    project = NodeEditor.findParent(node, NodeConstants.Types.PROJECT, NodeConstants.Types.SOURCE);
  }
  if (project != null) {
    return (List<Expression>)project.getProperty(NodeConstants.Info.PROJECT_COLS);
  }
  Assertion.failed("no top cols in frame"); //$NON-NLS-1$
  return null;
}

代码示例来源:origin: org.teiid/teiid-engine

/**
 * Finds the closest project columns in the current frame
 */
static List<Expression> findTopCols(PlanNode node) {
  PlanNode project = NodeEditor.findNodePreOrder(node, NodeConstants.Types.PROJECT, NodeConstants.Types.SOURCE);
  if (project == null) {
    project = NodeEditor.findParent(node, NodeConstants.Types.PROJECT, NodeConstants.Types.SOURCE);
  }
  if (project != null) {
    return (List<Expression>)project.getProperty(NodeConstants.Info.PROJECT_COLS);
  }
  Assertion.failed("no top cols in frame"); //$NON-NLS-1$
  return null;
}

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

public void testFailed() {
  try {
    Assertion.failed(null);
    fail();
  } catch ( AssertionError e ) {
    // expected, but check the message
    assertEquals("null", e.getMessage()); //$NON-NLS-1$
  }
  try {
    Assertion.failed(TEST_MESSAGE);
    fail();
  } catch ( AssertionError e ) {
    // expected, but check the message
    assertEquals(TEST_MESSAGE, e.getMessage());
  }
}

代码示例来源:origin: org.jboss.teiid/teiid-engine

newValues.add(expression);
} else {
  Assertion.failed("Cannot determine element or expression type"); //$NON-NLS-1$

代码示例来源:origin: org.jboss.teiid/teiid-engine

/**
 * @see ProcessorInstruction#process(ProcessorEnvironment)
 */
public XMLContext process(XMLProcessorEnvironment env, XMLContext context)
  throws BlockedException, TeiidComponentException, TeiidProcessingException{
  DocumentInProgress doc = env.getDocumentInProgress();
  switch(this.direction) {
    case UP:
      LogManager.logTrace(org.teiid.logging.LogConstants.CTX_XML_PLAN, "UP in document"); //$NON-NLS-1$
      try {
        doc.moveToParent();
      } catch (SAXException err) {
         throw new TeiidComponentException(QueryPlugin.Event.TEIID30193, err, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30193));
      }
      break;
    case DOWN:
      LogManager.logTrace(org.teiid.logging.LogConstants.CTX_XML_PLAN, "LAST child in document"); //$NON-NLS-1$
      doc.moveToLastChild();
      break;
    default:
      Assertion.failed(QueryPlugin.Util.getString("ERR.015.006.0051", direction)); //$NON-NLS-1$
      break;
  }
  env.incrementCurrentProgramCounter();
  return context;
}

相关文章