Package de.xima.fc.utils
Class XLanguageUtils
- java.lang.Object
-
- de.xima.fc.utils.XLanguageUtils
-
public class XLanguageUtils extends Object
Utility class for providing default languages- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,String>getAvailableDefaultLanguages(Locale displayLocale)Returns a map of language display names and their IETF BCP 47 language tagstatic booleanisMethodImplementedBy(Class<?> target, Object instance, String methodName, Class<?>... params)Checks whether the given method is implemented by the given target class.static IntegerparseIntOrNull(String value)Parses the value as an integer, if possible, or returns null if it cannot be parsed.static LongparseLongOrNull(String value)Parses the value as a long, if possible, or returns null if it cannot be parsed.
-
-
-
Method Detail
-
getAvailableDefaultLanguages
public static Map<String,String> getAvailableDefaultLanguages(Locale displayLocale)
Returns a map of language display names and their IETF BCP 47 language tag
-
isMethodImplementedBy
public static boolean isMethodImplementedBy(Class<?> target, Object instance, String methodName, Class<?>... params)
Checks whether the given method is implemented by the given target class. Returns false when implemented by a subclass. For example:interface A { default void foo() {} default void bar() {} } class B implements A { public void foo() {} } // false, because foo is implemented by B isMethodImplementedBy(A.class, new B(), "foo") // true, because B inherits the implementation of bar from A isMethodImplementedBy(A.class, new B(), "bar")- Parameters:
target- The target class.instance- The instance to check.methodName- The name of the method.params- The parameter types of the method.- Returns:
truewhen the method is implemented by the target class.
-
parseIntOrNull
public static Integer parseIntOrNull(String value)
Parses the value as an integer, if possible, or returns null if it cannot be parsed.- Parameters:
value- Value to parse.- Returns:
- The integer represented by the string, or
nullwhen the string does not represent a valid integer.
-
-