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

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

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

Assertion.isInstanceOf介绍

[英]Verifies that the specified value is an instance of the specified class.
[中]验证指定的值是否为指定类的实例。

代码示例

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

private void setExecution(Command command,
    org.teiid.language.Command translatedCommand, final Execution exec) {
  if (translatedCommand instanceof Call) {
    this.execution = Assertion.isInstanceOf(exec, ProcedureExecution.class, "Call Executions are expected to be ProcedureExecutions"); //$NON-NLS-1$
    StoredProcedure proc = (StoredProcedure)command;
    if (proc.returnParameters()) 			{
    this.execution = Assertion.isInstanceOf(exec, ResultSetExecution.class, "QueryExpression Executions are expected to be ResultSetExecutions"); //$NON-NLS-1$
  } else {
    final boolean singleUpdateCount = connector.returnsSingleUpdateCount() 
        && (translatedCommand instanceof BatchedUpdates || (translatedCommand instanceof BulkCommand && ((BulkCommand)translatedCommand).getParameterValues() != null));
    Assertion.isInstanceOf(exec, UpdateExecution.class, "Update Executions are expected to be UpdateExecutions"); //$NON-NLS-1$
    this.execution = new ResultSetExecution() {
      private int[] results;

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

public void testIsInstanceOf() {
  Assertion.isInstanceOf(new Integer(1),Integer.class,"name"); //$NON-NLS-1$
  Assertion.isInstanceOf("asdfasdf",String.class,"name2"); //$NON-NLS-1$ //$NON-NLS-2$
  try {
    Assertion.isInstanceOf(new Integer(1),Long.class,"name3"); //$NON-NLS-1$
    fail();
  } catch ( ClassCastException e ) {
    // expected, but check the message
    final Object[] params = new Object[]{"name3", Long.class, Integer.class.getName()}; //$NON-NLS-1$
    final String msg = CorePlugin.Util.getString("Assertion.invalidClassMessage",params); //$NON-NLS-1$
    assertEquals(msg, e.getMessage());
  }
}

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

private void setExecution(Command command,
    org.teiid.language.Command translatedCommand, final Execution exec) {
  if (translatedCommand instanceof Call) {
    this.execution = Assertion.isInstanceOf(exec, ProcedureExecution.class, "Call Executions are expected to be ProcedureExecutions"); //$NON-NLS-1$
    StoredProcedure proc = (StoredProcedure)command;
    if (proc.returnParameters()) 			{
    this.execution = Assertion.isInstanceOf(exec, ResultSetExecution.class, "QueryExpression Executions are expected to be ResultSetExecutions"); //$NON-NLS-1$
  } else {
    final boolean singleUpdateCount = connector.returnsSingleUpdateCount() 
        && (translatedCommand instanceof BatchedUpdates || (translatedCommand instanceof BatchedCommand && ((BatchedCommand)translatedCommand).getParameterValues() != null));
    Assertion.isInstanceOf(exec, UpdateExecution.class, "Update Executions are expected to be UpdateExecutions"); //$NON-NLS-1$
    this.execution = new ResultSetExecution() {
      private int[] results;

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

private void setExecution(Command command,
    org.teiid.language.Command translatedCommand, final Execution exec) {
  if (translatedCommand instanceof Call) {
    this.execution = Assertion.isInstanceOf(exec, ProcedureExecution.class, "Call Executions are expected to be ProcedureExecutions"); //$NON-NLS-1$
    StoredProcedure proc = (StoredProcedure)command;
    if (proc.returnParameters()) 			{
    this.execution = Assertion.isInstanceOf(exec, ResultSetExecution.class, "QueryExpression Executions are expected to be ResultSetExecutions"); //$NON-NLS-1$
  } else {
    final boolean singleUpdateCount = connector.returnsSingleUpdateCount() 
        && (translatedCommand instanceof BatchedUpdates || (translatedCommand instanceof BulkCommand && ((BulkCommand)translatedCommand).getParameterValues() != null));
    Assertion.isInstanceOf(exec, UpdateExecution.class, "Update Executions are expected to be UpdateExecutions"); //$NON-NLS-1$
    this.execution = new ResultSetExecution() {
      private int[] results;

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

CreateProcedureCommand cupc = Assertion.isInstanceOf(procCommand, CreateProcedureCommand.class, "Wrong command type"); //$NON-NLS-1$

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

CreateProcedureCommand cupc = Assertion.isInstanceOf(procCommand, CreateProcedureCommand.class, "Wrong command type"); //$NON-NLS-1$

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

CreateProcedureCommand cupc = Assertion.isInstanceOf(procCommand, CreateProcedureCommand.class, "Wrong command type"); //$NON-NLS-1$

相关文章