/** * Returns a hash code value for this object. * * @return a hash code value for this object. */ public final int hashCode() { return this.getIdentifier().hashCode() + ( this.getVersion() == null ? 0 : this.getVersion().hashCode() ); }
/** * Indicates whether some other object is equal to this one by comparing * properties {@code identifier} and {@code version}. * * @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 final boolean equals( final Object o ) { boolean equal = o == this; if ( !equal && o instanceof Specification ) { final Specification that = (Specification) o; equal = this.getIdentifier().equals( that.getIdentifier() ) && ( this.getVersion() == null ? that.getVersion() == null : this.getVersion().equals( that.getVersion() ) ); } return equal; }
private Specification getSpecification( final String identifier, final String version ) { Collection c = (Collection) this.specifications.get( identifier ); if ( c == null ) { c = new LinkedList(); this.specifications.put( identifier, c ); } Specification specification = null; for ( final Iterator it = c.iterator(); it.hasNext(); ) { final Specification s = (Specification) it.next(); if ( s.getVersion() == null ? version == null : s.getVersion().equals( version ) ) { specification = s; break; } } if ( specification == null ) { specification = new Specification(); specification.setIdentifier( identifier ); specification.setVersion( version ); c.add( specification ); } return specification; }
/** * Creates a string representing the properties of the instance. * * @return a string representing the properties of the instance. */ private String internalString() { return new StringBuffer( 500 ).append( '{' ). append( this.internalString( this ) ). append( ", name=" ).append( this.name ). append( ", bound=" ).append( this.bound ). append( ", implementation=" ). append( this.implementation == null ? "null" : this.implementation.getIdentifier() + "@" + this.implementation.getVersion() ). append( ", specification=" ). append( this.specification == null ? "null" : this.specification.getIdentifier() + "@" + this.specification.getVersion() ). append( ", properties=" ).append( this.properties ). append( '}' ).toString(); }
append( s.getVersion() );
if ( implemented.getVersion() != null ) implemented.getVersion(), available.getVersion() ) < 0 ) available.getVersion(), impl.getIdentifier(), implemented.getVersion(), null ); available.getIdentifier(), available.getVersion(), impl.getIdentifier(), implemented.getVersion(), null ); if ( required.getVersion() != null ) available.getVersion(), required.getVersion() ) < 0 ) available.getVersion(), impl.getIdentifier(), null, required.getVersion() ); available.getIdentifier(), available.getVersion(), impl.getIdentifier(), null, required.getVersion() );