You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2003/07/12 10:39:50 UTC
cvs commit: avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info ReferenceDescriptor.java
mcconnell 2003/07/12 01:39:50
Modified: meta/api/src/java/org/apache/avalon/meta/info
ReferenceDescriptor.java
Log:
Updated to support -1 version as default value.
Revision Changes Path
1.5 +25 -18 avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/ReferenceDescriptor.java
Index: ReferenceDescriptor.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/ReferenceDescriptor.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ReferenceDescriptor.java 11 Jul 2003 20:22:53 -0000 1.4
+++ ReferenceDescriptor.java 12 Jul 2003 08:39:50 -0000 1.5
@@ -85,7 +85,7 @@
*/
public ReferenceDescriptor( final String type ) throws NullPointerException
{
- this( parseClassname(type), parseVersion(type));
+ this( parseClassname(type), parseVersion(type) );
}
/**
@@ -115,22 +115,6 @@
}
}
- private static final String parseClassname( final String type )
- {
- return type.substring(0, getColonIndex( type ) );
- }
-
- private static final int getColonIndex( final String type )
- {
- if ( null == type ) throw new NullPointerException( "type" );
- return Math.min( type.length(), Math.max( 0, type.indexOf( ":" ) ) );
- }
-
- private static final Version parseVersion( final String type )
- {
- return Version.getVersion( type.substring( getColonIndex( type ) + 1) );
- }
-
/**
* Return classname of interface this reference refers to.
*
@@ -207,5 +191,28 @@
}
return match;
+ }
+
+ private static final String parseClassname( final String type )
+ {
+ return type.substring(0, getColonIndex( type ) );
+ }
+
+ private static final Version parseVersion( final String type )
+ {
+ if( type.indexOf( ":" ) == -1 )
+ {
+ return Version.getVersion( "" );
+ }
+ else
+ {
+ return Version.getVersion( type.substring( getColonIndex( type ) + 1) );
+ }
+ }
+
+ private static final int getColonIndex( final String type )
+ {
+ if ( null == type ) throw new NullPointerException( "type" );
+ return Math.min( type.length(), Math.max( 0, type.indexOf( ":" ) ) );
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org