/** * Converts them text align modes to a {@link Pos} element. * * @param aHorizAlignTextMode The horizontal portion to determine the according {@link Pos} element. * @param aVertAlignTextMode The vertical portion to determine the according {@link Pos} element. * * @return The accordingly determines {@link Pos} element. */ public static Pos toPos( HorizAlignTextMode aHorizAlignTextMode, VertAlignTextMode aVertAlignTextMode ) { for ( int i = 0; i < TEXT_ALIGN_MODE_TO_POS.length; i++ ) { if ( TEXT_ALIGN_MODE_TO_POS[i].vertAlignTextMode == aVertAlignTextMode && TEXT_ALIGN_MODE_TO_POS[i].horizAlignTextMode == aHorizAlignTextMode ) { return TEXT_ALIGN_MODE_TO_POS[i].pos; } } throw new BugException( "Missing <Pos> definition for combination <" + aHorizAlignTextMode + "> and <" + aVertAlignTextMode + "> in implementation!" ); }
/** * {@inheritDoc} */ @Override public String toString() { try { return toString( _encoding ); } catch ( IOException e ) { throw new HiddenException( ExceptionUtility.toMessage( e ), e ); } }
/** * To unmarshaled. * * @param <T> the generic type * @param aHttpBody the http body * @param aType the type * @return the t * @throws UnmarshalException the unmarshal exception */ @SuppressWarnings("unchecked") @Override public <T> T toUnmarshaled( String aHttpBody, Class<T> aType ) throws UnmarshalException { if ( String.class.isAssignableFrom( aType ) ) { return (T) aHttpBody; } throw new UnmarshalException( "A problem occurred unmarshaling the HTTP body \"" + aHttpBody + "\" to type <" + aType.getName() + ">. This factory solely supports the type <String>." ); }
/** * Flushes the component by calling {@link #flush(Object)} without you to * require catching a {@link OpenException}. * * @param aHandle The handle identifying the component. * * @throws HiddenException encapsulates the cause and is thrown upon * encountering a {@link OpenException} exception */ default void flushUnchecked( H aHandle ) { try { flush( aHandle ); } catch ( OpenException e ) { throw new HiddenException( e ); } }
@Override public void run() { try { runInitialize(); if ( _stage != null ) { runInitialize( _stage ); } } catch ( InitializeException e ) { LOGGER.error( "Exception during initialization: " + ExceptionUtility.toMessage( e ), e ); } }
/** * Closes the component by calling {@link #close(Object)} without you to * require catching an {@link CloseException}. * * @param aHandle The handle identifying the component. * * @throws HiddenException encapsulates the cause and is thrown upon * encountering a {@link CloseException} exception */ default void closeUnchecked( H aHandle ) { try { close( aHandle ); } catch ( CloseException e ) { throw new HiddenException( e ); } }
/** * This hook method allows you to handle any exceptions being thrown by an * event listener whilst invoking a given event. * * @param aException The exception thrown by the given event listener. * @param aObserver The listener which caused the exception. * @param aEvent The event for which the exception was caused. * @param aExecutionStrategy the execution strategy */ protected void doHandleEventListenerException( Exception aException, O aObserver, EV aEvent, ExecutionStrategy aExecutionStrategy ) { warn( "Caught an unexpected exception while invoking event observer instances with strategy \"" + aExecutionStrategy + "\" with message: " + ExceptionUtility.toMessage( aException ), aException ); }
/** * To bytes per int. * * @param aBitsPerDigit the bits per digit * @return the int */ protected static int toBytesPerInt( int aBitsPerDigit ) { for ( int i = (BYTES_PER_INT * BITS_PER_BYTE); i > 0; i-- ) { if ( i % aBitsPerDigit == 0 ) { return i / BITS_PER_BYTE; } } for ( int i = 1; i <= aBitsPerDigit; i++ ) { if ( i * BITS_PER_BYTE % aBitsPerDigit == 0 ) { return (i * BITS_PER_BYTE) / BITS_PER_BYTE; } } throw new BugException( "We must have encountered a bug as we cannot determine the word length for a base codec with <" + aBitsPerDigit + "> bits per digit." ); }
/** * Pauses the component by calling {@link #pause(Object)} without you to * require catching an {@link PauseException}. * * @param aHandle The handle identifying the component. * * @throws HiddenException encapsulates the cause and is thrown upon * encountering a {@link PauseException} exception */ default void pauseUnchecked( H aHandle ) { try { pause( aHandle ); } catch ( PauseException e ) { throw new HiddenException( e ); } }
/** * Reloads the (state of the) component by calling {@link #reload(Object)} * without you to require catching a {@link OpenException}. * * @param aHandle The handle identifying the component. * * @throws HiddenException encapsulates the cause and is thrown upon * encountering a {@link OpenException} exception */ default void reloadUnchecked( H aHandle ) { try { reload( aHandle ); } catch ( OpenException e ) { throw new HiddenException( e ); } }
/** * Digests the job by calling {@link #digest(Object)} without you to require * catching a {@link DigestException}. * * @param aJob The job to be digested. * * @throws HiddenException encapsulates the cause and is thrown upon * encountering a {@link DigestException} exception */ default void digestUnchecked( J aJob ) { try { digest( aJob ); } catch ( DigestException e ) { throw new HiddenException( e ); } } }
/** * Starts the component by calling {@link #start(Object)} without you to * require catching an {@link StartException}. * * @param aHandle The handle identifying the component. * * @throws HiddenException encapsulates the cause and is thrown upon * encountering a {@link StartException} exception */ default void startUnchecked( H aHandle ) { try { start( aHandle ); } catch ( StartException e ) { throw new HiddenException( e ); } }
/** * Stops the component by calling {@link #stop(Object)} without you to * require catching an {@link StopException}. * * @param aHandle The handle identifying the component. * * @throws HiddenException encapsulates the cause and is thrown upon * encountering a {@link StopException} exception */ default void stopUnchecked( H aHandle ) { try { stop( aHandle ); } catch ( StopException e ) { throw new HiddenException( e ); } }
/** * Opens the component by calling {@link #open(Object)} without you to * require catching an {@link OpenException}. * * @param aHandle The handle identifying the component. * * @throws HiddenException encapsulates the cause and is thrown upon * encountering a {@link OpenException} exception */ default void openUnchecked( H aHandle ) { try { open( aHandle ); } catch ( OpenException e ) { throw new HiddenException( e ); } }
@Override public void run() { try { close(); } catch ( CloseException e ) { throw new HiddenException( e ); } finally { theTimer.cancel(); } } }, aCloseInMillis );
/** * Opens the component by calling {@link #open(Object)} without you to * require catching an {@link OpenException}. * * @param aConnection The connection used for opening the connection. * * @throws HiddenException encapsulates the cause and is thrown upon * encountering a {@link OpenException} exception */ default void openUnchecked( CON aConnection ) { try { open( aConnection ); } catch ( OpenException e ) { throw new HiddenException( e ); } }
/** * Initialize the component by calling {@link #initialize(Object)} without * you to require catching an {@link InitializeException}. * * @param aHandle The handle identifying the component. * * @throws HiddenException encapsulates the cause and is thrown upon * encountering a {@link InitializeException} exception */ default void initializeUnchecked( H aHandle ) { try { initialize( aHandle ); } catch ( InitializeException e ) { throw new HiddenException( e ); } }
/** * Initializes the component by calling {@link #initialize(Object)} without * you to require catching an {@link ConfigureException}. * * @param aContext The context to be passed to the implementing instance. * * @throws HiddenException encapsulates the cause and is thrown upon * encountering a {@link ConfigureException} exception */ default void initializeUnchecked( CTX aContext ) { try { initialize( aContext ); } catch ( InitializeException e ) { throw new HiddenException( e ); } }
/** * Resumes the component by calling {@link #resume(Object)} without you to * require catching an {@link ResumeException}. * * @param aHandle The handle identifying the component. * * @throws HiddenException encapsulates the cause and is thrown upon * encountering a {@link ResumeException} exception */ default void resumeUnchecked( H aHandle ) { try { resume( aHandle ); } catch ( ResumeException e ) { throw new HiddenException( e ); } }
/** * Initializes the component by calling {@link #initialize(Object, Object)} * without you to require catching an {@link ConfigureException}. * * @param aHandle The handle identifying the component. * * @param aContext The context to be passed to the implementing instance. * * @throws HiddenException encapsulates the cause and is thrown upon * encountering a {@link ConfigureException} exception */ default void initializeUnchecked( H aHandle, CTX aContext ) { try { initialize( aHandle, aContext ); } catch ( ConfigureException e ) { throw new HiddenException( e ); } }