/** * Gets the number of implementations held by the instance. * * @return the number of implementations held by the instance. */ public final int size() { return this.getImplementations().length; }
/** * Creates a string representing the properties of the instance. * * @return a string representing the properties of the instance. */ private String internalString() { final StringBuffer buf = new StringBuffer( 200 ).append( '{' ); buf.append( this.internalString( this ) ); final Implementation[] impls = this.getImplementations(); for ( int i = impls.length - 1; i >= 0; i-- ) { buf.append( ", [" ).append( i ).append( "]=" ). append( impls[i] ); } buf.append( '}' ); return buf.toString(); }
/** * Gets an implementation for an index. * * @param index the index of the implementation to return. * * @return a reference to the implementation at {@code index}. * * @throws IndexOutOfBoundsException if {@code index} is negativ, * greater than or equal to {@code size()}. */ public final Implementation getImplementation( final int index ) { if ( index < 0 || index >= this.size() ) { throw new ArrayIndexOutOfBoundsException( index ); } return this.getImplementations()[index]; }
/** * Indicates whether some other object is equal to this one by comparing * the values of all properties. * * @param o the reference object with which to compare. * * @return {@code true} if this object is the same as {@code o}; * {@code false} otherwise. */ public boolean equals( final Object o ) { boolean equal = this == o; if ( !equal && o instanceof Implementations ) { final Implementations that = (Implementations) o; final Collection these = Arrays.asList( this.getImplementations() ); final Collection those = Arrays.asList( that.getImplementations() ); equal = this.size() == that.size() && these.containsAll( those ); } return equal; }
/** * Creates and returns a deep copy of this object. * * @return a clone of this instance. */ public Object clone() { try { final Implementations ret = (Implementations) super.clone(); final Implementation[] impls = this.getImplementations(); final Implementation[] cloned = new Implementation[ impls.length ]; for ( int i = impls.length - 1; i >= 0; i-- ) { cloned[i] = (Implementation) impls[i].clone(); } ret.setImplementations( cloned ); return ret; } catch ( final CloneNotSupportedException e ) { throw new AssertionError( e ); } }
Arrays.asList( spec.getImplementations(). getImplementations() ) );
/** * Resolves application messages for a given exception by querying any * available {@code ExceptionMessageResolver} implementation stopping at the * first implementation not returning {@code null}. * * @param exception The exception to resolve application messages for. * * @throws NullPointerException if {@code exception} is {@code null}. */ private Message[] resolveMessages( final Exception exception ) { if ( exception == null ) { throw new NullPointerException( "exception" ); } Message[] messages = null; final Specification spec = ModelFactory.getModel().getModules(). getSpecification( ExceptionMessageResolver.class.getName() ); final Implementation[] resolvers = spec.getImplementations(). getImplementations(); for ( int i = resolvers.length - 1; i >= 0 && messages == null; i-- ) { final ExceptionMessageResolver resolver = (ExceptionMessageResolver) ContainerFactory.getContainer(). getObject( ExceptionMessageResolver.class, resolvers[i].getName() ); messages = resolver.resolve( exception ); } return messages; }
getSpecification( SequenceValidator.class.getName() ); final Implementation[] validators = spec.getImplementations(). getImplementations();
getSpecification( SequenceValidator.class.getName() ); final Implementation[] validators = spec.getImplementations(). getImplementations();
getImplementations().getImplementations();
private void assertSpecificationsAvailable() final Implementation[] impls = this.modules.getImplementations(). getImplementations();