gpt4 book ai didi

com.quinsoft.zeidon.ZeidonException类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 11:04:10 27 4
gpt4 key购买 nike

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

ZeidonException介绍

[英]The base exception class for all Zeidon-specific exceptions. This class has the following conveniences over regular exceptions: - The exception message can be initialized using String.format parsing. For example, new ZeidonException( "Line number: %d, text = %s", line, msg ); - Message text can be added to the exception after it's been instantiated. This allows code to catch an exception, add more information, and rethrow it. See appendMessage() and prependMessage(). - The logic is smart enough to ignore duplicate messages. - Checked exceptions can be easily wrapped by ZeidonException using wrapException(). This will keep the call stack the same as the wrapped exception.
[中]所有Zeidon特定异常的基本异常类。与常规异常相比,此类具有以下便利性:-可以使用字符串初始化异常消息。格式解析。例如,新的ZeidonException(“行号:%d,文本=%s”,行,消息);-消息文本可以在实例化后添加到异常中。这允许代码捕捉异常,添加更多信息,并重新浏览它。请参阅appendMessage()和prependMessage()逻辑足够聪明,可以忽略重复的消息。-ZeidonException可以使用wrapException()轻松包装选中的异常。这将保持调用堆栈与包装的异常相同。

代码示例

代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe

@Override
public EntityIterator<? extends EntityInstance> eachEntity( String scopingEntityName )
{
  throw new ZeidonException( "Scoping entity not allowed on the root" );
}

代码示例来源:origin: com.quinsoft.zeidon/object-browser

private void createBrowserDir( String dir )
{
  File theDir = new File( dir );
  // if the directory does not exist, create it
  if ( theDir.exists() )
    return;
  try
  {
    theDir.mkdir();
  }
  catch ( Exception e )
  {
    throw ZeidonException.wrapException( e ).prependFilename( dir );
  }
}

代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe

/**
 * Adds additional text information to the exception message.  New messages are inserted at
 * the beginning of the "additional info".
 *
 * @param format
 * @param strings
 */
public ZeidonException prependMessage( String format, Object...strings )
{
  return addMessage( 0, format( format, strings ) );
}

代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe

@Override
public Integer convertToInteger(Task task, AttributeDef attributeDef, Object internalValue, String contextName)
{
  try
  {
    return Integer.parseInt( (String) internalValue );
  }
  catch ( Exception e )
  {
    throw ZeidonException.wrapException( e )
        .prependAttributeDef( attributeDef )
        .appendMessage( "Value = %s", internalValue )
        .appendMessage( "contextName = %s", contextName );
  }
}

代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe

public ZeidonException( String format, Object...strings )
{
  super(format( format, strings ));
  this.message = getClass().getName() + ": " + format( format, strings );
  runHandler();
}

代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe

public static void ReadPortableFile( Task task, String filename, ZeidonLogger logger, PortableFileEntityHandler entityHandler )
{
  try
  {
    logger.debug( "Reading portable file %s", filename );
    InputStream is = JoeUtils.getInputStream(task, filename, entityHandler.getClass().getClassLoader());
    if ( is == null )
      throw new ZeidonException( "Couldn't find file %s", filename );
    ReadPortableFile( is, logger, entityHandler );
  }
  catch ( Exception e )
  {
    // Add filename to exception.
    throw ZeidonException.wrapException( e ).prependFilename( filename );
  }
}

代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe

private void write( String string )
{
  try
  {
    writer.write( string );
  }
  catch ( IOException e )
  {
    throw ZeidonException.wrapException( e )
               .appendMessage( "Attempting to write: %s", StringUtils.substring( string, 0, 100 ) );
  }
}

代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe

synchronized void addHashKey( AttributeDef attributeDef, EntityInstanceImpl entityInstance )
{
  Map<Object, EntityInstanceImpl> map = getHashMapForAttribute( attributeDef );
  Object internalValue = entityInstance.getAttribute( attributeDef ).getValue();
  if ( internalValue == null )
  {
    throw new ZeidonException( "Attempting to add null attribute value to attribute hashmap" )
            .prependAttributeDef( attributeDef );
  }
  if ( map.containsKey( internalValue ) )
  {
      throw new ZeidonException( "Attempting to add duplicate attribute values to attribute hashmap" )
            .prependAttributeDef( attributeDef )
            .appendMessage( "Attribute value = %s", internalValue );
  }
  map.put( internalValue, entityInstance );
}

代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe

throw ZeidonException.wrapException( e ).appendMessage( "Error while attempting to load zeidon.app" );
  throw ZeidonException.wrapException( e ).prependFilename( filename );
throw new ZeidonException( "No resources named zeidon.app found." );

代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe

@Override
protected void getSqlValue(SqlStatement stmt, Domain domain, AttributeDef attributeDef, StringBuilder buffer, Object value)
{
  try
  {
    if ( getTranslator().appendSqlValue( stmt, buffer, domain, attributeDef, value ) )
      return;
    throw new ZeidonException("JdbcDomainTranslator did not correctly translate an attribute value" );
  }
  catch ( Exception e )
  {
    throw ZeidonException.wrapException( e ).prependAttributeDef( attributeDef ).appendMessage( "Value = %s", value );
  }
}

代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe

int compare(TaskImpl task, AttributeInstance attributeInstance, AttributeDef attributeDef, Object o)
{
  try
  {
    return domain.compare( task, attributeInstance, attributeDef, this.getInternalValue(), o );
  }
  catch ( Throwable t )
  {
    throw ZeidonException.wrapException( t ).prependAttributeDef( attributeDef );
  }
}

