org.boon.Exceptions.die()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(134)

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

Exceptions.die介绍

暂无

代码示例

代码示例来源:origin: boonproject/boon

@Override
public boolean booleanValue() {
  switch ( type ) {
    case FALSE:
      return false;
    case TRUE:
      return true;
  }
  die();
  return false;
}

代码示例来源:origin: boonproject/boon

@Override
public <T> T[] toArray(T[] a) {
  die("Not supported");
  return null;
}

代码示例来源:origin: boonproject/boon

@Override
public final void setValue( Object obj, Object value ) {
  if ( obj instanceof Map ) {
    Map map = ( Map ) obj;
    map.put( name, value );
    return;
  }
  die( "Object must be a map" );
}

代码示例来源:origin: boonproject/boon

@Override
public final void setDouble( Object obj, double value ) {
  if ( obj instanceof Map ) {
    Map map = ( Map ) obj;
    map.put( name, value );
  }
  die( "Object must be a map" );
}

代码示例来源:origin: boonproject/boon

@Override
public final void setFloat( Object obj, float value ) {
  if ( obj instanceof Map ) {
    Map map = ( Map ) obj;
    map.put( name, value );
  }
  die( "Object must be a map" );
}

代码示例来源:origin: boonproject/boon

@Override
public final void setByte( Object obj, byte value ) {
  if ( obj instanceof Map ) {
    Map map = ( Map ) obj;
    map.put( name, value );
  }
  die( "Object must be a map" );
}

代码示例来源:origin: boonproject/boon

@Override
public final Object getObject( Object obj ) {
  if ( obj instanceof Map ) {
    Map map = ( Map ) obj;
    return map.get( name );
  }
  die( "Object must be a map" );
  return -1;
}

代码示例来源:origin: boonproject/boon

@Override
public int getInt( Object obj ) {
  die( String.format( "Can't call this method on this type %s", this.type ) );
  return 0;
}

代码示例来源:origin: boonproject/boon

@Override
public long getLong( Object obj ) {
  die( String.format( "Can't call this method on this type %s", this.type ) );
  return 0;
}

代码示例来源:origin: boonproject/boon

public OverloadedMethod init() {
  if (lock) {
    die();
  }
  for (List<MethodAccess> methodAccesses : methodAccessListByArgNumber) {
    java.util.Collections.sort(methodAccesses);
  }
  lock();
  return this;
}

代码示例来源:origin: boonproject/boon

@Override
public final boolean getBoolean( Object obj ) {
  if ( obj instanceof Map ) {
    Map map = ( Map ) obj;
    return Conversions.toBoolean( map.get( name ) );
  }
  return die( Boolean.class, "Object must be a map" );
}

代码示例来源:origin: boonproject/boon

@Override
public final long getLong( Object obj ) {
  if ( obj instanceof Map ) {
    Map map = ( Map ) obj;
    return Conversions.toLong( map.get( name ) );
  }
  die( "Object must be a map" );
  return -1;
}

代码示例来源:origin: boonproject/boon

@Override
public final double getDouble( Object obj ) {
  if ( obj instanceof Map ) {
    Map map = ( Map ) obj;
    return Conversions.toDouble( map.get( name ) );
  }
  die( "Object must be a map" );
  return Double.NaN;
}

代码示例来源:origin: boonproject/boon

@Override
public final byte getByte( Object obj ) {
  if ( obj instanceof Map ) {
    Map map = ( Map ) obj;
    return Conversions.toByte( map.get( name ) );
  }
  die( "Object must be a map" );
  return Byte.MAX_VALUE;
}

代码示例来源:origin: boonproject/boon

public static <K, V> int toInt( Map<K, V> map, K key ) {
  V value = map.get(key);
  int v = Conversions.toInt ( value, Integer.MIN_VALUE );
  if ( v == Integer.MIN_VALUE ) {
    die("Cannot convert", key, "into int value", value);
  }
  return v;
}

代码示例来源:origin: boonproject/boon

@Test
public void testCreateWithInstance7() {
  Foo foo = createFromJsonMapResource( fooType, "classpath://config/config.json" );
  boolean ok = foo != null || die();
  ok = foo.bar != null || die();
  ok = foo.bar.name.equals( "barFromJsonResource" )  || die();
}

代码示例来源:origin: boonproject/boon

public static Object invokeOverloaded(Object object, String name, Object... args) {
  ClassMeta classMeta = ClassMeta.classMeta(object.getClass());
  Iterable<MethodAccess> invokers = classMeta.methods(name);
  for (MethodAccess m : invokers) {
    if (m.respondsTo(args)) {
      return m.invoke(object, args);
    }
  }
  return die(Object.class, "Unable to invoke method", name, "on object", object, "with arguments", args);
}

代码示例来源:origin: boonproject/boon

@Test
public void testFromListWithIntWithBossFirstNull() throws Exception {
  employee = fromList(Lists.list(null, 1), Employee.class);
  ok = employee != null || die();
  ok = !"1".equals(employee.abc) || die();
  ok = employee.i == 1 || die();
}

代码示例来源:origin: boonproject/boon

@Test
public void testKeys() {
  Map<String, Employee> map = Maps.map(
      "123", new Employee("Rick", "Hightower"),
      "456", new Employee("Paul", "Tabor"),
      "789", new Employee("Jason", "Daniel")
  );
  store.putAll(map);
  final Collection<String> strings = store.loadAllKeys();
  ok = strings.size() > 3 || die();
}

代码示例来源:origin: boonproject/boon

@Test
public void testComplex() {
  HelloWorldArg message = (HelloWorldArg) Invoker.invokeFromList( new HelloWorld(), "sayArg",
      Lists.list( Lists.list( "1", "Hello" ), 1 ) );
  if (!message.equals( new HelloWorldArg( 1, "Hello" ) )) {
    die();
  }
}

相关文章