idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
24,900
public String param ( final String name ) { try { return request . getParameter ( name ) ; } catch ( final Exception e ) { LOGGER . log ( Level . ERROR , "Can't parse request parameter [uri=" + request . getRequestURI ( ) + ", method=" + request . getMethod ( ) + ", parameterName=" + name + "]: " + e . getMessage ( ) )...
Gets a parameter specified by the given name from request body form or query string .
24,901
public void sendError ( final int sc ) { try { response . sendError ( sc ) ; } catch ( final Exception e ) { LOGGER . log ( Level . ERROR , "Sends error status code [" + sc + "] failed: " + e . getMessage ( ) ) ; } }
Sends the specified error status code .
24,902
public RequestContext renderJSONPretty ( final JSONObject json ) { final JsonRenderer jsonRenderer = new JsonRenderer ( ) ; jsonRenderer . setJSONObject ( json ) ; jsonRenderer . setPretty ( true ) ; this . renderer = jsonRenderer ; return this ; }
Pretty rends with the specified json object .
24,903
public RequestContext renderJSON ( final JSONObject json ) { final JsonRenderer jsonRenderer = new JsonRenderer ( ) ; jsonRenderer . setJSONObject ( json ) ; this . renderer = jsonRenderer ; return this ; }
Renders with the specified json object .
24,904
public RequestContext renderPretty ( ) { if ( renderer instanceof JsonRenderer ) { final JsonRenderer r = ( JsonRenderer ) renderer ; r . setPretty ( true ) ; } return this ; }
Pretty renders .
24,905
public void handle ( ) { try { for ( handleIndex ++ ; handleIndex < handlers . size ( ) ; handleIndex ++ ) { handlers . get ( handleIndex ) . handle ( this ) ; } } catch ( final Exception e ) { final String requestLog = Requests . getLog ( request ) ; LOGGER . log ( Level . ERROR , "Handler process failed: " + requestL...
Handles this context with handlers .
24,906
private static JSONObject parseRequestJSONObject ( final HttpServletRequest request , final HttpServletResponse response ) { response . setContentType ( "application/json" ) ; try { BufferedReader reader ; try { reader = request . getReader ( ) ; } catch ( final IllegalStateException illegalStateException ) { reader = ...
Gets the request json object with the specified request .
24,907
public static int getPage ( final HttpServletRequest request ) { int ret = 1 ; final String p = request . getParameter ( "p" ) ; if ( Strings . isNumeric ( p ) ) { try { ret = Integer . parseInt ( p ) ; } catch ( final Exception e ) { } } if ( 1 > ret ) { ret = 1 ; } return ret ; }
Gets the current page number from the query string p of the specified request .
24,908
public static List < Integer > paginate ( final int currentPageNum , final int pageSize , final int pageCount , final int windowSize ) { List < Integer > ret ; if ( pageCount < windowSize ) { ret = new ArrayList < > ( pageCount ) ; for ( int i = 0 ; i < pageCount ; i ++ ) { ret . add ( i , i + 1 ) ; } } else { ret = ne...
Paginates with the specified current page number page size page count and window size .
24,909
public List < AbstractPlugin > getPlugins ( ) { if ( pluginCache . isEmpty ( ) ) { LOGGER . info ( "Plugin cache miss, reload" ) ; load ( ) ; } final List < AbstractPlugin > ret = new ArrayList < > ( ) ; for ( final Map . Entry < String , HashSet < AbstractPlugin > > entry : pluginCache . entrySet ( ) ) { ret . addAll ...
Gets all plugins .
24,910
public Set < AbstractPlugin > getPlugins ( final String viewName ) { if ( pluginCache . isEmpty ( ) ) { LOGGER . info ( "Plugin cache miss, reload" ) ; load ( ) ; } final Set < AbstractPlugin > ret = pluginCache . get ( viewName ) ; if ( null == ret ) { return Collections . emptySet ( ) ; } return ret ; }
Gets a plugin by the specified view name .
24,911
private void register ( final AbstractPlugin plugin , final Map < String , HashSet < AbstractPlugin > > holder ) { final String rendererId = plugin . getRendererId ( ) ; final String [ ] redererIds = rendererId . split ( ";" ) ; for ( final String rid : redererIds ) { final HashSet < AbstractPlugin > set = holder . com...
Registers the specified plugin into the specified holder .
24,912
private static void setPluginProps ( final String pluginDirName , final AbstractPlugin plugin , final Properties props ) throws Exception { final String author = props . getProperty ( Plugin . PLUGIN_AUTHOR ) ; final String name = props . getProperty ( Plugin . PLUGIN_NAME ) ; final String version = props . getProperty...
Sets the specified plugin s properties from the specified properties file under the specified plugin directory .
24,913
private void registerEventListeners ( final Properties props , final URLClassLoader classLoader , final AbstractPlugin plugin ) throws Exception { final String eventListenerClasses = props . getProperty ( Plugin . PLUGIN_EVENT_LISTENER_CLASSES ) ; final String [ ] eventListenerClassArray = eventListenerClasses . split ...
Registers event listeners with the specified plugin properties class loader and plugin .
24,914
public Map < String , String > getAll ( final Locale locale ) { Map < String , String > ret = LANGS . get ( locale ) ; if ( null == ret ) { ret = new HashMap < > ( ) ; final ResourceBundle defaultLangBundle = ResourceBundle . getBundle ( Keys . LANGUAGE , Latkes . getLocale ( ) ) ; final Enumeration < String > defaultL...
Gets all language properties as a map by the specified locale .
24,915
public String get ( final String key , final Locale locale ) { return get ( Keys . LANGUAGE , key , locale ) ; }
Gets a value with the specified key and locale .
24,916
private String replaceVars ( final String langValue ) { String ret = StringUtils . replace ( langValue , "${servePath}" , Latkes . getServePath ( ) ) ; ret = StringUtils . replace ( ret , "${staticServePath}" , Latkes . getStaticServePath ( ) ) ; return ret ; }
Replaces all variables of the specified language value .
24,917
public static String unescape ( String string ) { StringBuilder sb = new StringBuilder ( string . length ( ) ) ; for ( int i = 0 , length = string . length ( ) ; i < length ; i ++ ) { char c = string . charAt ( i ) ; if ( c == '&' ) { final int semic = string . indexOf ( ';' , i ) ; if ( semic > i ) { final String enti...
Removes XML escapes from the string .
24,918
public static String format ( final String xml ) { try { final DocumentBuilder db = DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) ; final Document doc = db . parse ( new InputSource ( new StringReader ( xml ) ) ) ; final Transformer transformer = TransformerFactory . newInstance ( ) . newTransformer...
Returns pretty print of the specified xml string .
24,919
private void initTemplateEngineCfg ( ) { configuration = new Configuration ( ) ; configuration . setDefaultEncoding ( "UTF-8" ) ; final ServletContext servletContext = AbstractServletListener . getServletContext ( ) ; configuration . setServletContextForTemplateLoading ( servletContext , "/plugins/" + dirName ) ; LOGGE...
Initializes template engine configuration .
24,920
public String getLang ( final Locale locale , final String key ) { return langs . get ( locale . toString ( ) ) . getProperty ( key ) ; }
Gets language label with the specified locale and key .
24,921
public void plug ( final Map < String , Object > dataModel , final RequestContext context ) { String content = ( String ) dataModel . get ( Plugin . PLUGINS ) ; if ( null == content ) { dataModel . put ( Plugin . PLUGINS , "" ) ; } handleLangs ( dataModel ) ; fillDefault ( dataModel ) ; postPlug ( dataModel , context )...
Plugs with the specified data model and the args from request .
24,922
private void handleLangs ( final Map < String , Object > dataModel ) { final Locale locale = Latkes . getLocale ( ) ; final String language = locale . getLanguage ( ) ; final String country = locale . getCountry ( ) ; final String variant = locale . getVariant ( ) ; final StringBuilder keyBuilder = new StringBuilder ( ...
Processes languages . Retrieves language labels with default locale then sets them into the specified data model .
24,923
private void fillDefault ( final Map < String , Object > dataModel ) { Keys . fillServer ( dataModel ) ; Keys . fillRuntime ( dataModel ) ; }
Fills default values into the specified data model .
24,924
private String getViewContent ( final Map < String , Object > dataModel ) { if ( null == configuration ) { initTemplateEngineCfg ( ) ; } try { final Template template = configuration . getTemplate ( "plugin.ftl" ) ; final StringWriter sw = new StringWriter ( ) ; template . process ( dataModel , sw ) ; return sw . toStr...
Gets view content of a plugin . The content is processed with the specified data model by template engine .
24,925
synchronized void addListener ( final AbstractEventListener < ? > listener ) { if ( null == listener ) { throw new NullPointerException ( ) ; } final String eventType = listener . getEventType ( ) ; if ( null == eventType ) { throw new NullPointerException ( ) ; } List < AbstractEventListener < ? > > listenerList = lis...
Adds the specified listener to the set of listeners for this object provided that it is not the same as some listener already in the set .
24,926
public static < T > T [ ] concatenate ( final T [ ] first , final T [ ] ... rest ) { int totalLength = first . length ; for ( final T [ ] array : rest ) { totalLength += array . length ; } final T [ ] ret = Arrays . copyOf ( first , totalLength ) ; int offset = first . length ; for ( final T [ ] array : rest ) { System...
Concatenates the specified arrays .
24,927
private static Set < URL > getResourcesFromRoot ( final String rootPath ) { final Set < URL > rets = new LinkedHashSet < URL > ( ) ; String path = rootPath ; if ( path . startsWith ( "/" ) ) { path = path . substring ( 1 ) ; } try { final Enumeration < URL > resources = Thread . currentThread ( ) . getContextClassLoade...
the URLS under Root path each of which we should scan from .
24,928
private static boolean isJarURL ( final URL rootDirResource ) { final String protocol = rootDirResource . getProtocol ( ) ; return "jar" . equals ( protocol ) || "zip" . equals ( protocol ) || "wsjar" . equals ( protocol ) || ( "code-source" . equals ( protocol ) && rootDirResource . getPath ( ) . contains ( JAR_URL_SE...
check if the URL of the Rousource is a JAR resource .
24,929
private static Collection < ? extends URL > doFindPathMatchingJarResources ( final URL rootDirResource , final String subPattern ) { final Set < URL > result = new LinkedHashSet < URL > ( ) ; JarFile jarFile = null ; String jarFileUrl ; String rootEntryPath = null ; URLConnection con ; boolean newJarFile = false ; try ...
scan the jar to get the URLS of the Classes .
24,930
private static Collection < ? extends URL > doFindPathMatchingFileResources ( final URL rootDirResource , final String subPattern ) { File rootFile = null ; final Set < URL > rets = new LinkedHashSet < URL > ( ) ; try { rootFile = new File ( rootDirResource . toURI ( ) ) ; } catch ( final URISyntaxException e ) { LOGGE...
scan the system file to get the URLS of the Classes .
24,931
public static RequestContext handle ( final HttpServletRequest request , final HttpServletResponse response ) { try { request . setCharacterEncoding ( "UTF-8" ) ; response . setCharacterEncoding ( "UTF-8" ) ; } catch ( final Exception e ) { LOGGER . log ( Level . ERROR , "Sets request context character encoding failed"...
Handle flow .
24,932
public static void result ( final RequestContext context ) { final HttpServletResponse response = context . getResponse ( ) ; if ( response . isCommitted ( ) ) { return ; } AbstractResponseRenderer renderer = context . getRenderer ( ) ; if ( null == renderer ) { renderer = new Http404Renderer ( ) ; } renderer . render ...
Do HTTP response .
24,933
public static Router delete ( final String uriTemplate , final ContextHandler handler ) { return route ( ) . delete ( uriTemplate , handler ) ; }
HTTP DELETE routing .
24,934
public static Router put ( final String uriTemplate , final ContextHandler handler ) { return route ( ) . put ( uriTemplate , handler ) ; }
HTTP PUT routing .
24,935
public static Router get ( final String uriTemplate , final ContextHandler handler ) { return route ( ) . get ( uriTemplate , handler ) ; }
HTTP GET routing .
24,936
public static Router post ( final String uriTemplate , final ContextHandler handler ) { return route ( ) . post ( uriTemplate , handler ) ; }
HTTP POST routing .
24,937
public static void mapping ( ) { for ( final Router router : routers ) { final ContextHandlerMeta contextHandlerMeta = router . toContextHandlerMeta ( ) ; RouteHandler . addContextHandlerMeta ( contextHandlerMeta ) ; } }
Performs mapping for all routers .
24,938
public void dispose ( ) { try { connection . close ( ) ; } catch ( final Exception e ) { LOGGER . log ( Level . ERROR , "Disposes transaction [" + getId ( ) + "] failed" , e ) ; } finally { isActive = false ; connection = null ; JdbcRepository . TX . set ( null ) ; } }
Disposes this transaction .
24,939
public static boolean isCaller ( final String className , final String methodName ) { final Throwable throwable = new Throwable ( ) ; final StackTraceElement [ ] stackElements = throwable . getStackTrace ( ) ; if ( null == stackElements ) { LOGGER . log ( Level . WARN , "Empty call stack" ) ; return false ; } final boo...
Checks the current method is whether invoked by a caller specified by the given class name and method name .
24,940
public static void printCallstack ( final Level logLevel , final String [ ] carePackages , final String [ ] exceptablePackages ) { if ( null == logLevel ) { LOGGER . log ( Level . WARN , "Requires parameter [logLevel]" ) ; return ; } final Throwable throwable = new Throwable ( ) ; final StackTraceElement [ ] stackEleme...
Prints call stack with the specified logging level .
24,941
public static void start ( final String taskTitle ) { Stopwatch root = STOPWATCH . get ( ) ; if ( null == root ) { root = new Stopwatch ( taskTitle ) ; STOPWATCH . set ( root ) ; return ; } final Stopwatch recent = getRecentRunning ( STOPWATCH . get ( ) ) ; if ( null == recent ) { return ; } recent . addLeaf ( new Stop...
Starts a task timing with the specified task title .
24,942
public static String getTimingStat ( ) { final Stopwatch root = STOPWATCH . get ( ) ; if ( null == root ) { return "No stopwatch" ; } final StringBuilder stringBuilder = new StringBuilder ( ) ; root . appendTimingStat ( 1 , stringBuilder ) ; return stringBuilder . toString ( ) ; }
Gets the current timing statistics .
24,943
public static long getElapsed ( final String taskTitle ) { final long currentTimeMillis = System . currentTimeMillis ( ) ; if ( StringUtils . isBlank ( taskTitle ) ) { return - 1 ; } final Stopwatch root = STOPWATCH . get ( ) ; if ( null == root ) { return - 1 ; } final Stopwatch stopwatch = get ( root , taskTitle ) ; ...
Gets elapsed time from the specified parent stopwatch with the specified task title .
24,944
private static Stopwatch get ( final Stopwatch parent , final String taskTitle ) { if ( taskTitle . equals ( parent . getTaskTitle ( ) ) ) { return parent ; } for ( final Stopwatch leaf : parent . getLeaves ( ) ) { final Stopwatch ret = get ( leaf , taskTitle ) ; if ( null != ret ) { return ret ; } } return null ; }
Gets stopwatch from the specified parent stopwatch with the specified task title .
24,945
private static Stopwatch getRecentRunning ( final Stopwatch parent ) { if ( null == parent ) { return null ; } final List < Stopwatch > leaves = parent . getLeaves ( ) ; if ( leaves . isEmpty ( ) ) { if ( parent . isRunning ( ) ) { return parent ; } else { return null ; } } for ( int i = leaves . size ( ) - 1 ; i > - 1...
Gets the recent running stopwatch with the specified parent stopwatch .
24,946
public static boolean isIPv4 ( final String ip ) { if ( StringUtils . isBlank ( ip ) ) { return false ; } final String regex = "^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" ; final Pattern pattern = P...
Is IPv4 .
24,947
public static List < String > toLines ( final String string ) throws IOException { if ( null == string ) { return null ; } final List < String > ret = new ArrayList < > ( ) ; try ( final BufferedReader bufferedReader = new BufferedReader ( new StringReader ( string ) ) ) { String line = bufferedReader . readLine ( ) ; ...
Converts the specified string into a string list line by line .
24,948
public static boolean isNumeric ( final String string ) { try { Double . parseDouble ( string ) ; } catch ( final Exception e ) { return false ; } return true ; }
Checks whether the specified string is numeric .
24,949
public static boolean isEmail ( final String string ) { if ( StringUtils . isBlank ( string ) ) { return false ; } if ( MAX_EMAIL_LENGTH < string . length ( ) ) { return false ; } final String [ ] parts = string . split ( "@" ) ; if ( 2 != parts . length ) { return false ; } final String local = parts [ 0 ] ; if ( MAX_...
Checks whether the specified string is a valid email address .
24,950
public static String [ ] trimAll ( final String [ ] strings ) { if ( null == strings ) { return null ; } return Arrays . stream ( strings ) . map ( StringUtils :: trim ) . toArray ( size -> new String [ size ] ) ; }
Trims every string in the specified strings array .
24,951
public static boolean containsIgnoreCase ( final String string , final String [ ] strings ) { if ( null == strings ) { return false ; } return Arrays . stream ( strings ) . anyMatch ( str -> StringUtils . equalsIgnoreCase ( string , str ) ) ; }
Determines whether the specified strings contains the specified string ignoring case considerations .
24,952
public static boolean contains ( final String string , final String [ ] strings ) { if ( null == strings ) { return false ; } return Arrays . stream ( strings ) . anyMatch ( str -> StringUtils . equals ( string , str ) ) ; }
Determines whether the specified strings contains the specified string .
24,953
private void initBeforeList ( ) { final List < ProcessAdvice > beforeRequestProcessAdvices = new ArrayList < > ( ) ; final Method invokeHolder = getInvokeHolder ( ) ; final Class < ? > processorClass = invokeHolder . getDeclaringClass ( ) ; if ( null != processorClass && processorClass . isAnnotationPresent ( Before . ...
Initializes before process advices .
24,954
private void initAfterList ( ) { final List < ProcessAdvice > afterRequestProcessAdvices = new ArrayList < > ( ) ; final Method invokeHolder = getInvokeHolder ( ) ; final Class < ? > processorClass = invokeHolder . getDeclaringClass ( ) ; if ( invokeHolder . isAnnotationPresent ( After . class ) ) { final Class < ? ext...
Initializes after process advices .
24,955
public Query select ( final String propertyName , final String ... propertyNames ) { projections . add ( new Projection ( propertyName ) ) ; if ( null != propertyNames && 0 < propertyNames . length ) { for ( int i = 0 ; i < propertyNames . length ; i ++ ) { projections . add ( new Projection ( propertyNames [ i ] ) ) ;...
Set SELECT projections .
24,956
public Query addSort ( final String propertyName , final SortDirection sortDirection ) { sorts . put ( propertyName , sortDirection ) ; return this ; }
Adds sort for the specified property with the specified direction .
24,957
public static String getTimeAgo ( final long time , final Locale locale ) { final BeanManager beanManager = BeanManager . getInstance ( ) ; final LangPropsService langService = beanManager . getReference ( LangPropsService . class ) ; final Map < String , String > langs = langService . getAll ( locale ) ; final long di...
Gets time ago format text .
24,958
public static boolean isSameDay ( final Date date1 , final Date date2 ) { final Calendar cal1 = Calendar . getInstance ( ) ; cal1 . setTime ( date1 ) ; final Calendar cal2 = Calendar . getInstance ( ) ; cal2 . setTime ( date2 ) ; return cal1 . get ( Calendar . ERA ) == cal2 . get ( Calendar . ERA ) && cal1 . get ( Cale...
Determines whether the specified date1 is the same day with the specified date2 .
24,959
public static boolean isSameWeek ( final Date date1 , final Date date2 ) { final Calendar cal1 = Calendar . getInstance ( ) ; cal1 . setFirstDayOfWeek ( Calendar . MONDAY ) ; cal1 . setTime ( date1 ) ; final Calendar cal2 = Calendar . getInstance ( ) ; cal2 . setFirstDayOfWeek ( Calendar . MONDAY ) ; cal2 . setTime ( d...
Determines whether the specified date1 is the same week with the specified date2 .
24,960
public static boolean isSameMonth ( final Date date1 , final Date date2 ) { final Calendar cal1 = Calendar . getInstance ( ) ; cal1 . setTime ( date1 ) ; final Calendar cal2 = Calendar . getInstance ( ) ; cal2 . setTime ( date2 ) ; return cal1 . get ( Calendar . ERA ) == cal2 . get ( Calendar . ERA ) && cal1 . get ( Ca...
Determines whether the specified date1 is the same month with the specified date2 .
24,961
public static long getDayStartTime ( final long time ) { final Calendar start = Calendar . getInstance ( ) ; start . setTimeInMillis ( time ) ; final int year = start . get ( Calendar . YEAR ) ; final int month = start . get ( Calendar . MONTH ) ; final int day = start . get ( Calendar . DATE ) ; start . set ( year , m...
Gets the day start time with the specified time .
24,962
public static long getDayEndTime ( final long time ) { final Calendar end = Calendar . getInstance ( ) ; end . setTimeInMillis ( time ) ; final int year = end . get ( Calendar . YEAR ) ; final int month = end . get ( Calendar . MONTH ) ; final int day = end . get ( Calendar . DATE ) ; end . set ( year , month , day , 2...
Gets the day end time with the specified time .
24,963
public static int getWeekDay ( final long time ) { final Calendar calendar = Calendar . getInstance ( ) ; calendar . setTimeInMillis ( time ) ; int ret = calendar . get ( Calendar . DAY_OF_WEEK ) - 1 ; if ( ret <= 0 ) { ret = 7 ; } return ret ; }
Gets the week day with the specified time .
24,964
public static long getWeekStartTime ( final long time ) { final Calendar start = Calendar . getInstance ( ) ; start . setFirstDayOfWeek ( Calendar . MONDAY ) ; start . setTimeInMillis ( time ) ; start . set ( Calendar . DAY_OF_WEEK , Calendar . MONDAY ) ; start . set ( Calendar . HOUR , 0 ) ; start . set ( Calendar . M...
Gets the week start time with the specified time .
24,965
public static long getWeekEndTime ( final long time ) { final Calendar end = Calendar . getInstance ( ) ; end . setFirstDayOfWeek ( Calendar . MONDAY ) ; end . setTimeInMillis ( time ) ; end . set ( Calendar . DAY_OF_WEEK , Calendar . SUNDAY ) ; end . set ( Calendar . HOUR , 23 ) ; end . set ( Calendar . MINUTE , 59 ) ...
Gets the week end time with the specified time .
24,966
public static long getMonthStartTime ( final long time ) { final Calendar start = Calendar . getInstance ( ) ; start . setTimeInMillis ( time ) ; final int year = start . get ( Calendar . YEAR ) ; final int month = start . get ( Calendar . MONTH ) ; start . set ( year , month , 1 , 0 , 0 , 0 ) ; start . set ( Calendar ...
Gets the month start time with the specified time .
24,967
public static long getMonthEndTime ( final long time ) { final Calendar end = Calendar . getInstance ( ) ; end . setTimeInMillis ( getDayStartTime ( time ) ) ; end . set ( Calendar . DAY_OF_MONTH , end . getActualMaximum ( Calendar . DAY_OF_MONTH ) ) ; end . set ( Calendar . HOUR , 23 ) ; end . set ( Calendar . MINUTE ...
Gets the month end time with the specified time .
24,968
public static < T > Set < T > arrayToSet ( final T [ ] array ) { if ( null == array ) { return Collections . emptySet ( ) ; } final Set < T > ret = new HashSet < T > ( ) ; for ( int i = 0 ; i < array . length ; i ++ ) { final T object = array [ i ] ; ret . add ( object ) ; } return ret ; }
Converts the specified array to a set .
24,969
public static MatchResult doMatch ( final String requestURI , final String httpMethod ) { MatchResult ret ; final int segs = StringUtils . countMatches ( requestURI , "/" ) ; ContextHandlerMeta contextHandlerMeta ; String concreteKey = httpMethod + "." + requestURI ; switch ( segs ) { case 1 : contextHandlerMeta = ONE_...
Routes the request specified by the given request URI and HTTP method .
24,970
private static MatchResult route ( final String requestURI , final String httpMethod , final Map < String , ContextHandlerMeta > pathVarContextHandlerMetasHolder ) { MatchResult ret ; for ( final Map . Entry < String , ContextHandlerMeta > entry : pathVarContextHandlerMetasHolder . entrySet ( ) ) { final String uriTemp...
Routes the specified request URI containing path vars with the specified HTTP method and path var context handler metas holder .
24,971
private String getHttpMethod ( final HttpServletRequest request ) { String ret = ( String ) request . getAttribute ( Keys . HttpRequest . REQUEST_METHOD ) ; if ( StringUtils . isBlank ( ret ) ) { ret = request . getMethod ( ) ; } return ret ; }
Gets the HTTP method .
24,972
private String getRequestURI ( final HttpServletRequest request ) { String ret = ( String ) request . getAttribute ( Keys . HttpRequest . REQUEST_URI ) ; if ( StringUtils . isBlank ( ret ) ) { ret = request . getRequestURI ( ) ; } return ret ; }
Gets the request URI .
24,973
private void generateContextHandlerMeta ( final Set < Bean < ? > > processBeans ) { for ( final Bean < ? > latkeBean : processBeans ) { final Class < ? > clz = latkeBean . getBeanClass ( ) ; final Method [ ] declaredMethods = clz . getDeclaredMethods ( ) ; for ( int i = 0 ; i < declaredMethods . length ; i ++ ) { final...
Scan beans to get the context handler meta .
24,974
public void error ( final String msg ) { if ( proxy . isErrorEnabled ( ) ) { if ( proxy instanceof LocationAwareLogger ) { ( ( LocationAwareLogger ) proxy ) . log ( null , FQCN , LocationAwareLogger . ERROR_INT , msg , null , null ) ; } else { proxy . error ( msg ) ; } } }
Logs the specified message at the ERROR level .
24,975
public void warn ( final String msg ) { if ( proxy . isWarnEnabled ( ) ) { if ( proxy instanceof LocationAwareLogger ) { ( ( LocationAwareLogger ) proxy ) . log ( null , FQCN , LocationAwareLogger . WARN_INT , msg , null , null ) ; } else { proxy . warn ( msg ) ; } } }
Logs the specified message at the WARN level .
24,976
public void info ( final String msg ) { if ( proxy . isInfoEnabled ( ) ) { if ( proxy instanceof LocationAwareLogger ) { ( ( LocationAwareLogger ) proxy ) . log ( null , FQCN , LocationAwareLogger . INFO_INT , msg , null , null ) ; } else { proxy . info ( msg ) ; } } }
Logs the specified message at the INFO level .
24,977
public void debug ( final String msg ) { if ( proxy . isDebugEnabled ( ) ) { if ( proxy instanceof LocationAwareLogger ) { ( ( LocationAwareLogger ) proxy ) . log ( null , FQCN , LocationAwareLogger . DEBUG_INT , msg , null , null ) ; } else { proxy . debug ( msg ) ; } } }
Logs the specified message at the DEBUG level .
24,978
public void trace ( final String msg ) { if ( proxy . isTraceEnabled ( ) ) { if ( proxy instanceof LocationAwareLogger ) { ( ( LocationAwareLogger ) proxy ) . log ( null , FQCN , LocationAwareLogger . TRACE_INT , msg , null , null ) ; } else { proxy . trace ( msg ) ; } } }
Logs the specified message at the TRACE level .
24,979
public void log ( final Level level , final String msg , final Throwable throwable ) { switch ( level ) { case ERROR : if ( proxy . isErrorEnabled ( ) ) { if ( proxy instanceof LocationAwareLogger ) { ( ( LocationAwareLogger ) proxy ) . log ( null , FQCN , LocationAwareLogger . ERROR_INT , msg , null , throwable ) ; } ...
Logs the specified message with the specified logging level and throwable .
24,980
public void log ( final Level level , final String msg , final Object ... args ) { String message = msg ; if ( null != args && 0 < args . length ) { if ( msg . indexOf ( "{0" ) >= 0 || msg . indexOf ( "{1" ) >= 0 || msg . indexOf ( "{2" ) >= 0 || msg . indexOf ( "{3" ) >= 0 ) { message = java . text . MessageFormat . f...
Logs the specified message with the specified logging level and arguments .
24,981
public boolean isLoggable ( final Level level ) { switch ( level ) { case TRACE : return isTraceEnabled ( ) ; case DEBUG : return isDebugEnabled ( ) ; case INFO : return isInfoEnabled ( ) ; case WARN : return isWarnEnabled ( ) ; case ERROR : return isErrorEnabled ( ) ; default : throw new IllegalStateException ( "Loggi...
Checks if a message of the given level would actually be logged by this logger .
24,982
public static < T > Publisher < T > publisher ( Observable < T > observable ) { return observable . toFlowable ( BackpressureStrategy . BUFFER ) ; }
Convert an Observable to a reactive - streams Publisher
24,983
public static < T > ReactiveSeq < T > connectToReactiveSeq ( Observable < T > observable ) { return Spouts . async ( s -> { observable . subscribe ( s :: onNext , e -> { s . onError ( e ) ; s . onComplete ( ) ; } , s :: onComplete ) ; } ) ; }
Convert an Observable to a cyclops - react ReactiveSeq
24,984
public static < T > Observable < T > observable ( Publisher < T > publisher ) { return Flowable . fromPublisher ( publisher ) . toObservable ( ) ; }
Convert a Publisher to an observable
24,985
public static < T > AnyMSeq < observable , T > anyM ( Observable < T > obs ) { return AnyM . ofSeq ( ObservableReactiveSeq . reactiveSeq ( obs ) , observable . INSTANCE ) ; }
Construct an AnyM type from an Observable . This allows the Observable to be manipulated according to a standard interface along with a vast array of other Java Monad implementations
24,986
public static MutableChar fromExternal ( final Supplier < Character > s , final Consumer < Character > c ) { return new MutableChar ( ) { public char getAsChar ( ) { return s . get ( ) ; } public Character get ( ) { return getAsChar ( ) ; } public MutableChar set ( final char value ) { c . accept ( value ) ; return thi...
Construct a MutableChar that gets and sets an external value using the provided Supplier and Consumer
24,987
public static MutableDouble fromExternal ( final DoubleSupplier s , final DoubleConsumer c ) { return new MutableDouble ( ) { public double getAsDouble ( ) { return s . getAsDouble ( ) ; } public Double get ( ) { return getAsDouble ( ) ; } public MutableDouble set ( final double value ) { c . accept ( value ) ; return ...
Construct a MutableDouble that gets and sets an external value using the provided Supplier and Consumer
24,988
public static < T1 , T2 , R > Maybe < R > combine ( Maybe < ? extends T1 > maybe , Maybe < ? extends T2 > app , BiFunction < ? super T1 , ? super T2 , ? extends R > fn ) { return narrow ( Single . fromPublisher ( Future . fromPublisher ( maybe . toFlowable ( ) ) . zip ( Future . fromPublisher ( app . toFlowable ( ) ) ,...
Lazily combine this Maybe with the supplied Maybe via the supplied BiFunction
24,989
public static < T > Maybe < T > fromIterable ( Iterable < T > t ) { return narrow ( Single . fromPublisher ( Future . fromIterable ( t ) ) . toMaybe ( ) ) ; }
Construct a Maybe from Iterable by taking the first value from Iterable
24,990
public < R1 , R2 , R4 > Writer < W , R4 > forEach3 ( Function < ? super T , ? extends Writer < W , R1 > > value2 , BiFunction < ? super T , ? super R1 , ? extends Writer < W , R2 > > value3 , Function3 < ? super T , ? super R1 , ? super R2 , ? extends R4 > yieldingFunction ) { return this . flatMap ( in -> { Writer < W...
Perform a For Comprehension over a Writer accepting 2 generating function . This results in a three level nested internal iteration over the provided Writers .
24,991
public < R1 , R4 > Writer < W , R4 > forEach2 ( Function < ? super T , Writer < W , R1 > > value2 , BiFunction < ? super T , ? super R1 , ? extends R4 > yieldingFunction ) { return this . flatMap ( in -> { Writer < W , R1 > a = value2 . apply ( in ) ; return a . map ( in2 -> { return yieldingFunction . apply ( in , in2...
Perform a For Comprehension over a Writer accepting a generating function . This results in a two level nested internal iteration over the provided Writers .
24,992
public static < R > FluentFunctions . FluentSupplier < R > of ( final Supplier < R > supplier ) { return new FluentSupplier < > ( supplier ) ; }
Construct a FluentSupplier from a Supplier
24,993
public static < T , R > FluentFunctions . FluentFunction < T , R > ofChecked ( final CheckedFunction < T , R > fn ) { return FluentFunctions . of ( ExceptionSoftener . softenFunction ( fn ) ) ; }
Construct a FluentFunction from a CheckedFunction
24,994
public static < T , R > FluentFunctions . FluentFunction < T , R > of ( final Function < T , R > fn ) { return new FluentFunction < > ( fn ) ; }
Construct a FluentFunction from a Function
24,995
public static < T1 , T2 , R > FluentFunctions . FluentBiFunction < T1 , T2 , R > ofChecked ( final CheckedBiFunction < T1 , T2 , R > fn ) { return FluentFunctions . of ( ExceptionSoftener . softenBiFunction ( fn ) ) ; }
Construct a FluentBiFunction from a CheckedBiFunction
24,996
public static < T1 , T2 > FluentFunctions . FluentBiFunction < T1 , T2 , Tuple2 < T1 , T2 > > checkedExpression ( final CheckedBiConsumer < T1 , T2 > action ) { final BiConsumer < T1 , T2 > toUse = ExceptionSoftener . softenBiConsumer ( action ) ; return FluentFunctions . of ( ( t1 , t2 ) -> { toUse . accept ( t1 , t2 ...
Convert a CheckedBiConsumer into a FluentBiConsumer that returns it s input in a tuple
24,997
public boolean isSatisfiedBy ( final Date date ) { final Calendar testDateCal = Calendar . getInstance ( getTimeZone ( ) ) ; testDateCal . setTime ( date ) ; testDateCal . set ( Calendar . MILLISECOND , 0 ) ; final Date originalDate = testDateCal . getTime ( ) ; testDateCal . add ( Calendar . SECOND , - 1 ) ; final Dat...
Indicates whether the given date satisfies the cron expression . Note that milliseconds are ignored so two Dates falling on different milliseconds of the same second will always have the same result here .
24,998
public static < CRE , C2 > Compose < CRE , C2 > compose ( Functor < CRE > f , Functor < C2 > g ) { return new Compose < > ( f , g ) ; }
Compose two functors
24,999
public static < T1 , T2 , T3 , R1 , R2 , R3 , R > Stream < R > forEach4 ( Stream < ? extends T1 > value1 , Function < ? super T1 , ? extends Stream < R1 > > value2 , BiFunction < ? super T1 , ? super R1 , ? extends Stream < R2 > > value3 , Function3 < ? super T1 , ? super R1 , ? super R2 , ? extends Stream < R3 > > val...
Perform a For Comprehension over a Stream accepting 3 generating arrow . This results in a four level nested internal iteration over the provided Publishers .