litesoft
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 36 37 38 39 40 41 42 43 44 45 46 |
package org.litesoft.language.model; import org.litesoft.commonfoundation.annotations.*; import org.litesoft.commonfoundation.base.*; import org.litesoft.commonfoundation.issues.*; import org.litesoft.commonfoundation.typeutils.*; /** * A Language Key is a series of constrained 7bit Ascii Java Identifier (Alpha followed by zero or more by AlphaNumerics or underscores) separated by single * dots ('.'). */ public class Key { public Key( @SignificantText String pKey ) { Problem zProblem = validate( key = pKey ); if ( zProblem != null ) { throw new IllegalArgumentException( zProblem.toString() ); } } public final @SignificantText String getKey() { return key; } public static @Nullable Problem validate( String pKey ) { if ( Currently.isNullOrEmpty( pKey ) ) { return new Problem( "Empty" ); } String[] zParts = Strings.parseChar( pKey, '.' ); for ( int i = 0; i < zParts.length; i++ ) { String zPart = zParts[i]; if ( !Strings.isConstrainedAsciiIdentifier( zPart ) ) { return new Problem.Builder( "Invalid" ) .add( "Part", i ) .add( "At", pKey.indexOf( zPart ) ) .build(); } } return null; } private /* final */ String key; @Deprecated /** for Serialization */ protected Key() { } } |
Commits for litesoft/trunk/DeviceDesktopTest/src/org/litesoft/language/model/Key.java
Revision | Author | Commited | Message |
---|---|---|---|
961 Diff | GeorgeS | Fri 01 Aug, 2014 03:13:31 +0000 | Externalization Work. |
950 Diff | GeorgeS | Thu 19 Jun, 2014 17:57:04 +0000 | New Lines |
943 Diff | GeorgeS | Tue 03 Jun, 2014 04:25:50 +0000 | Extracting commonfoundation |
937 Diff | markcmarkc | Mon 02 Jun, 2014 00:08:18 +0000 | Added property file loading for master unvalidated accessor |
936 | GeorgeS | Sun 01 Jun, 2014 20:19:38 +0000 | Language Support |