idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
9,600 | public < E > Iterable < E > searchForAll ( final Collection < E > collection ) { Assert . notNull ( collection , "The collection to search cannot be null!" ) ; final List < E > results = new ArrayList < > ( collection . size ( ) ) ; for ( E element : collection ) { if ( getMatcher ( ) . isMatch ( element ) ) { results ... | Searches a collection of elements finding all elements in the collection matching the criteria defined by the Matcher . |
9,601 | public < E > Iterable < E > searchForAll ( final Searchable < E > searchable ) { try { return searchForAll ( configureMatcher ( searchable ) . asList ( ) ) ; } finally { MatcherHolder . unset ( ) ; } } | Searches the Searchable object finding all elements in the Searchable object matching the criteria defined by the Matcher . |
9,602 | protected < T > Searchable < T > configureMatcher ( final Searchable < T > searchable ) { if ( isCustomMatcherAllowed ( ) ) { Matcher < T > matcher = searchable . getMatcher ( ) ; if ( matcher != null ) { MatcherHolder . set ( matcher ) ; } } return searchable ; } | Configures the desired Matcher used to match and find elements from the Searchable implementing object based on the annotation meta - data applying only to the calling Thread and only if a custom Matcher is allowed . The Matcher is local to calling Thread during the search operation and does not change the Matcher set ... |
9,603 | public static File assertExists ( File path ) throws FileNotFoundException { if ( isExisting ( path ) ) { return path ; } throw new FileNotFoundException ( String . format ( "[%1$s] was not found" , path ) ) ; } | Asserts that the given file exists . |
9,604 | public static String getExtension ( File file ) { Assert . notNull ( file , "File cannot be null" ) ; String filename = file . getName ( ) ; int dotIndex = filename . indexOf ( StringUtils . DOT_SEPARATOR ) ; return ( dotIndex != - 1 ? filename . substring ( dotIndex + 1 ) : StringUtils . EMPTY_STRING ) ; } | Returns the extension of the given file . |
9,605 | public static String getLocation ( File file ) { Assert . notNull ( file , "File cannot be null" ) ; File parent = file . getParentFile ( ) ; Assert . notNull ( parent , new IllegalArgumentException ( String . format ( "Unable to determine the location of file [%1$s]" , file ) ) ) ; return tryGetCanonicalPathElseGetAbs... | Returns the absolute path of the given file . |
9,606 | public static File tryGetCanonicalFileElseGetAbsoluteFile ( File file ) { try { return file . getCanonicalFile ( ) ; } catch ( IOException ignore ) { return file . getAbsoluteFile ( ) ; } } | Attempts to the get the canonical form of the given file otherwise returns the absolute form of the file . |
9,607 | public static String tryGetCanonicalPathElseGetAbsolutePath ( File file ) { try { return file . getCanonicalPath ( ) ; } catch ( IOException ignore ) { return file . getAbsolutePath ( ) ; } } | Attempts to the get the canonical path of the given file otherwise returns the absolute path of the file . |
9,608 | public static br_currentconfig get ( nitro_service client , br_currentconfig resource ) throws Exception { resource . validate ( "get" ) ; return ( ( br_currentconfig [ ] ) resource . get_resources ( client ) ) [ 0 ] ; } | Use this operation to get current configuration from Repeater Instance . |
9,609 | public static String join ( Collection < ? extends Object > lst , String separator ) { StringBuilder buf = new StringBuilder ( lst . size ( ) * 64 ) ; boolean first = true ; for ( Object value : lst ) { if ( first ) first = false ; else buf . append ( separator ) ; buf . append ( value . toString ( ) ) ; } return buf .... | Concatenates a list of objects using the given separator . |
9,610 | public static < T > T last ( List < T > lst ) { if ( lst == null || lst . isEmpty ( ) ) return null ; return lst . get ( lst . size ( ) - 1 ) ; } | Returns the last element of a list or null if empty . |
9,611 | @ SuppressWarnings ( "unchecked" ) public static < From , To > List < To > map ( List < From > list , MapClosure < From , To > f ) { List < To > result = new ArrayList < To > ( list . size ( ) ) ; for ( From value : list ) { result . add ( f . eval ( value ) ) ; } return result ; } | Applies a function to every item in a list . |
9,612 | public static < Accumulator , Value > Accumulator reduce ( List < Value > list , Accumulator init , ReduceClosure < Accumulator , Value > f ) { Accumulator accumulator = init ; for ( Value value : list ) { accumulator = f . eval ( accumulator , value ) ; } return accumulator ; } | Applies a binary function between each element of the given list . |
9,613 | @ SuppressWarnings ( "unchecked" ) public static int median ( List < Integer > values ) { if ( values == null || values . isEmpty ( ) ) return 0 ; values = new ArrayList < Integer > ( values ) ; Collections . sort ( values ) ; final int size = values . size ( ) ; final int sizeHalf = size / 2 ; if ( size % 2 == 1 ) { r... | Computes the median value of a list of integers . |
9,614 | static JsonRpcResponse error ( JsonRpcError error , JsonElement id ) { return new JsonRpcResponse ( id , error , null ) ; } | Builds a new response for an identifier request and containing an error . |
9,615 | public static JsonRpcResponse success ( JsonObject payload , JsonElement id ) { return new JsonRpcResponse ( id , null , payload ) ; } | Builds a new successful response . |
9,616 | public JsonObject toJson ( ) { JsonObject body = new JsonObject ( ) ; body . add ( JsonRpcProtocol . ID , id ( ) ) ; if ( isError ( ) ) { body . add ( JsonRpcProtocol . ERROR , error ( ) . toJson ( ) ) ; } else { body . add ( JsonRpcProtocol . RESULT , result ( ) ) ; } return body ; } | Generates the JSON representation of this response . |
9,617 | public static traceroute get ( nitro_service client , traceroute resource ) throws Exception { resource . validate ( "get" ) ; return ( ( traceroute [ ] ) resource . get_resources ( client ) ) [ 0 ] ; } | Use this operation to get the status of traceroute on a given device . |
9,618 | public static traceroute [ ] get_filtered ( nitro_service service , filtervalue [ ] filter ) throws Exception { traceroute obj = new traceroute ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; traceroute [ ] response = ( traceroute [ ] ) obj . getfiltered ( service , option ) ; return response ... | Use this API to fetch filtered set of traceroute resources . set the filter parameter values in filtervalue object . |
9,619 | public boolean isMatching ( MouseEvent event ) { return ( event != null ) && ! event . isConsumed ( ) && ( mouseModifiers . isNone ( ) || ( ( event . isPrimaryButtonDown ( ) == mouseButtons . isPrimary ( ) ) && ( event . isMiddleButtonDown ( ) == mouseButtons . isMiddle ( ) ) && ( event . isSecondaryButtonDown ( ) == m... | Check whether the given MouseEvent is matching the current properties . |
9,620 | private WebTarget configure ( String token , boolean debug , Logger log , int maxLog ) { Client client = ClientBuilder . newBuilder ( ) . register ( MultiPartFeature . class ) . register ( JsonProcessingFeature . class ) . build ( ) ; client . register ( HttpAuthenticationFeature . basic ( token , "" ) ) ; if ( debug )... | Configures this client by settings HTTP AUTH filter the REST URL and logging . |
9,621 | protected < JsonType extends JsonStructure , ValueType > ValueType invoke ( String operation , String id , String action , QueryClosure queryClosure , RequestClosure < JsonType > requestClosure , ResponseClosure < JsonType , ValueType > responseClosure ) { try { WebTarget ws = wsBase . path ( operation ) ; if ( id != n... | Performs a REST API invocation . |
9,622 | protected void checkApiToken ( String apiToken ) { if ( StringUtils . isBlank ( apiToken ) ) throw new MissingApiTokenException ( "Empty key" ) ; if ( apiToken . length ( ) != TOKEN_LENGTH ) throw new MissingApiTokenException ( "Wrong length" ) ; if ( ! apiToken . matches ( HEX_PATTERN ) ) throw new MissingApiTokenExce... | Syntax checks the API Token . |
9,623 | public boolean isValidToken ( ) { try { LoadZone zone = getLoadZone ( LoadZone . AMAZON_US_ASHBURN . uid ) ; return zone == LoadZone . AMAZON_US_ASHBURN ; } catch ( Exception e ) { log . info ( "API token validation failed: " + e ) ; } return false ; } | Returns true if we can successfully logon and fetch some data . |
9,624 | public LoadZone getLoadZone ( String id ) { return invoke ( LOAD_ZONES , id , null , null , new RequestClosure < JsonArray > ( ) { public JsonArray call ( Invocation . Builder request ) { return request . get ( JsonArray . class ) ; } } , new ResponseClosure < JsonArray , LoadZone > ( ) { public LoadZone call ( JsonArr... | Retrieves a load - zone . |
9,625 | public List < LoadZone > getLoadZone ( ) { return invoke ( LOAD_ZONES , new RequestClosure < JsonArray > ( ) { public JsonArray call ( Invocation . Builder request ) { return request . get ( JsonArray . class ) ; } } , new ResponseClosure < JsonArray , List < LoadZone > > ( ) { public List < LoadZone > call ( JsonArray... | Retrieves all load - zones . |
9,626 | public DataStore getDataStore ( int id ) { return invoke ( DATA_STORES , id , new RequestClosure < JsonObject > ( ) { public JsonObject call ( Invocation . Builder request ) { return request . get ( JsonObject . class ) ; } } , new ResponseClosure < JsonObject , DataStore > ( ) { public DataStore call ( JsonObject json... | Retrieves a data store . |
9,627 | public List < DataStore > getDataStores ( ) { return invoke ( DATA_STORES , new RequestClosure < JsonArray > ( ) { public JsonArray call ( Invocation . Builder request ) { return request . get ( JsonArray . class ) ; } } , new ResponseClosure < JsonArray , List < DataStore > > ( ) { public List < DataStore > call ( Jso... | Retrieves all data stores . |
9,628 | public void deleteDataStore ( final int id ) { invoke ( DATA_STORES , id , new RequestClosure < JsonStructure > ( ) { public JsonStructure call ( Invocation . Builder request ) { Response response = request . delete ( ) ; if ( response . getStatusInfo ( ) . getFamily ( ) != Response . Status . Family . SUCCESSFUL ) { t... | Deletes a data store . |
9,629 | public DataStore createDataStore ( final File file , final String name , final int fromline , final DataStore . Separator separator , final DataStore . StringDelimiter delimiter ) { return invoke ( DATA_STORES , new RequestClosure < JsonObject > ( ) { public JsonObject call ( Invocation . Builder request ) { MultiPart ... | Creates a new data store . |
9,630 | public UserScenario getUserScenario ( int id ) { return invoke ( USER_SCENARIOS , id , new RequestClosure < JsonObject > ( ) { public JsonObject call ( Invocation . Builder request ) { return request . get ( JsonObject . class ) ; } } , new ResponseClosure < JsonObject , UserScenario > ( ) { public UserScenario call ( ... | Retrieves a user scenario . |
9,631 | public List < UserScenario > getUserScenarios ( ) { return invoke ( USER_SCENARIOS , new RequestClosure < JsonArray > ( ) { public JsonArray call ( Invocation . Builder request ) { return request . get ( JsonArray . class ) ; } } , new ResponseClosure < JsonArray , List < UserScenario > > ( ) { public List < UserScenar... | Retrieves all user scenarios . |
9,632 | public UserScenario createUserScenario ( final UserScenario scenario ) { return invoke ( USER_SCENARIOS , new RequestClosure < JsonObject > ( ) { public JsonObject call ( Invocation . Builder request ) { String json = scenario . toJSON ( ) . toString ( ) ; Entity < String > data = Entity . entity ( json , MediaType . A... | Creates a new user scenario . |
9,633 | public UserScenarioValidation getUserScenarioValidation ( int id ) { return invoke ( USER_SCENARIO_VALIDATIONS , id , new RequestClosure < JsonObject > ( ) { public JsonObject call ( Invocation . Builder request ) { return request . get ( JsonObject . class ) ; } } , new ResponseClosure < JsonObject , UserScenarioValid... | Retrieves a user scenario validation . |
9,634 | @ SuppressWarnings ( "unchecked" ) public void setModifiedBy ( USER modifiedBy ) { this . modifiedBy = assertNotNull ( modifiedBy , ( ) -> "Modified by is required" ) ; this . lastModifiedBy = defaultIfNull ( this . lastModifiedBy , this . modifiedBy ) ; } | Sets the user responsible for modifying this object . |
9,635 | public static br reboot ( nitro_service client , br resource ) throws Exception { return ( ( br [ ] ) resource . perform_operation ( client , "reboot" ) ) [ 0 ] ; } | Use this operation to reboot Repeater Instance . |
9,636 | public static br stop ( nitro_service client , br resource ) throws Exception { return ( ( br [ ] ) resource . perform_operation ( client , "stop" ) ) [ 0 ] ; } | Use this operation to stop Repeater Instance . |
9,637 | public static br force_reboot ( nitro_service client , br resource ) throws Exception { return ( ( br [ ] ) resource . perform_operation ( client , "force_reboot" ) ) [ 0 ] ; } | Use this operation to force reboot Repeater Instance . |
9,638 | public static br force_stop ( nitro_service client , br resource ) throws Exception { return ( ( br [ ] ) resource . perform_operation ( client , "force_stop" ) ) [ 0 ] ; } | Use this operation to force stop Repeater Instance . |
9,639 | public static br start ( nitro_service client , br resource ) throws Exception { return ( ( br [ ] ) resource . perform_operation ( client , "start" ) ) [ 0 ] ; } | Use this operation to start Repeater Instance . |
9,640 | public boolean isMatching ( GestureEvent event ) { return ( event != null ) && ! event . isConsumed ( ) && ( gestureModifiers . isNone ( ) || ( ( event . isAltDown ( ) == gestureModifiers . isAlt ( ) ) && ( event . isShiftDown ( ) == gestureModifiers . isShift ( ) ) && ( event . isControlDown ( ) == gestureModifiers . ... | Check whether the given GestureEvent is matching the current properties . |
9,641 | public static prune_policy get ( nitro_service client , prune_policy resource ) throws Exception { resource . validate ( "get" ) ; return ( ( prune_policy [ ] ) resource . get_resources ( client ) ) [ 0 ] ; } | Use this operation to get the prune policy to view number of days data to retain . |
9,642 | @ SuppressWarnings ( "unchecked" ) public < E > E search ( final Collection < E > collection ) { Assert . isInstanceOf ( collection , List . class , "The collection {0} must be an instance of java.util.List!" , ClassUtils . getClassName ( collection ) ) ; return doSearch ( ( List < E > ) collection ) ; } | Searches the Collection of elements in order to find the element or elements matching the criteria defined by the Matcher . The search operation expects the collection of elements to an instance of java . util . List an ordered collection of elements that are sorted according the natural ordering of the element s Compa... |
9,643 | public void close ( ) { refuseNewRequests . set ( true ) ; channel . close ( ) . awaitUninterruptibly ( ) ; channel . eventLoop ( ) . shutdownGracefully ( ) . awaitUninterruptibly ( ) ; } | Shuts down this client and releases the underlying associated resources . |
9,644 | protected FraggleFragment peek ( String tag ) { if ( fm != null ) { return ( FraggleFragment ) fm . findFragmentByTag ( tag ) ; } return new EmptyFragment ( ) ; } | Returns the first fragment in the stack with the tag tag . |
9,645 | protected void processAnimations ( FragmentAnimation animation , FragmentTransaction ft ) { if ( animation != null ) { if ( animation . isCompletedAnimation ( ) ) { ft . setCustomAnimations ( animation . getEnterAnim ( ) , animation . getExitAnim ( ) , animation . getPushInAnim ( ) , animation . getPopOutAnim ( ) ) ; }... | Processes the custom animations element adding them as required |
9,646 | protected void configureAdditionMode ( Fragment frag , int flags , FragmentTransaction ft , int containerId ) { if ( ( flags & DO_NOT_REPLACE_FRAGMENT ) != DO_NOT_REPLACE_FRAGMENT ) { ft . replace ( containerId , frag , ( ( FraggleFragment ) frag ) . getFragmentTag ( ) ) ; } else { ft . add ( containerId , frag , ( ( F... | Configures the way to add the Fragment into the transaction . It can vary from adding a new fragment to using a previous instance and refresh it or replacing the last one . |
9,647 | protected void performTransaction ( Fragment frag , int flags , FragmentTransaction ft , int containerId ) { configureAdditionMode ( frag , flags , ft , containerId ) ; ft . commitAllowingStateLoss ( ) ; } | Commits the transaction to the Fragment Manager . |
9,648 | protected FraggleFragment peek ( ) { if ( fm . getBackStackEntryCount ( ) > 0 ) { return ( ( FraggleFragment ) fm . findFragmentByTag ( fm . getBackStackEntryAt ( fm . getBackStackEntryCount ( ) - 1 ) . getName ( ) ) ) ; } else { return new EmptyFragment ( ) ; } } | Peeks the last fragment in the Fragment stack . |
9,649 | public void clear ( ) { if ( fm != null ) { fm . popBackStack ( null , FragmentManager . POP_BACK_STACK_INCLUSIVE ) ; } fm = null ; } | Clears fragment manager backstack and the fragment manager itself . |
9,650 | public void reattach ( String tag ) { final Fragment currentFragment = ( Fragment ) peek ( tag ) ; FragmentTransaction fragTransaction = fm . beginTransaction ( ) ; fragTransaction . detach ( currentFragment ) ; fragTransaction . attach ( currentFragment ) ; fragTransaction . commit ( ) ; } | Reattaches a Fragment |
9,651 | public Set < String > keys ( String pattern ) { Set < String > result = new TreeSet < String > ( ) ; for ( String key : keys ( ) ) { if ( key . matches ( pattern ) ) result . add ( key ) ; } return result ; } | Returns all keys matching the given pattern . |
9,652 | public String get ( String key , String defaultValue ) { String value = parameters . get ( key ) ; return StringUtils . isBlank ( value ) ? defaultValue : value ; } | Returns the value associated with the key or the given default value . |
9,653 | public static system_settings get ( nitro_service client ) throws Exception { system_settings resource = new system_settings ( ) ; resource . validate ( "get" ) ; return ( ( system_settings [ ] ) resource . get_resources ( client ) ) [ 0 ] ; } | Use this operation to get SDX system settings . |
9,654 | @ SuppressWarnings ( "unchecked" ) public < E > Comparator < E > getOrderBy ( ) { return ObjectUtils . defaultIfNull ( ComparatorHolder . get ( ) , ObjectUtils . defaultIfNull ( orderBy , ComparableComparator . INSTANCE ) ) ; } | Gets the Comparator used to order the elements in the collection . |
9,655 | @ SuppressWarnings ( "unchecked" ) public < E > E [ ] sort ( final E ... elements ) { sort ( new SortableArrayList ( elements ) ) ; return elements ; } | Sorts an array of elements as defined by the Comparator or as determined by the elements in the array if the elements are Comparable . |
9,656 | public < E > Sortable < E > sort ( final Sortable < E > sortable ) { try { sort ( configureComparator ( sortable ) . asList ( ) ) ; return sortable ; } finally { ComparatorHolder . unset ( ) ; } } | Sorts the List representation of the Sortable implementing object as defined by the orderBy Comparator or as determined by elements in the Sortable collection if the elements are Comparable . |
9,657 | public static < T > Optional < T > first ( final Optional < T > ... optionals ) { return Arrays . stream ( optionals ) . filter ( Optional :: isPresent ) . findFirst ( ) . orElse ( Optional . empty ( ) ) ; } | Gets the first optional with a present value . |
9,658 | @ SuppressWarnings ( "unchecked" ) public static < T extends Searcher > T createSearcher ( final SearchType type ) { switch ( ObjectUtils . defaultIfNull ( type , SearchType . UNKNOWN_SEARCH ) ) { case BINARY_SEARCH : return ( T ) new BinarySearch ( ) ; case LINEAR_SEARCH : return ( T ) new LinearSearch ( ) ; default :... | Creates an instance of the Searcher interface implementing the searching algorithm based on the SearchType . |
9,659 | public static < T extends Searcher > T createSearcherElseDefault ( final SearchType type , final T defaultSearcher ) { try { return createSearcher ( type ) ; } catch ( IllegalArgumentException ignore ) { return defaultSearcher ; } } | Creates an instance of the Searcher interface implementing the searching algorithm based on the SearchType otherwise returns the provided default Searcher implementation if a Searcher based on the specified SearchType is not available . |
9,660 | private void balance ( ) { if ( ! isTerminated ( ) ) { Set < Map . Entry < Thread , Tracking > > threads = liveThreads . entrySet ( ) ; long liveAvgTimeTotal = 0 ; long liveAvgCpuTotal = 0 ; long liveCount = 0 ; for ( Map . Entry < Thread , Tracking > e : threads ) { if ( ! e . getKey ( ) . isAlive ( ) ) { threads . re... | Compute and set the optimal number of threads to use in this pool . |
9,661 | public void setMenu ( Menu menu ) { this . menu = menu ; RadialMenuItem . setupMenuButton ( this , radialMenuParams , ( menu != null ) ? menu . getGraphic ( ) : null , ( menu != null ) ? menu . getText ( ) : null , true ) ; } | Sets the menu model . |
9,662 | public < E > List < E > sort ( final List < E > elements ) { int size = elements . size ( ) ; for ( int parentIndex = ( ( size - 2 ) / 2 ) ; parentIndex >= 0 ; parentIndex -- ) { siftDown ( elements , parentIndex , size - 1 ) ; } for ( int count = ( size - 1 ) ; count > 0 ; count -- ) { swap ( elements , 0 , count ) ; ... | Uses the Heap 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 . |
9,663 | protected < E > void siftDown ( final List < E > elements , final int startIndex , final int endIndex ) { int rootIndex = startIndex ; while ( ( rootIndex * 2 + 1 ) <= endIndex ) { int swapIndex = rootIndex ; int leftChildIndex = ( rootIndex * 2 + 1 ) ; int rightChildIndex = ( leftChildIndex + 1 ) ; if ( getOrderBy ( )... | Creates a binary heap with the list of elements with the largest valued element at the root followed by the next largest valued elements as parents down to the leafs . |
9,664 | public void fireChangeEvent ( ) { ChangeEvent event = createChangeEvent ( getSource ( ) ) ; for ( ChangeListener listener : this ) { listener . stateChanged ( event ) ; } } | Fires a ChangeEvent for the source Object notifying each registered ChangeListener of the change . |
9,665 | public < E > List < E > sort ( final List < E > elements ) { int elementsSize = elements . size ( ) ; if ( elementsSize <= getSizeThreshold ( ) ) { return getSorter ( ) . sort ( elements ) ; } else { int beginIndex = 1 ; int endIndex = ( elementsSize - 1 ) ; E pivotElement = elements . get ( 0 ) ; while ( beginIndex < ... | Uses the Quick 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 . |
9,666 | public void onBeforeAdd ( E value ) { long freeHeapSpace = RUNTIME . freeMemory ( ) + ( RUNTIME . maxMemory ( ) - RUNTIME . totalMemory ( ) ) ; if ( freeHeapSpace < minimumHeapSpaceBeforeFlowControl ) { long x = minimumHeapSpaceBeforeFlowControl - freeHeapSpace ; long delay = Math . round ( x * ( x * c ) ) ; try { Thre... | Block for a varying amount based on how close the system is to the max heap space . Only kick in when we have passed the percentOfHeapBeforeFlowControl threshold . |
9,667 | public void onAfterRemove ( E value ) { if ( value != null ) { dequeued ++ ; if ( dequeued % dequeueHint == 0 ) { RUNTIME . gc ( ) ; } } } | Increment the count of removed items from the queue . Calling this will optionally request that the garbage collector run to free up heap space for every nth dequeue where n is the value set for the dequeueHint . |
9,668 | public void propertyChange ( final PropertyChangeEvent event ) { if ( objectStateMap . containsKey ( event . getPropertyName ( ) ) ) { if ( objectStateMap . get ( event . getPropertyName ( ) ) == ObjectUtils . hashCode ( event . getNewValue ( ) ) ) { objectStateMap . remove ( event . getPropertyName ( ) ) ; } } else { ... | The event handler method that gets fired when a property of the Bean tracked by this ChangeTracker has been modified . The PropertyChangeEvent encapsulates all the information pertaining to the property change including the name of the property it s old and new value and the source Bean of the targeted change . |
9,669 | public void setResponse ( JsonRpcResponse response ) { if ( response . isError ( ) ) { setException ( response . error ( ) ) ; return ; } try { set ( ( V ) Messages . fromJson ( method . outputBuilder ( ) , response . result ( ) ) ) ; } catch ( Exception e ) { setException ( e ) ; } } | Sets the JSON response of this promise . |
9,670 | @ SuppressWarnings ( "unchecked" ) protected Class [ ] getArgumentTypes ( final Object ... arguments ) { Class [ ] argumentTypes = new Class [ arguments . length ] ; int index = 0 ; for ( Object argument : arguments ) { argumentTypes [ index ++ ] = ObjectUtils . defaultIfNull ( ClassUtils . getClass ( argument ) , Obje... | Determines the class types of the array of object arguments . |
9,671 | protected Constructor resolveConstructor ( final Class < ? > objectType , final Class ... parameterTypes ) { try { return objectType . getConstructor ( parameterTypes ) ; } catch ( NoSuchMethodException e ) { if ( ! ArrayUtils . isEmpty ( parameterTypes ) ) { Constructor constructor = resolveCompatibleConstructor ( obj... | Resolves the Class constructor with the given signature as determined by the parameter types . |
9,672 | @ SuppressWarnings ( "unchecked" ) protected Constructor resolveCompatibleConstructor ( final Class < ? > objectType , final Class < ? > [ ] parameterTypes ) { for ( Constructor constructor : objectType . getConstructors ( ) ) { Class [ ] constructorParameterTypes = constructor . getParameterTypes ( ) ; if ( parameterT... | Resolves the matching constructor for the specified Class type who s actual public constructor argument types are assignment compatible with the expected parameter types . |
9,673 | @ SuppressWarnings ( "unchecked" ) public < T > T create ( final String objectTypeName , final Object ... args ) { return ( T ) create ( ClassUtils . loadClass ( objectTypeName ) , getArgumentTypes ( args ) , args ) ; } | Creates an object given the fully qualified class name initialized with the specified constructor arguments . The parameter types of the constructor used to construct the object are determined from the arguments . |
9,674 | public < T > T create ( final Class < T > objectType , final Object ... args ) { return create ( objectType , getArgumentTypes ( args ) , args ) ; } | Creates an object given the class type initialized with the specified constructor arguments . The parameter types of the constructor used to construct the object are determined from the arguments . |
9,675 | private static int copyPathFragment ( char [ ] input , int beginIndex , StringBuilder output ) { int inputCharIndex = beginIndex ; while ( inputCharIndex < input . length ) { final char inputChar = input [ inputCharIndex ] ; if ( inputChar == '/' ) { break ; } output . append ( inputChar ) ; inputCharIndex += 1 ; } ret... | Copy path fragment |
9,676 | public ListenableFuture < JsonRpcResponse > invoke ( JsonRpcRequest request ) { Service service = services . lookupByName ( request . service ( ) ) ; if ( service == null ) { JsonRpcError error = new JsonRpcError ( HttpResponseStatus . BAD_REQUEST , "Unknown service: " + request . service ( ) ) ; JsonRpcResponse respon... | Executes a request . |
9,677 | private < I extends Message , O extends Message > ListenableFuture < JsonRpcResponse > invoke ( ServerMethod < I , O > method , JsonObject parameter , JsonElement id ) { I request ; try { request = ( I ) Messages . fromJson ( method . inputBuilder ( ) , parameter ) ; } catch ( Exception e ) { serverLogger . logServerFa... | Actually invokes the server method . |
9,678 | protected synchronized void addContent ( Artifact record , String filename ) { if ( record != null ) { if ( filename . endsWith ( ".jar" ) ) { embedded . add ( record ) ; } else { contents . add ( record ) ; } } } | Synchronized method for adding a new conent |
9,679 | protected void submitJob ( ExecutorService executor , Content file ) { class OneShotTask implements Runnable { Content file ; OneShotTask ( Content file ) { this . file = file ; } public void run ( ) { processContent ( file ) ; } } executor . submit ( new OneShotTask ( file ) ) ; } | Helper method to sumit a new threaded tast to a given executor . |
9,680 | public static < T extends Comparable < T > > ComparableValueHolder < T > withComparableValue ( final T value ) { return new ComparableValueHolder < > ( value ) ; } | Factory method to construct an instance of the ValueHolder class with a Comparable value . The ValueHolder implementation itself implements the Comparable interface . |
9,681 | public static < T extends Cloneable > ValueHolder < T > withImmutableValue ( final T value ) { return new ValueHolder < T > ( ObjectUtils . clone ( value ) ) { public T getValue ( ) { return ObjectUtils . clone ( super . getValue ( ) ) ; } public void setValue ( final T value ) { super . setValue ( ObjectUtils . clone ... | Factory method to construct an instance of the ValueHolder class with an immutable Object value . |
9,682 | public static < T > ValueHolder < T > withNonNullValue ( final T value ) { Assert . notNull ( value , "The value must not be null!" ) ; return new ValueHolder < T > ( value ) { public void setValue ( final T value ) { Assert . notNull ( value , "The value must not be null!" ) ; super . setValue ( value ) ; } } ; } | Factory method to construct an instance of the ValueHolder class with a non - null value . |
9,683 | public static xen reboot ( nitro_service client , xen resource ) throws Exception { return ( ( xen [ ] ) resource . perform_operation ( client , "reboot" ) ) [ 0 ] ; } | Use this operation to reboot XenServer . |
9,684 | public static xen stop ( nitro_service client , xen resource ) throws Exception { return ( ( xen [ ] ) resource . perform_operation ( client , "stop" ) ) [ 0 ] ; } | Use this operation to shutdown XenServer . |
9,685 | public static xen [ ] get_filtered ( nitro_service service , filtervalue [ ] filter ) throws Exception { xen obj = new xen ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; xen [ ] response = ( xen [ ] ) obj . getfiltered ( service , option ) ; return response ; } | Use this API to fetch filtered set of xen resources . set the filter parameter values in filtervalue object . |
9,686 | public static sdx_license get ( nitro_service client ) throws Exception { sdx_license resource = new sdx_license ( ) ; resource . validate ( "get" ) ; return ( ( sdx_license [ ] ) resource . get_resources ( client ) ) [ 0 ] ; } | Use this operation to get SDX license information . |
9,687 | public void visit ( final Visitable visitable ) { if ( visitable instanceof Auditable ) { modified |= ( ( Auditable ) visitable ) . isModified ( ) ; } } | Visits all Auditable Visitable objects in an object graph hierarchy in search of any modified objects . |
9,688 | public FilterBuilder < T > addWithAnd ( final Filter < T > filter ) { filterInstance = ComposableFilter . and ( filterInstance , filter ) ; return this ; } | Adds the specified Filter to the composition of Filters joined using the AND operator . |
9,689 | public FilterBuilder < T > addWithOr ( final Filter < T > filter ) { filterInstance = ComposableFilter . or ( filterInstance , filter ) ; return this ; } | Adds the specified Filter to the composition of Filters joined using the OR operator . |
9,690 | @ SuppressWarnings ( "unchecked" ) public static < T > T [ ] filter ( T [ ] array , Filter < T > filter ) { Assert . notNull ( array , "Array is required" ) ; Assert . notNull ( filter , "Filter is required" ) ; List < T > arrayList = stream ( array ) . filter ( filter :: accept ) . collect ( Collectors . toList ( ) ) ... | Filters the elements in the array . |
9,691 | @ SuppressWarnings ( "unchecked" ) public static < T > T [ ] filterAndTransform ( T [ ] array , FilteringTransformer < T > filteringTransformer ) { return transform ( filter ( array , filteringTransformer ) , filteringTransformer ) ; } | Filters and transforms the elements in the array . |
9,692 | @ SuppressWarnings ( "unchecked" ) public static < T > T [ ] insert ( T element , T [ ] array , int index ) { Assert . notNull ( array , "Array is required" ) ; assertThat ( index ) . throwing ( new ArrayIndexOutOfBoundsException ( String . format ( "[%1$d] is not a valid index [0, %2$d] in the array" , index , array .... | Inserts element into the array at index . |
9,693 | @ SuppressWarnings ( "unchecked" ) public static < T > T [ ] remove ( T [ ] array , int index ) { Assert . notNull ( array , "Array is required" ) ; assertThat ( index ) . throwing ( new ArrayIndexOutOfBoundsException ( String . format ( "[%1$d] is not a valid index [0, %2$d] in the array" , index , array . length ) ) ... | Removes the element at index from the given array . |
9,694 | public static < T > T [ ] sort ( T [ ] array , Comparator < T > comparator ) { Arrays . sort ( array , comparator ) ; return array ; } | Sorts the elements in the given array . |
9,695 | @ SuppressWarnings ( "unchecked" ) public static < T > T [ ] subArray ( T [ ] array , int ... indices ) { List < T > subArrayList = new ArrayList < > ( indices . length ) ; for ( int index : indices ) { subArrayList . add ( array [ index ] ) ; } return subArrayList . toArray ( ( T [ ] ) Array . newInstance ( array . ge... | Creates a sub - array from the given array with elements at the specified indices in the given array . |
9,696 | public static < T > T [ ] swap ( T [ ] array , int indexOne , int indexTwo ) { T elementAtIndexOne = array [ indexOne ] ; array [ indexOne ] = array [ indexTwo ] ; array [ indexTwo ] = elementAtIndexOne ; return array ; } | Swaps elements in the array at indexOne and indexTwo . |
9,697 | public static void warnFormatted ( final Exception exception ) { logWriterInstance . warn ( exception ) ; UaiWebSocketLogManager . addLogText ( "[WARN] An exception just happened: " + exception . getMessage ( ) ) ; } | Wil log a text with the WARN level . |
9,698 | public static JsonObject toJson ( Message output ) { JsonObject object = new JsonObject ( ) ; for ( Map . Entry < Descriptors . FieldDescriptor , Object > field : output . getAllFields ( ) . entrySet ( ) ) { String jsonName = CaseFormat . LOWER_UNDERSCORE . to ( CaseFormat . LOWER_CAMEL , field . getKey ( ) . getName (... | Converts a proto - message into an equivalent JSON representation . |
9,699 | public static Message fromJson ( Message . Builder builder , JsonObject input ) throws Exception { Descriptors . Descriptor descriptor = builder . getDescriptorForType ( ) ; for ( Map . Entry < String , JsonElement > entry : input . entrySet ( ) ) { String protoName = CaseFormat . LOWER_CAMEL . to ( CaseFormat . LOWER_... | Converts a JSON object to a protobuf message |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.