View Javadoc
1   package it.serendigity.maven.plugin.lifecycle.helper.vo;
2   
3   import java.util.HashMap;
4   import java.util.Map;
5   
6   public class MavenExecutionSummary {
7   
8   	private Map<String, Integer> attributeMaxStringLength;
9   
10  	public MavenExecutionSummary() {
11  		attributeMaxStringLength = new HashMap<>();
12  	}
13  
14  	public void updateSummary( MavenExecutionInfo executionInfo ) {
15  
16  		updateMaxStringLength( executionInfo );
17  	}
18  
19  	protected void updateMaxStringLength( MavenExecutionInfo executionInfo ) {
20  
21  		MavenExecutionAttribute[] values = MavenExecutionAttribute.values();
22  
23  		for ( MavenExecutionAttribute mavenExecutionAttribute : values ) {
24  
25  			String key = mavenExecutionAttribute.getCode();
26  
27  			int newStringLength = executionInfo.getStringLength( mavenExecutionAttribute );
28  			Integer oldMaxStringLength = attributeMaxStringLength.get( key );
29  
30  			if ( oldMaxStringLength == null || oldMaxStringLength.compareTo( newStringLength ) < 0 ) {
31  				attributeMaxStringLength.put( key, newStringLength );
32  			}
33  
34  		}
35  
36  	}
37  
38  	public int getMaxStringLength( MavenExecutionAttribute attribute ) {
39  		
40  
41  		return attributeMaxStringLength.get( attribute.getCode() );
42  	
43  	}
44  }