/** * Returns a hash code value for this object. * * @return a hash code value for this object. */ public final int hashCode() { return this.getName().hashCode() + ( this.getVersion() == null ? 0 : this.getVersion().hashCode() ); }
/** * Gets the {@code Module} holding platform specifications. * * @return the {@code Module} holding platform specifications. */ protected Module getPlatformModule() { if ( this.platformModule == null ) { final String description = DefaultModelBundle.getInstance(). getPlatformModuleDescriptionMessage( Locale.getDefault() ); this.platformModule = new Module(); this.platformModule.getDocumentation().setValue( description ); this.platformModule.setName( PLATFORM_MODULE_NAME ); this.platformModule.setVersion( PLATFORM_MODULE_VERSION ); if ( LOGGER.isLoggable( Level.CONFIG ) ) { LOGGER.log( Level.CONFIG, DefaultModelBundle.getInstance(). getAddedPlatformModuleMessage( Locale.getDefault(), this.platformModule.getDocumentation().getValue() ) ); } } return this.platformModule; }
/** * 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( 500 ).append( '{' ). append( this.internalString( this ) ). append( ", name=" ).append( this.name ). append( ", version=" ).append( this.version ). append( ", properties=" ).append( this.properties ). append( ", messages=" ).append( this.messages ). append( ", specifications=" ).append( this.getSpecifications() ). append( ", implementations=" ).append( this.getImplementations() ); buf.append( '}' ).toString(); return buf.toString(); }
Module module = new Module(); module.setModelVersion( modelVersion ); module.setName( e.getAttributeNS( namespace, "name" ) ); module.setVersion( e.getAttributeNS( namespace, "version" ) ); if ( e.hasAttributeNS( namespace, "description" ) ) module.setDescription( txt ); module.setSpecifications( this.transformSpecifications( modelVersion, namespace, (Element) l.item( i ) ) ); module.setProperties( this.transformProperties( modelVersion, namespace, (Element) l.item( i ) ) ); module.setMessages( this.transformMessages( modelVersion, namespace, module, module.setImplementations( this.transformImplementations( modelVersion, namespace, module, if ( this.moduleMap.containsKey( module.getName() ) && Beans.isDesignTime() ) getIgnoredModuleMessage( Locale.getDefault(), documentResource.toExternalForm(),
this.hashCode += value[i].hashCode(); if ( this.names.put( value[i].getName(), value[i] ) != null ) this.hashCode = 0; throw new DuplicateModuleException( value[i].getName() ); specs = value[i].getSpecifications(); for ( int j = specs.size() - 1; j >= 0; j-- ) impls = value[i].getImplementations(); for ( int j = impls.size() - 1; j >= 0; j-- )
platformSpec.setDocumentation( this.getPlatformModule(). getDocumentation() ); this.getPlatformModule().getName() ); getSpecifications().getSpecifications(); setSpecifications( specs );
if ( PLATFORM_MODULE_NAME.equals( module.getName() ) ) providedPlatformModule.getSpecifications() != null ) for ( int i = providedPlatformModule.getSpecifications().size() - 1; i >= 0; i-- ) providedPlatformModule.getSpecifications(). getSpecification( i ).getIdentifier(), true );
this.transformMessage( modelVersion, module.getName(), namespace, (Element) l.item( i ) ) ); namespace, "name" ); messages.add( module.getMessages().getMessage( name ) );
/** * Setter for property {@code description}. * * @param value the new description of the module. * @deprecated Replaced by {@link #setDocumentation(org.jdtaus.core.container.Text) getDocumentation().setValue( value )}. */ public void setDescription( final String value ) { this.getDocumentation().setValue( value ); }
final Implementation impl = this.getImplementation( identifier ); impl.setModelVersion( modelVersion ); impl.setModuleName( module.getName() ); impl.setName( xml.getAttributeNS( namespace, "name" ) ); impl.setVendor( xml.getAttributeNS( namespace, "vendor" ) );
getImplementations().getImplementations(); impls.setImplementations( tmp ); this.getPlatformModule().setImplementations( impls );
/** * Gets a collection of all implementations of all modules held by the * instance. * * @return a reference to all implementations of all modules held by the * instance. */ public Implementations getImplementations() { if ( this.implementations == null ) { this.implementations = new Implementations(); } final Collection col = new ArrayList( this.implementations.size() ); for ( int i = this.size() - 1; i >= 0; i-- ) { final Module mod = this.getModule( i ); for ( int j = mod.getImplementations().size() - 1; j >= 0; j-- ) { col.add( mod.getImplementations().getImplementation( j ) ); } } this.implementations.setImplementations( (Implementation[]) col.toArray( new Implementation[ col.size() ] ) ); return this.implementations; }
/** * Gets a collection of all specifications of all modules. * * @return a reference to all specifications of all modules held by the * instance. */ public Specifications getSpecifications() { if ( this.specifications == null ) { this.specifications = new Specifications(); } final Collection col = new ArrayList( this.specifications.size() ); for ( int i = this.size() - 1; i >= 0; i-- ) { final Module mod = this.getModule( i ); for ( int j = mod.getSpecifications().size() - 1; j >= 0; j-- ) { col.add( mod.getSpecifications().getSpecification( j ) ); } } this.specifications.setSpecifications( (Specification[]) col.toArray( new Specification[ col.size() ] ) ); return this.specifications; }
/** * Creates and returns a deep copy of this object. * * @return a clone of this instance. */ public Object clone() { try { final Modules ret = (Modules) super.clone(); final Module[] mods = this.getModules(); final Module[] cloned = new Module[ mods.length ]; for ( int i = mods.length - 1; i >= 0; i-- ) { cloned[i] = (Module) mods[i].clone(); } ret.setModules( cloned ); return ret; } catch ( final CloneNotSupportedException e ) { throw new AssertionError( e ); } }
private void updateSpecificationReferences() { for ( int m = this.modules.size() - 1; m >= 0; m-- ) { final Module module = this.modules.getModule( m ); for ( int s = module.getSpecifications().size() - 1; s >= 0; s-- ) { final Specification spec = module.getSpecifications(). getSpecification( s ); final Collection references = (Collection) this.specifications.get( spec.getIdentifier() ); assert references != null : "Expected specification meta-data."; for ( final Iterator it = references.iterator(); it.hasNext(); ) { final Specification reference = (Specification) it.next(); reference.setModuleName( module.getName() ); if ( !reference.equals( spec ) ) { reference.setDocumentation( spec.getDocumentation() ); reference.setMultiplicity( spec.getMultiplicity() ); reference.setProperties( spec.getProperties() ); reference.setScope( spec.getScope() ); reference.setStateless( spec.isStateless() ); reference.setVendor( spec.getVendor() ); reference.setModelVersion( spec.getModelVersion() ); } } } } }
/** * Gets the description of the module. * * @return the description of the module or {@code null}. * @deprecated Replaced by {@link #getDocumentation() getDocumentation().getValue()}. */ public String getDescription() { return this.getDocumentation().getValue(); }
for ( int j = mod.getImplementations().size() - 1; j >= 0; j-- ) mod.getImplementations().getImplementation( j );
for ( int j = mod.getSpecifications().size() - 1; j >= 0; j-- ) mod.getSpecifications().getSpecification( j );
/** * Indicates whether some other object is equal to this one by comparing * properties {@code name} 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 = this == o; if ( !equal && o instanceof Module ) { final Module that = (Module) o; equal = this.getName().equals( that.getName() ) && ( this.getVersion() == null ? that.getVersion() == null : this.getVersion().equals( that.getVersion() ) ); } return equal; }
/** * Takes care of initializing fields when constructed from an 1.0.x object * stream. * * @throws ObjectStreamException if no scope can be resolved. */ private Object readResolve() throws ObjectStreamException { if ( this.getDocumentation().getValue() == null && this.description != null ) { this.getDocumentation().setValue( this.description ); } if ( "".equals( this.version ) ) { this.version = null; } return this; }