idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
9,300
public static xen_websensevpx_image [ ] get_filtered ( nitro_service service , filtervalue [ ] filter ) throws Exception { xen_websensevpx_image obj = new xen_websensevpx_image ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; xen_websensevpx_image [ ] response = ( xen_websensevpx_image [ ] ) ob...
Use this API to fetch filtered set of xen_websensevpx_image resources . set the filter parameter values in filtervalue object .
115
29
9,301
@ Override public int compare ( final Ordered ordered1 , final Ordered ordered2 ) { return ( ordered1 . getIndex ( ) < ordered2 . getIndex ( ) ? - 1 : ( ordered1 . getIndex ( ) > ordered2 . getIndex ( ) ? 1 : 0 ) ) ; }
Compares two Ordered objects to determine their relative order by index .
65
14
9,302
private static boolean safeSleep ( long milliseconds ) { boolean interrupted = false ; long timeout = ( System . currentTimeMillis ( ) + milliseconds ) ; while ( System . currentTimeMillis ( ) < timeout ) { try { Thread . sleep ( milliseconds ) ; } catch ( InterruptedException cause ) { interrupted = true ; } finally {...
Safely sleeps for the given amount of milliseconds .
125
10
9,303
public void accumulate ( List < ? extends StandardMetricResult > metricValues ) { if ( metricValues == null || metricValues . isEmpty ( ) ) return ; for ( StandardMetricResult v : metricValues ) { if ( lastOffset < v . offset ) values . put ( v . value . intValue ( ) ) ; } lastOffset = ListUtils . last ( metricValues )...
Adds a metric value to the metric value queue .
86
10
9,304
public boolean isExceeded ( ) { lastAggregatedValue = getAggregatedValue ( ) ; lastExceededValue = false ; switch ( operator ) { case lessThan : lastExceededValue = ( lastAggregatedValue < thresholdValue ) ; break ; case greaterThan : lastExceededValue = ( lastAggregatedValue > thresholdValue ) ; break ; } return lastE...
Returns true of this threshold has been exceeded .
93
9
9,305
public String getReason ( ) { if ( lastExceededValue ) { return String . format ( "Metric '%s' has aggregated-value=%d %s %d as threshold" , metric . name ( ) , lastAggregatedValue , operator . symbol , thresholdValue ) ; } else { return String . format ( "Metric %s: aggregated-value=%d" , metric . name ( ) , lastAggre...
Returns summary intended for logging .
102
6
9,306
public static ns_ssl_certkey_policy get ( nitro_service client ) throws Exception { ns_ssl_certkey_policy resource = new ns_ssl_certkey_policy ( ) ; resource . validate ( "get" ) ; return ( ( ns_ssl_certkey_policy [ ] ) resource . get_resources ( client ) ) [ 0 ] ; }
Use this operation to get the polling frequency of the NetScaler SSL certificates .
80
16
9,307
public static < T , E extends Throwable > @ NonNull Consumer < T > rethrowConsumer ( final @ NonNull ThrowingConsumer < T , E > consumer ) { return consumer ; }
Returns the same throwing consumer .
40
6
9,308
public static < T , U , E extends Throwable > @ NonNull BiConsumer < T , U > rethrowBiConsumer ( final @ NonNull ThrowingBiConsumer < T , U , E > consumer ) { return consumer ; }
Returns the same throwing bi - consumer .
49
8
9,309
public static < T , R , E extends Throwable > @ NonNull Function < T , R > rethrowFunction ( final @ NonNull ThrowingFunction < T , R , E > function ) { return function ; }
Returns the same throwing function .
46
6
9,310
public static < T , U , R , E extends Throwable > @ NonNull BiFunction < T , U , R > rethrowBiFunction ( final @ NonNull ThrowingBiFunction < T , U , R , E > function ) { return function ; }
Returns the same throwing bi - function .
55
8
9,311
public static < T , E extends Throwable > @ NonNull Predicate < T > rethrowPredicate ( final @ NonNull ThrowingPredicate < T , E > predicate ) { return predicate ; }
Returns the same throwing predicate .
43
6
9,312
public static < E extends Throwable > @ NonNull Runnable rethrowRunnable ( final @ NonNull ThrowingRunnable < E > runnable ) { return runnable ; }
Runs a throwable and sneakily re - throws any exceptions it encounters .
43
16
9,313
public static < T , E extends Throwable > @ NonNull Supplier < T > rethrowSupplier ( final @ NonNull ThrowingSupplier < T , E > supplier ) { return supplier ; }
Returns the same throwing supplier .
43
6
9,314
public static < E extends Throwable > @ NonNull RuntimeException rethrow ( final @ NonNull Throwable exception ) throws E { throw ( E ) exception ; }
Re - throws an exception sneakily .
34
8
9,315
public static @ NonNull Throwable unwrap ( final @ NonNull Throwable throwable ) { if ( throwable instanceof InvocationTargetException ) { final /* @Nullable */ Throwable cause = throwable . getCause ( ) ; if ( cause != null ) { return cause ; } } return throwable ; }
Unwraps a throwable .
67
7
9,316
public static ns_ns_savedconfig get ( nitro_service client , ns_ns_savedconfig resource ) throws Exception { resource . validate ( "get" ) ; return ( ( ns_ns_savedconfig [ ] ) resource . get_resources ( client ) ) [ 0 ] ; }
Use this operation to get saved configuration from NetScaler Instance .
65
14
9,317
protected void create ( File cache ) throws VictimsException { try { FileUtils . forceMkdir ( cache ) ; } catch ( IOException e ) { throw new VictimsException ( "Could not create an on disk cache" , e ) ; } }
Create the parent caching directory .
53
6
9,318
public void purge ( ) throws VictimsException { try { File cache = new File ( location ) ; if ( cache . exists ( ) ) { FileUtils . deleteDirectory ( cache ) ; } create ( cache ) ; } catch ( IOException e ) { throw new VictimsException ( "Could not purge on disk cache." , e ) ; } }
Purge the cache . The cache directory is removed and re - recreated .
72
16
9,319
protected String hash ( String key ) throws VictimsException { try { MessageDigest mda = MessageDigest . getInstance ( MessageDigestAlgorithms . SHA_256 ) ; return Hex . encodeHexString ( mda . digest ( key . getBytes ( ) ) ) ; } catch ( NoSuchAlgorithmException e ) { throw new VictimsException ( String . format ( "Cou...
The hashing function used by the Cache .
98
8
9,320
public boolean exists ( String key ) { try { key = hash ( key ) ; return FileUtils . getFile ( location , key ) . exists ( ) ; } catch ( VictimsException e ) { return false ; } }
Test if the given key is cached .
47
8
9,321
public void delete ( String key ) throws VictimsException { key = hash ( key ) ; try { FileUtils . forceDelete ( FileUtils . getFile ( location , key ) ) ; } catch ( IOException e ) { throw new VictimsException ( String . format ( "Could not delete the cached entry from disk: %s" , key ) , e ) ; } }
Delete the cache entry for a given key .
79
9
9,322
public void add ( String key , Collection < String > cves ) throws VictimsException { key = hash ( key ) ; if ( exists ( key ) ) { delete ( key ) ; } String result = "" ; if ( cves != null ) { result = StringUtils . join ( cves , "," ) ; } try { FileOutputStream fos = new FileOutputStream ( FileUtils . getFile ( locati...
Add a new cache entry .
158
6
9,323
public HashSet < String > get ( String key ) throws VictimsException { key = hash ( key ) ; try { HashSet < String > cves = new HashSet < String > ( ) ; String result = FileUtils . readFileToString ( FileUtils . getFile ( location , key ) ) . trim ( ) ; for ( String cve : StringUtils . split ( result , "," ) ) { cves ....
Get the CVEs mapped by a key
142
8
9,324
public final static byte [ ] decode ( byte [ ] sArr ) { // Check special case int sLen = sArr . length ; // Count illegal characters (including '\r', '\n') to know what size the returned array will be, // so we don't have to reallocate & copy it later. int sepCnt = 0 ; // Number of separator characters. (Actually illeg...
Decodes a BASE64 encoded byte array . All illegal characters will be ignored and can handle both arrays with and without line separators .
485
27
9,325
@ Override public < E > List < E > sort ( final List < E > elements ) { for ( int index = 0 , size = elements . size ( ) , length = ( size - 1 ) ; index < length ; index ++ ) { int minIndex = index ; for ( int j = ( index + 1 ) ; j < size ; j ++ ) { if ( getOrderBy ( ) . compare ( elements . get ( j ) , elements . get ...
Uses the Selection Sort algorithm to sort a List of elements as defined by the Comparator or as determined by the elements in the collection if the elements are Comparable .
137
34
9,326
public static backup_policy get ( nitro_service client , backup_policy resource ) throws Exception { resource . validate ( "get" ) ; return ( ( backup_policy [ ] ) resource . get_resources ( client ) ) [ 0 ] ; }
Use this operation to get backup policy to view the number of previous backups to retain .
53
17
9,327
public static synchronized void registerFieldsToFilter ( Class < ? > containingClass , String ... fieldNames ) { fieldFilterMap = registerFilter ( fieldFilterMap , containingClass , fieldNames ) ; }
fieldNames must contain only interned Strings
42
9
9,328
public static synchronized void registerMethodsToFilter ( Class < ? > containingClass , String ... methodNames ) { methodFilterMap = registerFilter ( methodFilterMap , containingClass , methodNames ) ; }
methodNames must contain only interned Strings
41
9
9,329
public static Calendar create ( long timeInMilliseconds ) { Calendar dateTime = Calendar . getInstance ( ) ; dateTime . clear ( ) ; dateTime . setTimeInMillis ( timeInMilliseconds ) ; return dateTime ; }
Creates a Calendar instance with a date and time set to the time in milliseconds .
52
17
9,330
public void execute ( ChannelQueryListener listener ) { addChannelQueryListener ( listener ) ; // Make a local copy to avoid synchronization Result localResult = result ; // If the query was executed, just call the listener if ( localResult != null ) { listener . queryExecuted ( localResult ) ; } else { execute ( ) ; }...
Executes the query and calls the listener with the result . If the query was already executed the listener is called immediately with the result .
70
27
9,331
public static current_timezone get ( nitro_service client ) throws Exception { current_timezone resource = new current_timezone ( ) ; resource . validate ( "get" ) ; return ( ( current_timezone [ ] ) resource . get_resources ( client ) ) [ 0 ] ; }
Use this operation to get the current time zone .
64
10
9,332
public static mps_network_config get ( nitro_service client ) throws Exception { mps_network_config resource = new mps_network_config ( ) ; resource . validate ( "get" ) ; return ( ( mps_network_config [ ] ) resource . get_resources ( client ) ) [ 0 ] ; }
Use this operation to get MPS network configuration .
72
10
9,333
@ Override @ SuppressWarnings ( "unchecked" ) public void visit ( final Visitable visitable ) { if ( visitable instanceof Identifiable ) { ( ( Identifiable ) visitable ) . setId ( null ) ; } }
Visits any Visitable object implementing the Identifiable interface clearing the Identifiable objects identifier .
53
18
9,334
@ Override public int compare ( final Orderable < T > orderable1 , final Orderable < T > orderable2 ) { return orderable1 . getOrder ( ) . compareTo ( orderable2 . getOrder ( ) ) ; }
Compares two Orderable objects to determine their relative order by their order property .
52
16
9,335
public static xen_supplemental_pack install ( nitro_service client , xen_supplemental_pack resource ) throws Exception { return ( ( xen_supplemental_pack [ ] ) resource . perform_operation ( client , "install" ) ) [ 0 ] ; }
Use this operation to install new xen supplemental pack .
60
10
9,336
public static jazz_license get ( nitro_service client ) throws Exception { jazz_license resource = new jazz_license ( ) ; resource . validate ( "get" ) ; return ( ( jazz_license [ ] ) resource . get_resources ( client ) ) [ 0 ] ; }
Use this operation to get license information .
60
8
9,337
public static xen_hotfix apply ( nitro_service client , xen_hotfix resource ) throws Exception { return ( ( xen_hotfix [ ] ) resource . perform_operation ( client , "apply" ) ) [ 0 ] ; }
Use this operation to apply new xen hotfixes .
51
10
9,338
public static String toInitialCase ( String s ) { if ( isBlank ( s ) ) return s ; if ( s . length ( ) == 1 ) return s . toUpperCase ( ) ; return s . substring ( 0 , 1 ) . toUpperCase ( ) + s . substring ( 1 ) ; }
Makes the initial letter upper - case .
70
9
9,339
public static String replicate ( String s , int times ) { if ( s == null ) return null ; if ( times <= 0 || s . length ( ) == 0 ) return "" ; StringBuilder b = new StringBuilder ( s . length ( ) * times ) ; for ( int k = 1 ; k <= times ; ++ k ) b . append ( s ) ; return b . toString ( ) ; }
Replicates a string .
85
5
9,340
public static String md5 ( String s ) { try { MessageDigest md5 = MessageDigest . getInstance ( "MD5" ) ; byte [ ] digest = md5 . digest ( s . getBytes ( Charset . forName ( "UTF-8" ) ) ) ; StringBuilder buf = new StringBuilder ( 2 * digest . length ) ; for ( byte oneByte : digest ) { buf . append ( Integer . toHexStri...
Computes a MD5 fingerprint of a text - string and returns as a HEX encoded string .
145
20
9,341
public static String percentageBar ( double percentage ) { final char dot = ' ' ; final char mark = ' ' ; final int slots = 40 ; StringBuilder bar = new StringBuilder ( replicate ( String . valueOf ( dot ) , slots ) ) ; int numSlots = ( int ) ( slots * percentage / 100.0 ) ; for ( int k = 0 ; k < numSlots ; ++ k ) bar ...
Creates a percentage ASCII bar .
120
7
9,342
public static final ChannelInitializer < Channel > httpServer ( final SimpleChannelInboundHandler < HttpRequest > handler ) { Preconditions . checkArgument ( handler . isSharable ( ) ) ; return new ChannelInitializer < Channel > ( ) { @ Override protected void initChannel ( Channel channel ) throws Exception { ChannelP...
Returns a new chanel initializer suited to decode and process HTTP requests .
146
16
9,343
public static final ChannelInitializer < Channel > httpClient ( final SimpleChannelInboundHandler < HttpResponse > handler ) { return new ChannelInitializer < Channel > ( ) { @ Override protected void initChannel ( Channel channel ) throws Exception { ChannelPipeline pipeline = channel . pipeline ( ) ; pipeline . addLa...
Returns a channel initializer suited to decode and process HTTP responses .
129
13
9,344
@ NullSafe public static boolean isBlocked ( Thread thread ) { return ( thread != null && Thread . State . BLOCKED . equals ( thread . getState ( ) ) ) ; }
Determines whether the specified Thread is in a blocked state . A Thread may be currently blocked waiting on a lock or performing some IO operation .
40
29
9,345
@ NullSafe public static boolean isNew ( Thread thread ) { return ( thread != null && Thread . State . NEW . equals ( thread . getState ( ) ) ) ; }
Determines whether the specified Thread is a new Thread . A new Thread is any Thread that has not been started yet .
37
25
9,346
@ NullSafe public static boolean isTimedWaiting ( Thread thread ) { return ( thread != null && Thread . State . TIMED_WAITING . equals ( thread . getState ( ) ) ) ; }
Determines whether the specified Thread is currently in a timed wait .
45
14
9,347
@ NullSafe public static boolean isWaiting ( Thread thread ) { return ( thread != null && Thread . State . WAITING . equals ( thread . getState ( ) ) ) ; }
Determines whether the specified Thread is currently in a wait .
40
13
9,348
@ NullSafe public static ClassLoader getContextClassLoader ( Thread thread ) { return ( thread != null ? thread . getContextClassLoader ( ) : ThreadUtils . class . getClassLoader ( ) ) ; }
A null - safe method for getting the Thread s context ClassLoader .
45
14
9,349
@ NullSafe public static String getName ( Thread thread ) { return ( thread != null ? thread . getName ( ) : null ) ; }
A null - safe method for getting the Thread s name .
30
12
9,350
@ NullSafe public static StackTraceElement [ ] getStackTrace ( Thread thread ) { return ( thread != null ? thread . getStackTrace ( ) : new StackTraceElement [ 0 ] ) ; }
A null - safe method for getting a snapshot of the Thread s current stack trace .
46
17
9,351
@ NullSafe public static Thread . State getState ( Thread thread ) { return ( thread != null ? thread . getState ( ) : null ) ; }
A null - safe method for getting the Thread s current state .
32
13
9,352
@ NullSafe public static ThreadGroup getThreadGroup ( Thread thread ) { return ( thread != null ? thread . getThreadGroup ( ) : null ) ; }
A null - safe method for getting the Thread s ThreadGroup .
33
13
9,353
@ NullSafe public static void interrupt ( Thread thread ) { Optional . ofNullable ( thread ) . ifPresent ( Thread :: interrupt ) ; }
Null - safe operation to interrupt the specified Thread .
30
10
9,354
@ NullSafe public static boolean join ( Thread thread , long milliseconds , int nanoseconds ) { try { if ( thread != null ) { thread . join ( milliseconds , nanoseconds ) ; return true ; } } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; } return false ; }
Causes the current Thread to join with the specified Thread . If the current Thread is interrupted while waiting for the specified Thread then the current Threads interrupt bit will be set and this method will return false . Otherwise the current Thread will wait on the specified Thread until it dies or until the time ...
71
69
9,355
public static boolean sleep ( long milliseconds , int nanoseconds ) { try { Thread . sleep ( milliseconds , nanoseconds ) ; return true ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; return false ; } }
Causes the current Thread to sleep for the specified number of milliseconds and nanoseconds . If the current Thread is interrupted the sleep is aborted however the interrupt bit is reset and this method returns false .
57
41
9,356
protected void runEchoService ( ServerSocket serverSocket ) { if ( isRunning ( serverSocket ) ) { echoService = newExecutorService ( ) ; echoService . submit ( ( ) -> { try { while ( isRunning ( serverSocket ) ) { Socket echoClient = serverSocket . accept ( ) ; getLogger ( ) . info ( ( ) -> String . format ( "EchoClien...
Starts the echo service .
243
6
9,357
protected boolean stopEchoService ( ) { return Optional . ofNullable ( getEchoService ( ) ) . map ( localEchoService -> { localEchoService . shutdown ( ) ; try { if ( ! localEchoService . awaitTermination ( 30 , TimeUnit . SECONDS ) ) { localEchoService . shutdownNow ( ) ; if ( ! localEchoService . awaitTermination ( 3...
Stops the Echo Service taking it offline and out - of - service .
162
15
9,358
public static ns reboot ( nitro_service client , ns resource ) throws Exception { return ( ( ns [ ] ) resource . perform_operation ( client , "reboot" ) ) [ 0 ] ; }
Use this operation to reboot NetScaler Instance .
43
11
9,359
public static ns stop ( nitro_service client , ns resource ) throws Exception { return ( ( ns [ ] ) resource . perform_operation ( client , "stop" ) ) [ 0 ] ; }
Use this operation to stop NetScaler Instance .
42
11
9,360
public static ns force_reboot ( nitro_service client , ns resource ) throws Exception { return ( ( ns [ ] ) resource . perform_operation ( client , "force_reboot" ) ) [ 0 ] ; }
Use this operation to force reboot NetScaler Instance .
48
12
9,361
public static ns force_stop ( nitro_service client , ns resource ) throws Exception { return ( ( ns [ ] ) resource . perform_operation ( client , "force_stop" ) ) [ 0 ] ; }
Use this operation to force stop NetScaler Instance .
46
12
9,362
public static ns start ( nitro_service client , ns resource ) throws Exception { return ( ( ns [ ] ) resource . perform_operation ( client , "start" ) ) [ 0 ] ; }
Use this operation to start NetScaler Instance .
42
11
9,363
public static ns [ ] get_filtered ( nitro_service service , filtervalue [ ] filter ) throws Exception { ns obj = new ns ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; ns [ ] response = ( ns [ ] ) obj . getfiltered ( service , option ) ; return response ; }
Use this API to fetch filtered set of ns resources . set the filter parameter values in filtervalue object .
75
21
9,364
public void put ( ElementType x ) { if ( full ( ) ) { getIdx = ( getIdx + 1 ) % elements . length ; } else { size ++ ; } elements [ putIdx ] = x ; putIdx = ( putIdx + 1 ) % elements . length ; }
Inserts an element and overwrites old one when full .
65
12
9,365
public ElementType get ( ) { if ( empty ( ) ) throw new IllegalArgumentException ( "Empty queue" ) ; ElementType x = ( ElementType ) elements [ getIdx ] ; getIdx = ( getIdx + 1 ) % elements . length ; size -- ; return x ; }
Removes the first element .
64
6
9,366
public Iterator < ElementType > iterator ( ) { return new Iterator < ElementType > ( ) { int idx = getIdx ; int N = size ; public boolean hasNext ( ) { return N > 0 ; } public ElementType next ( ) { ElementType x = ( ElementType ) elements [ idx ] ; idx = ( idx + 1 ) % elements . length ; N -- ; return x ; } public voi...
Returns an iterator intended usage in a foreach loop
112
10
9,367
public List < ElementType > toList ( ) { List < ElementType > result = new ArrayList < ElementType > ( size ( ) ) ; for ( ElementType e : this ) result . ( ) ; return result ; }
Returns a new list with all the elements in order
48
10
9,368
protected < T > T defaultIfNotSet ( String propertyName , T defaultValue , Class < T > type ) { return ( isSet ( propertyName ) ? convert ( propertyName , type ) : defaultValue ) ; }
Defaults of the value for the named property if the property does not exist .
47
16
9,369
public PropertiesAdapter filter ( Filter < String > filter ) { Properties properties = new Properties ( ) ; for ( String propertyName : this ) { if ( filter . accept ( propertyName ) ) { properties . setProperty ( propertyName , get ( propertyName ) ) ; } } return from ( properties ) ; }
Filters the properties from this adapter by name .
64
10
9,370
public static mail_profile get ( nitro_service client , mail_profile resource ) throws Exception { resource . validate ( "get" ) ; return ( ( mail_profile [ ] ) resource . get_resources ( client ) ) [ 0 ] ; }
Use this operation to get mail profile ..
53
8
9,371
@ Override public int compare ( final TimeUnit timeUnitOne , final TimeUnit timeUnitTwo ) { return Integer . valueOf ( String . valueOf ( TIME_UNIT_VALUE . get ( timeUnitOne ) ) ) . compareTo ( TIME_UNIT_VALUE . get ( timeUnitTwo ) ) ; }
Compares 2 TimeUnit values for order .
68
9
9,372
@ NullSafe public static Class [ ] getArgumentTypes ( Object ... arguments ) { Class [ ] argumentTypes = null ; if ( arguments != null ) { argumentTypes = new Class [ arguments . length ] ; for ( int index = 0 ; index < arguments . length ; index ++ ) { argumentTypes [ index ] = getClass ( arguments [ index ] ) ; } } r...
Determines the class types for all the given arguments .
83
12
9,373
public static final long nextPermutation ( long val ) { long tmp = val | ( val - 1 ) ; return ( tmp + 1 ) | ( ( ( - tmp & - ~ tmp ) - 1 ) >> ( Long . numberOfTrailingZeros ( val ) + 1 ) ) ; }
Compute the lexicographically next bit permutation .
63
11
9,374
public static final int [ ] getBitsSet ( final long val ) { long tmp = val ; int [ ] retVal = new int [ Long . bitCount ( val ) ] ; for ( int i = 0 ; i < retVal . length ; i ++ ) { retVal [ i ] = Long . numberOfTrailingZeros ( tmp ) ; tmp = tmp ^ Long . lowestOneBit ( tmp ) ; } return retVal ; }
Returns the number of bits set .
94
7
9,375
@ Override @ SuppressWarnings ( "unchecked" ) public < E > E [ ] sort ( final E ... elements ) { return ( E [ ] ) sort ( new SortableArrayList ( elements ) ) . toArray ( ( E [ ] ) Array . newInstance ( elements . getClass ( ) . getComponentType ( ) , elements . length ) ) ; }
Uses the Merge Sort to sort an array of elements as defined by the Comparator or as determined by the elements in the array if the elements are Comparable .
81
33
9,376
@ Override public < E > List < E > sort ( final List < E > elements ) { if ( elements . size ( ) > 1 ) { int size = elements . size ( ) ; int count = ( ( size / 2 ) + ( size % 2 ) ) ; List < E > leftElements = sort ( elements . subList ( 0 , count ) ) ; List < E > rightElements = sort ( elements . subList ( count , siz...
Uses the Merge Sort algorithm to sort a List of elements as defined by the Comparator or as determined by the elements in the collection if the elements are Comparable .
117
34
9,377
public static Metadata fromPomProperties ( InputStream is ) { Metadata metadata = new Metadata ( ) ; BufferedReader input = new BufferedReader ( new InputStreamReader ( is ) ) ; try { String line ; while ( ( line = input . readLine ( ) ) != null ) { if ( line . startsWith ( "#" ) ) continue ; String [ ] property = line...
Attempts to parse a pom . xml file .
138
10
9,378
public static Metadata fromManifest ( InputStream is ) { try { Manifest mf = new Manifest ( is ) ; return fromManifest ( mf ) ; } catch ( IOException e ) { // Problems? Too bad! } return new Metadata ( ) ; }
Attempts to parse a MANIFEST . MF file from an input stream .
57
15
9,379
public static af_persistant_stat_info [ ] get_filtered ( nitro_service service , filtervalue [ ] filter ) throws Exception { af_persistant_stat_info obj = new af_persistant_stat_info ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; af_persistant_stat_info [ ] response = ( af_persistant_stat_inf...
Use this API to fetch filtered set of af_persistant_stat_info resources . set the filter parameter values in filtervalue object .
110
28
9,380
@ SuppressWarnings ( "unchecked" ) public < T extends VALUE > T withCaching ( KEY key , Supplier < VALUE > cacheableOperation ) { Assert . notNull ( key , "Key is required" ) ; Assert . notNull ( cacheableOperation , "Supplier is required" ) ; ReadWriteLock lock = getLock ( ) ; return ( T ) Optional . ofNullable ( read...
Implementation of the look - aside cache pattern .
143
10
9,381
public static syslog_server [ ] get_filtered ( nitro_service service , filtervalue [ ] filter ) throws Exception { syslog_server obj = new syslog_server ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; syslog_server [ ] response = ( syslog_server [ ] ) obj . getfiltered ( service , option ) ; r...
Use this API to fetch filtered set of syslog_server resources . set the filter parameter values in filtervalue object .
90
24
9,382
public Object string_to_resource ( Class < ? > responseClass , String response ) { try { Gson gson = new Gson ( ) ; return gson . fromJson ( response , responseClass ) ; } catch ( Exception e ) { System . out . println ( e . getMessage ( ) ) ; } return null ; }
Converts Json string to NetScaler SDX resource .
72
13
9,383
public String resource_to_string ( base_resource resrc , options option ) { String result = "{ " ; if ( option != null && option . get_action ( ) != null ) result = result + "\"params\": {\"action\":\"" + option . get_action ( ) + "\"}," ; result = result + "\"" + resrc . get_object_type ( ) + "\":" + this . resource_t...
Converts NetScaler SDX resource to Json string .
108
13
9,384
public String resource_to_string ( base_resource resources [ ] , options option ) { String objecttype = resources [ 0 ] . get_object_type ( ) ; String request = "{" ; if ( option != null && option . get_action ( ) != null ) request = request + "\"params\": {\"action\": \"" + option . get_action ( ) + "\"}," ; request =...
Converts NetScaler SDX resources to Json string .
155
13
9,385
public String resource_to_string ( base_resource resources [ ] , options option , String onerror ) { String objecttype = resources [ 0 ] . get_object_type ( ) ; String request = "{" ; if ( ( option != null && option . get_action ( ) != null ) || ( ! onerror . equals ( "" ) ) ) { request = request + "\"params\":{" ; if ...
Converts MPS resources to Json string .
242
10
9,386
@ NullSafe public static Class < ? > getClass ( Object obj ) { return obj != null ? obj . getClass ( ) : null ; }
Get the Class type of the specified Object . Returns null if the Object reference is null .
31
18
9,387
@ NullSafe public static String getClassSimpleName ( Object obj ) { return obj != null ? obj . getClass ( ) . getSimpleName ( ) : null ; }
Gets the unqualified simple name of the Class type for the specified Object . Returns null if the Object reference is null .
36
25
9,388
@ SuppressWarnings ( { "unchecked" , "all" } ) public static < T > Constructor < T > findConstructor ( Class < T > type , Object ... arguments ) { for ( Constructor < ? > constructor : type . getDeclaredConstructors ( ) ) { Class < ? > [ ] parameterTypes = constructor . getParameterTypes ( ) ; if ( ArrayUtils . nullSaf...
Attempts to find a compatible constructor on the given class type with a signature having parameter types satisfying the specified arguments .
165
22
9,389
public static < T > Constructor < T > getConstructor ( Class < T > type , Class < ? > ... parameterTypes ) { try { return type . getDeclaredConstructor ( parameterTypes ) ; } catch ( NoSuchMethodException cause ) { throw new ConstructorNotFoundException ( cause ) ; } }
Gets the constructor with the specified signature from the given class type .
67
14
9,390
public static < T > Constructor < T > resolveConstructor ( Class < T > type , Class < ? > [ ] parameterTypes , Object ... arguments ) { try { return getConstructor ( type , parameterTypes ) ; } catch ( ConstructorNotFoundException cause ) { Constructor < T > constructor = findConstructor ( type , arguments ) ; Assert ....
Attempts to resolve the constructor from the given class type based on the constructor s exact signature otherwise finds a constructor who s signature parameter types satisfy the array of Object arguments .
158
33
9,391
public static Field getField ( Class < ? > type , String fieldName ) { try { return type . getDeclaredField ( fieldName ) ; } catch ( NoSuchFieldException cause ) { if ( type . getSuperclass ( ) != null ) { return getField ( type . getSuperclass ( ) , fieldName ) ; } throw new FieldNotFoundException ( cause ) ; } }
Gets a Field object representing the named field on the specified class . This method will recursively search up the class hierarchy of the specified class until the Object class is reached . If the named field is found then a Field object representing the class field is returned otherwise a NoSuchFieldException is thr...
83
61
9,392
@ SuppressWarnings ( "all" ) public static Method findMethod ( Class < ? > type , String methodName , Object ... arguments ) { for ( Method method : type . getDeclaredMethods ( ) ) { if ( method . getName ( ) . equals ( methodName ) ) { Class < ? > [ ] parameterTypes = method . getParameterTypes ( ) ; if ( ArrayUtils ....
Attempts to find a method with the specified name on the given class type having a signature with parameter types that are compatible with the given arguments . This method searches recursively up the inherited class hierarchy for the given class type until the desired method is found or the class type hierarchy is exh...
188
64
9,393
public static Method getMethod ( Class < ? > type , String methodName , Class < ? > ... parameterTypes ) { try { return type . getDeclaredMethod ( methodName , parameterTypes ) ; } catch ( NoSuchMethodException cause ) { if ( type . getSuperclass ( ) != null ) { return getMethod ( type . getSuperclass ( ) , methodName ...
Gets a Method object representing the named method on the specified class . This method will recursively search up the class hierarchy of the specified class until the Object class is reached . If the named method is found then a Method object representing the class method is returned otherwise a NoSuchMethodException ...
97
61
9,394
public static Method resolveMethod ( Class < ? > type , String methodName , Class < ? > [ ] parameterTypes , Object [ ] arguments , Class < ? > returnType ) { try { return getMethod ( type , methodName , parameterTypes ) ; } catch ( MethodNotFoundException cause ) { Method method = findMethod ( type , methodName , argu...
Attempts to resolve the method with the specified name and signature on the given class type . The named method s resolution is first attempted by using the specified method s name along with the array of parameter types . If unsuccessful the method proceeds to lookup the named method by searching all declared methods ...
155
98
9,395
protected static String getMethodSignature ( Method method ) { return getMethodSignature ( method . getName ( ) , method . getParameterTypes ( ) , method . getReturnType ( ) ) ; }
Builds the signature of a method based on a java . lang . reflect . Method object .
43
19
9,396
protected static String getMethodSignature ( String methodName , Class < ? > [ ] parameterTypes , Class < ? > returnType ) { StringBuilder buffer = new StringBuilder ( methodName ) ; buffer . append ( "(" ) ; if ( parameterTypes != null ) { int index = 0 ; for ( Class < ? > parameterType : parameterTypes ) { buffer . a...
Builds the signature of a method based on the method s name parameter types and return type .
157
19
9,397
@ NullSafe public static String getName ( Class type ) { return type != null ? type . getName ( ) : null ; }
Gets the fully - qualified name of the Class .
28
11
9,398
@ NullSafe public static String getSimpleName ( Class type ) { return type != null ? type . getSimpleName ( ) : null ; }
Gets the simple name of the Class .
30
9
9,399
@ NullSafe public static boolean instanceOf ( Object obj , Class < ? > type ) { return type != null && type . isInstance ( obj ) ; }
Determines whether the given Object is an instance of the specified Class . Note an Object cannot be an instance of null so this method returns false if the Class type is null or the Object is null .
33
41