litesoft
@ 950
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
package org.litesoft.GWT.client.pavsupport.internal; import org.litesoft.GWT.client.pavsupport.*; import org.litesoft.commonfoundation.base.*; import com.google.gwt.place.shared.*; /** * Code to support extracting a PlaceId from either a PlaceTokenizer or a Place. * <p/> * If the Place or PlaceTokenizer does NOT implement 'HasPlaceId', then class name magic is used * (the Place classes name must end with 'Place', and the Tokenizer(s) MUST be a static inner class of it's Place). */ public class PlaceIdExtractor { public static String getPlaceId( PlaceTokenizer<? extends Place> pTokenizer ) { return extractPlaceId( pTokenizer ); } public static String getPlaceId( Place pPlace ) { return extractPlaceId( pPlace ); } private static String extractPlaceId( Object pObject ) { if ( pObject instanceof HasPlaceId ) { return ConstrainTo.significantOrNull( ((HasPlaceId) pObject).getPlaceId() ); } if ( pObject == null ) { return null; } String s = "." + pObject.getClass().getName() + "$"; // find the String between the last '.' and the first '$' s = s.substring( 0, s.indexOf( '$' ) ); s = s.substring( s.lastIndexOf( '.' ) ); return !s.endsWith( "Place" ) ? null : ConstrainTo.significantOrNull( s.substring( 0, s.length() - 5 ) ); } } |
Commits for litesoft/trunk/Java/GWT/Client/src/org/litesoft/GWT/client/pavsupport/internal/PlaceIdExtractor.java
Revision | Author | Commited | Message |
---|---|---|---|
950 Diff | GeorgeS | Thu 19 Jun, 2014 17:57:04 +0000 | New Lines |
948 Diff | GeorgeS | Sat 07 Jun, 2014 23:42:39 +0000 | Jusefuls Formatter Updated to New Code Format |
939 Diff | GeorgeS | Mon 02 Jun, 2014 21:30:31 +0000 | Extracting commonfoundation |
801 Diff | GeorgeS | Wed 15 Aug, 2012 03:59:02 +0000 | |
712 | GeorgeS | Sat 09 Jun, 2012 22:46:04 +0000 | Move PAV stuff into LiteSoft |