[refactor] Makes enums more readable.

This commit is contained in:
ruslanpa
2015-02-06 12:48:28 +02:00
parent 6e49fc01ab
commit 6f59f25154
2 changed files with 19 additions and 37 deletions

View File

@ -1,32 +1,22 @@
package com.iluwatar;
/**
*
*
* Enumeration for target size.
*
*/
public enum Size {
SMALL, NORMAL, LARGE;
SMALL("small"), NORMAL("normal"), LARGE("large"), UNDEFINED("");
private String title;
@Override
Size(String title) {
this.title = title;
}
@Override
public String toString() {
String s = "";
switch (this) {
case LARGE:
s = "large";
break;
case NORMAL:
s = "normal";
break;
case SMALL:
s = "small";
break;
default:
break;
}
return s;
return title;
}
}

View File

@ -7,24 +7,16 @@ package com.iluwatar;
*/
public enum Visibility {
VISIBLE, INVISIBLE;
VISIBLE("visible"), INVISIBLE("invisible"), UNDEFINED("");
@Override
private String title;
Visibility(String title) {
this.title = title;
}
@Override
public String toString() {
String s = "";
switch (this) {
case INVISIBLE:
s = "invisible";
break;
case VISIBLE:
s = "visible";
break;
default:
break;
}
return s;
return title;
}
}