Package org.javlo.helper
Class LangHelper
- java.lang.Object
-
- org.javlo.helper.LangHelper
-
public class LangHelper extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LangHelper.ListBuilder
static class
LangHelper.MapEntry
static class
LangHelper.ObjectBuilder
-
Constructor Summary
Constructors Constructor Description LangHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Object
arrays(Object[] arrays, int i, Object defaultValue)
save access to array.static boolean
asFirst(List list, Object item)
put item as first of a liststatic <T> void
clearWeekReferenceCollection(Collection<WeakReference<T>> col)
static <K,T>
voidclearWeekReferenceMap(Map<K,WeakReference<T>> map)
static Map<?,?>
collectionToMap(Collection<?> col)
static Integer
compareNull(Object obj1, Object obj2)
compare two objects with one of them null.static <E> List<E>
createList(E... items)
static LangHelper.MapEntry
entry(String key, Object value)
static <E> List<E>
getModifiableList(List<E> list)
static boolean
isTrue(Object obj)
static LangHelper.ListBuilder
list()
static void
main(String[] args)
static Map<String,Object>
obj(LangHelper.MapEntry... props)
static LangHelper.ObjectBuilder
object()
static Map<String,String>
objStr(LangHelper.MapEntry... props)
static void
putAllIfNotExist(Map map1, Map map2)
static Object
smartInstance(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Class c)
return the instance of a class.static int
unsigned(byte b)
-
-
-
Method Detail
-
smartInstance
public static Object smartInstance(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Class c) throws Exception
return the instance of a class.- Returns:
- list of class returned :
- HttpServletRequest
- HttpServletResponse
- HttpSession
- ServletContext
- StaticConfig
- ContentContext
- GlobalContext
- I18nAccess
- RequestService
- EditContext
- ContentService
- ComponentContext
- MenuElement : return the current page.
- UserFactory
- AdminUserFactory
- AdminUserSecurity
- PageConfiguration
- ModuleContext
- Module : current module.
- MessageRepository
- FileCache
- StaticContext
- UserInterfaceContext
- ClipBoard
- PersistenceService
- User
- AbstractModuleContext : return the current module context
- ? extends AbstractModuleContext : instanciate a abstract module >
- String : the query parameter (when user make a search)
- NotificationService
- SharedContentService
- Throws:
Exception
-
entry
public static LangHelper.MapEntry entry(String key, Object value)
-
obj
public static Map<String,Object> obj(LangHelper.MapEntry... props)
-
objStr
public static Map<String,String> objStr(LangHelper.MapEntry... props)
-
object
public static LangHelper.ObjectBuilder object()
-
list
public static LangHelper.ListBuilder list()
-
unsigned
public static final int unsigned(byte b)
-
arrays
public static Object arrays(Object[] arrays, int i, Object defaultValue)
save access to array.- Parameters:
arrays
-i
- index.defaultValue
-- Returns:
- default value if array is smaller than index.
-
collectionToMap
public static Map<?,?> collectionToMap(Collection<?> col)
-
asFirst
public static boolean asFirst(List list, Object item)
put item as first of a list- Parameters:
list
-item
-- Returns:
- false if item not found in list.
-
main
public static void main(String[] args)
-
clearWeekReferenceCollection
public static <T> void clearWeekReferenceCollection(Collection<WeakReference<T>> col)
-
clearWeekReferenceMap
public static <K,T> void clearWeekReferenceMap(Map<K,WeakReference<T>> map)
-
createList
public static <E> List<E> createList(E... items)
-
compareNull
public static Integer compareNull(Object obj1, Object obj2)
compare two objects with one of them null.- Parameters:
obj1
-obj2
-- Returns:
- null if two objects != null
-
isTrue
public static boolean isTrue(Object obj)
-
-