aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base/archiva-model
diff options
context:
space:
mode:
Diffstat (limited to 'archiva-modules/archiva-base/archiva-model')
-rw-r--r--archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java80
1 files changed, 32 insertions, 48 deletions
diff --git a/archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java b/archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java
index 8eba80c1f..b77840150 100644
--- a/archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java
+++ b/archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java
@@ -179,6 +179,7 @@ public class ArchivaModelCloner
return cloned;
}
+ @SuppressWarnings("unchecked")
public static Properties clone( Properties properties )
{
if ( properties == null )
@@ -188,7 +189,7 @@ public class ArchivaModelCloner
Properties cloned = new Properties();
- Enumeration keys = properties.propertyNames();
+ Enumeration<String> keys = (Enumeration<String>) properties.propertyNames();
while ( keys.hasMoreElements() )
{
String key = (String) keys.nextElement();
@@ -246,39 +247,34 @@ public class ArchivaModelCloner
return cloned;
}
- public static List cloneArtifactReferences( List artifactReferenceList )
+ public static List<ArtifactReference> cloneArtifactReferences( List<ArtifactReference> artifactReferenceList )
{
if ( artifactReferenceList == null )
{
return null;
}
- List ret = new ArrayList();
+ List<ArtifactReference> ret = new ArrayList<ArtifactReference>();
- Iterator it = artifactReferenceList.iterator();
- while ( it.hasNext() )
+ for ( ArtifactReference ref : artifactReferenceList )
{
- ArtifactReference artifactReference = (ArtifactReference) it.next();
- ret.add( clone( artifactReference ) );
+ ret.add( clone( ref ) );
}
return ret;
}
- public static List cloneDependencies( List dependencies )
+ public static List<Dependency> cloneDependencies( List<Dependency> dependencies )
{
if ( dependencies == null )
{
return null;
}
- List ret = new ArrayList();
+ List<Dependency> ret = new ArrayList<Dependency>();
- Iterator it = dependencies.iterator();
- while ( it.hasNext() )
+ for ( Dependency dep : dependencies )
{
- Dependency dep = (Dependency) it.next();
-
if ( dep == null )
{
// Skip null dependency.
@@ -291,19 +287,17 @@ public class ArchivaModelCloner
return ret;
}
- public static List cloneExclusions( List exclusions )
+ public static List<Exclusion> cloneExclusions( List<Exclusion> exclusions )
{
if ( exclusions == null )
{
return null;
}
- List ret = new ArrayList();
+ List<Exclusion> ret = new ArrayList<Exclusion>();
- Iterator it = exclusions.iterator();
- while ( it.hasNext() )
+ for ( Exclusion exclusion : exclusions )
{
- Exclusion exclusion = (Exclusion) it.next();
Exclusion cloned = new Exclusion();
cloned.setGroupId( exclusion.getGroupId() );
@@ -315,19 +309,19 @@ public class ArchivaModelCloner
return ret;
}
- public static List cloneIndividuals( List individuals )
+ public static List<Individual> cloneIndividuals( List<Individual> individuals )
{
if ( individuals == null )
{
return individuals;
}
- List ret = new ArrayList();
+ List<Individual> ret = new ArrayList<Individual>();
- Iterator it = individuals.iterator();
+ Iterator<Individual> it = individuals.iterator();
while ( it.hasNext() )
{
- Individual individual = (Individual) it.next();
+ Individual individual = it.next();
Individual cloned = new Individual();
cloned.setPrincipal( individual.getPrincipal() );
@@ -348,19 +342,17 @@ public class ArchivaModelCloner
return ret;
}
- public static List cloneLicenses( List licenses )
+ public static List<License> cloneLicenses( List<License> licenses )
{
if ( licenses == null )
{
return null;
}
- List ret = new ArrayList();
+ List<License> ret = new ArrayList<License>();
- Iterator it = licenses.iterator();
- while ( it.hasNext() )
+ for ( License license : licenses )
{
- License license = (License) it.next();
License cloned = new License();
cloned.setId( license.getId() );
@@ -374,20 +366,17 @@ public class ArchivaModelCloner
return ret;
}
- public static List cloneMailingLists( List mailingLists )
+ public static List<MailingList> cloneMailingLists( List<MailingList> mailingLists )
{
if ( mailingLists == null )
{
return null;
}
- List ret = new ArrayList();
+ List<MailingList> ret = new ArrayList<MailingList>();
- Iterator it = mailingLists.iterator();
- while ( it.hasNext() )
+ for ( MailingList mailingList : mailingLists )
{
- MailingList mailingList = (MailingList) it.next();
-
if ( mailingList == null )
{
// Skip null mailing list.
@@ -400,29 +389,27 @@ public class ArchivaModelCloner
return ret;
}
- public static List clonePlugins( List plugins )
+ public static List<ArtifactReference> clonePlugins( List<ArtifactReference> plugins )
{
return cloneArtifactReferences( plugins );
}
- public static List cloneReports( List reports )
+ public static List<ArtifactReference> cloneReports( List<ArtifactReference> reports )
{
return cloneArtifactReferences( reports );
}
- public static List cloneRepositories( List repositories )
+ public static List<ProjectRepository> cloneRepositories( List<ProjectRepository> repositories )
{
if ( repositories == null )
{
return null;
}
- List ret = new ArrayList();
+ List<ProjectRepository> ret = new ArrayList<ProjectRepository>();
- Iterator it = repositories.iterator();
- while ( it.hasNext() )
+ for ( ProjectRepository repository : repositories )
{
- ProjectRepository repository = (ProjectRepository) it.next();
ProjectRepository cloned = new ProjectRepository();
cloned.setId( repository.getId() );
@@ -439,32 +426,29 @@ public class ArchivaModelCloner
return ret;
}
- public static List cloneRoles( List roles )
+ public static List<String> cloneRoles( List<String> roles )
{
return cloneSimpleStringList( roles );
}
- private static List cloneSimpleStringList( List simple )
+ private static List<String> cloneSimpleStringList( List<String> simple )
{
if ( simple == null )
{
return null;
}
- List ret = new ArrayList();
+ List<String> ret = new ArrayList<String>();
- Iterator it = simple.iterator();
-
- while ( it.hasNext() )
+ for ( String txt : simple )
{
- String txt = (String) it.next();
ret.add( txt );
}
return ret;
}
- public static List cloneAvailableVersions( List availableVersions )
+ public static List<String> cloneAvailableVersions( List<String> availableVersions )
{
return cloneSimpleStringList( availableVersions );
}