Most suitable generic font family is a monospace font (like Courier, Lucida Console) , because each character has the same width, which is necessary if you want keep the original formatting of the plain text file.
Source: Bruno Lowagie - iText in Action (2nd edtion)
DOMINIK SYMONOWICZ's blogs - FOREVER HUNGRY of knowledge, sarcasm, smiling, music, dancing, and food ...lots of food. This IT blog is a collection of notes with a simple solution with an explanation, added documentation, sarcastic comment and weird example. I also write about a lesson learnt from my mistakes. A non-it blog can be found here: Dominik Symonowicz's non-IT blog and website
Showing posts with label convert. Show all posts
Showing posts with label convert. Show all posts
24 June 2011
12 April 2011
How to convert enum string to enum in java ?
Solution for java 5 ,java 6 (Enum doesn't exist in java 4 and below)
If you want convert enum string to enum in java you need use valueOf method like:
NameOfEnumType.valueOf(StringToConvert.toUpperCase());
Enum:
public enum Visa {
ALL,
WORK,
SLAVERY
STUDY,
NONE
}
so now, in place, where you need convert where you will use method like
String visatype = "terrorist";
try{
result = BorderAgency.isLegal();
}catch(IllegalArgumentException iae){
sendCitizenToJail(Visa.valueOf(visatype.toUpperCase()));
}
Source: http://download.oracle.com/javase/tutorial/java/javaOO/enum.html
If you want convert enum string to enum in java you need use valueOf method like:
NameOfEnumType.valueOf(StringToConvert.toUpperCase());
- NameOfEnumType - An enum type (like class name )
- StringToConvert - string that will be converted to Enum
- toUpperCase() - is optional but by convention fields names are upper case,so this method will automatically convert to uppercase
Enum:
public enum Visa {
ALL,
WORK,
SLAVERY
STUDY,
NONE
}
so now, in place, where you need convert where you will use method like
String visatype = "terrorist";
try{
result = BorderAgency.isLegal();
}catch(IllegalArgumentException iae){
sendCitizenToJail(Visa.valueOf(visatype.toUpperCase()));
}
Source: http://download.oracle.com/javase/tutorial/java/javaOO/enum.html
Subscribe to:
Posts (Atom)