View Javadoc

1   package org.kuali.common.util.metainf.spring;
2   
3   import org.kuali.common.util.Assert;
4   import org.kuali.common.util.metainf.service.MetaInfUtils;
5   
6   public class MetaInfConfigUtils {
7   
8   	private static final String INCLUDES = "includes";
9   	private static final String EXCLUDES = "includes";
10  
11  	/**
12  	 * <code>group</code> is optional
13  	 * 
14  	 * <pre>
15  	 * metainf.[prefix].[group].[suffix]
16  	 * 
17  	 * metainf.[prefix].[suffix]
18  	 * </pre>
19  	 */
20  	public static String getKey(String prefix, MetaInfGroup group, String suffix) {
21  		Assert.noNullsWithMsg("prefix and suffix are required", prefix, suffix);
22  		StringBuilder sb = new StringBuilder();
23  		sb.append(MetaInfUtils.PROPERTY_PREFIX);
24  		sb.append(".");
25  		sb.append(prefix);
26  		if (group != null) {
27  			sb.append(".");
28  			sb.append(group.name().toLowerCase());
29  		}
30  		sb.append(".");
31  		sb.append(suffix);
32  		return sb.toString();
33  	}
34  
35  	/**
36  	 * <code>metainf.[prefix].includes</code>
37  	 */
38  	public static String getIncludesKey(String prefix) {
39  		return getKey(prefix, null, INCLUDES);
40  	}
41  
42  	/**
43  	 * <code>metainf.[prefix].excludes</code>
44  	 */
45  	public static String getExcludesKey(String prefix) {
46  		return getKey(prefix, null, EXCLUDES);
47  	}
48  
49  	/**
50  	 * <code>metainf.[prefix].[group].includes</code>
51  	 */
52  	public static String getIncludesKey(MetaInfGroup group, String prefix) {
53  		return getKey(prefix, group, INCLUDES);
54  	}
55  
56  	/**
57  	 * <code>metainf.[prefix].[group].excludes</code>
58  	 */
59  	public static String getExcludesKey(MetaInfGroup group, String prefix) {
60  		return getKey(prefix, group, EXCLUDES);
61  	}
62  
63  }