代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe

/**
 * Generate a random test value for this domain.  This is used by test code to create random
 * test data.
 *
 * @param task current task
 * @param attributeDef def of the attribute.
 * @param entityInstance if not null this is the EntityInstance that will store the test data.
 *
 * @return random test data for this domain.
 */
@Override
public Object generateRandomTestValue( Task task, AttributeDef attributeDef, EntityInstance entityInstance )
{
  throw new ZeidonException( "Must be implemented for this domain" ).appendMessage( "Domain = %s", getName() );
}

代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe

throw new ZeidonException( "Domain does not have 'Name' specified" ).appendMessage( "Values = " + domainProperties.toString() );
    throw new ZeidonException( "Domain does not have 'JavaClass' specified" ).appendMessage( "Domain = %s", domainProperties.get( "Name" ) );
throw ZeidonException.wrapException( e ).prependMessage("Domain = %s", currentDomain );

代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe

/**
 * Check to make sure the include is valid.
 */
private void performValidation()
{
  // Make sure entities are link compatible..
  rootTargetEntityDef.validateLinking( rootSource.getEntityDef() );
  if ( ! rootTargetEntityDef.isInclude() && rootTargetEntityDef.getParent() != null )
    throw new ZeidonException( "Target Entity does not allow include." ).prependEntityDef( rootTargetEntityDef );
  if ( ! rootSource.getEntityDef().isIncludeSource() )
    throw new ZeidonException( "Source Entity is not flagged as include source." ).prependEntityDef( rootSource.getEntityDef() );
  // TODO: Check for read-only target view.
  // TODO: Check for DataRecords
  // TODO: Check for matching attributes if target LodDef does not have a datarecord.
  // TODO: Check for versioned instance.
  // TODO: Validate insert position (fnValidateInsertPosition).
  // TODO: Run constraints.
  // TODO: Implement fnValidSubobjectStructureMatch
  // TODO: Make sure source entity is not a child of the target's parent.
}

代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe

/**
 * Writes the OI to a temp file.  The name of the temp file is created using File.createTempFile
 * with the name of the LOD and the desired extension (e.g. .XML or .JSON).
 *
 * @return the name of the generated file name.
 */
public String toTempFile()
{
  if ( viewList.size() == 0 )
    throw new ZeidonException( "Specify at least one view before calling toTempFile()" );
  View view = viewList.get( 0 );
  String prefix = view.getLodDef().getName() + "_";
  File file;
  try
  {
    file = File.createTempFile( prefix, getFormat().getExtension() );
  }
  catch ( IOException e )
  {
    throw ZeidonException.wrapException( e ).appendMessage( "Filename = %s", prefix );
  }
  return toFile( file.getAbsolutePath() );
}

代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe

throw new ZeidonException( "Attribute hashkey value is missing from table." )
            .prependEntityInstance( ei )
            .prependAttributeDef( attributeDef )
            .appendMessage( "HashKey value = %s", value );
    throw new ZeidonException( "Attribute hashkey returns wrong EI." )
            .prependEntityInstance( ei )
            .prependAttributeDef( attributeDef )
            .appendMessage( "HashKey value = %s", value.toString() )
            .appendMessage( "Wrong EI = %s", hashEi.toString() );
throw new ZeidonException( "Unequal hash count values." );

代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe

/**
 * Waits for the future to finish and come back.
 */
private void waitForFuture()
{
  try
  {
    future.get();
    future = null; // Let GC clean up the future.
  }
  catch ( ExecutionException e )
  {
    throw ZeidonException.wrapException( e.getCause() );
  }
  catch ( Exception e )
  {
    throw ZeidonException.wrapException( e );
  }
}

代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe

throw new ZeidonException( "Entities do not have matching ER Entity Tokens." )
        .prependEntityDef(this)
        .prependMessage("Other entity = %s", otherEntity );

代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe

/**
 * Adds milliseconds to the datetime value.
 */
@Override
public Object addToAttribute( Task task, AttributeInstance attributeInstance, AttributeDef attributeDef, Object currentValue, Object addValue )
{
  DateTime date1 = (DateTime) convertExternalValue( task, attributeInstance, attributeDef, null, currentValue );
  if ( date1 == null )
    throw new ZeidonException( "Target attribute for add is NULL" )
            .prependAttributeDef( attributeDef );
  if ( addValue == null )
    return date1;
  if ( addValue instanceof Number )
  {
    int millis = ((Number) addValue).intValue();
    return date1.plusMillis( millis );
  }
  throw new ZeidonException( "Value type of %s not supported for add to DateDomain", addValue.getClass().getName() );
}

代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe

private int executeVmlConstraint( View view, EntityConstraintType type )
{
  ObjectEngine oe = view.getObjectEngine();
  String className = getSourceFileName();
  try
  {
    ClassLoader classLoader = oe.getClassLoader( className );
    Class<?> operationsClass;
    operationsClass = classLoader.loadClass( className );
    Constructor<?> constructor = operationsClass.getConstructor( VML_CONSTRUCTOR_ARG_TYPES );
    Object object = constructor.newInstance( view );
    Method method = object.getClass().getMethod( getConstraintOper(), VML_ARGUMENT_TYPES );
    return (Integer) method.invoke( object, view, this.getName(), type.toInt(), 0 );
  }
  catch ( Exception e )
  {
    throw ZeidonException.wrapException( e )
               .prependEntityDef( this )
               .appendMessage( "EntityConstraint class = %s", className )
               .appendMessage( "Constraint oper = %s", getConstraintOper() )
               .appendMessage( "See inner exception for more info." );
  }
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com