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 classLangHelper.ListBuilderstatic classLangHelper.MapEntrystatic classLangHelper.ObjectBuilder
-
Constructor Summary
Constructors Constructor Description LangHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Objectarrays(Object[] arrays, int i, Object defaultValue)save access to array.static booleanasFirst(List list, Object item)put item as first of a liststatic <T> voidclearWeekReferenceCollection(Collection<WeakReference<T>> col)static <K,T>
voidclearWeekReferenceMap(Map<K,WeakReference<T>> map)static Map<?,?>collectionToMap(Collection<?> col)static IntegercompareNull(Object obj1, Object obj2)compare two objects with one of them null.static <E> List<E>createList(E... items)static LangHelper.MapEntryentry(String key, Object value)static <E> List<E>getModifiableList(List<E> list)static booleanisTrue(Object obj)static LangHelper.ListBuilderlist()static voidmain(String[] args)static Map<String,Object>obj(LangHelper.MapEntry... props)static LangHelper.ObjectBuilderobject()static Map<String,String>objStr(LangHelper.MapEntry... props)static voidputAllIfNotExist(Map map1, Map map2)static ObjectsmartInstance(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Class c)return the instance of a class.static intunsigned(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)
-
-