View Javadoc
1   package org.kuali.common.devops.logic.function;
2   
3   import static org.kuali.common.util.base.Precondition.checkNotBlank;
4   
5   import com.google.common.base.Function;
6   import com.google.common.base.Joiner;
7   import com.google.common.base.Splitter;
8   import com.google.common.collect.Lists;
9   
10  public final class ReverseDnsNameFunction implements Function<String, String> {
11  
12  	private static final Splitter SPLITTER = Splitter.on('.');
13  	private static final Joiner JOINER = Joiner.on('.');
14  
15  	/**
16  	 * <pre>
17  	 *  env1.rice.kuali.org -> org.kuali.rice.env1
18  	 * </pre>
19  	 */
20  	@Override
21  	public String apply(String dnsName) {
22  		checkNotBlank(dnsName, "dnsName");
23  		return JOINER.join(Lists.reverse(SPLITTER.splitToList(dnsName)));
24  	}
25  
26  }