litesoft
Diff Revisions
950
vs
961
for /trunk/DeviceDesktopTest/src/org/litesoft/language/model/Key.java
|
@@ -6,36 +6,29 @@ |
6 |
6 |
|
import org.litesoft.commonfoundation.typeutils.*; |
7 |
7 |
|
|
8 |
8 |
|
/** |
9 |
|
- |
* 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 ('.'). |
|
9 |
+ |
* 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 |
|
10 |
+ |
* dots ('.'). |
10 |
11 |
|
*/ |
11 |
|
- |
public class Key |
12 |
|
- |
{ |
13 |
|
- |
public Key( @SignificantText String pKey ) |
14 |
|
- |
{ |
|
12 |
+ |
public class Key { |
|
13 |
+ |
public Key( @SignificantText String pKey ) { |
15 |
14 |
|
Problem zProblem = validate( key = pKey ); |
16 |
|
- |
if ( zProblem != null ) |
17 |
|
- |
{ |
|
15 |
+ |
if ( zProblem != null ) { |
18 |
16 |
|
throw new IllegalArgumentException( zProblem.toString() ); |
19 |
17 |
|
} |
20 |
18 |
|
} |
21 |
19 |
|
|
22 |
|
- |
public final @SignificantText String getKey() |
23 |
|
- |
{ |
|
20 |
+ |
public final @SignificantText String getKey() { |
24 |
21 |
|
return key; |
25 |
22 |
|
} |
26 |
23 |
|
|
27 |
|
- |
public static @Nullable Problem validate( String pKey ) |
28 |
|
- |
{ |
29 |
|
- |
if ( Currently.isNullOrEmpty( pKey ) ) |
30 |
|
- |
{ |
|
24 |
+ |
public static @Nullable Problem validate( String pKey ) { |
|
25 |
+ |
if ( Currently.isNullOrEmpty( pKey ) ) { |
31 |
26 |
|
return new Problem( "Empty" ); |
32 |
27 |
|
} |
33 |
28 |
|
String[] zParts = Strings.parseChar( pKey, '.' ); |
34 |
|
- |
for ( int i = 0; i < zParts.length; i++ ) |
35 |
|
- |
{ |
|
29 |
+ |
for ( int i = 0; i < zParts.length; i++ ) { |
36 |
30 |
|
String zPart = zParts[i]; |
37 |
|
- |
if ( !Strings.isConstrainedAsciiIdentifier( zPart ) ) |
38 |
|
- |
{ |
|
31 |
+ |
if ( !Strings.isConstrainedAsciiIdentifier( zPart ) ) { |
39 |
32 |
|
return new Problem.Builder( "Invalid" ) |
40 |
33 |
|
.add( "Part", i ) |
41 |
34 |
|
.add( "At", pKey.indexOf( zPart ) ) |
|
@@ -48,7 +41,6 @@ |
48 |
41 |
|
private /* final */ String key; |
49 |
42 |
|
|
50 |
43 |
|
@Deprecated /** for Serialization */ |
51 |
|
- |
protected Key() |
52 |
|
- |
{ |
|
44 |
+ |
protected Key() { |
53 |
45 |
|
} |
54 |
46 |
|
} |