signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class CPDefinitionSpecificationOptionValueUtil { /** * Returns the last cp definition specification option value in the ordered set where uuid = & # 63 ; .
* @ param uuid the uuid
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching cp definition specification option value , or < code > null < / code > if a matching cp definition specification option value could not be found */
public static CPDefinitionSpecificationOptionValue fetchByUuid_Last ( String uuid , OrderByComparator < CPDefinitionSpecificationOptionValue > orderByComparator ) { } } | return getPersistence ( ) . fetchByUuid_Last ( uuid , orderByComparator ) ; |
public class PackageUtils { /** * Returns whether the given package is a system package , i . e . it is the root system package or a
* descendant of the root system package .
* @ param aPackage package
* @ return whether package is a system package */
public static boolean isSystemPackage ( @ Nullable @ CheckForNull Package aPackage ) { } } | if ( aPackage == null ) { return false ; } return runAsSystem ( ( ) -> aPackage . getId ( ) . equals ( PACKAGE_SYSTEM ) || ( aPackage . getRootPackage ( ) != null && aPackage . getRootPackage ( ) . getId ( ) . equals ( PACKAGE_SYSTEM ) ) ) ; |
public class BaseBigtableTableAdminClient { /** * Checks replication consistency based on a consistency token , that is , if replication has caught
* up based on the conditions specified in the token and the check request .
* < p > Sample code :
* < pre > < code >
* try ( BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient . create ( ) ) {
* TableName name = TableName . of ( " [ PROJECT ] " , " [ INSTANCE ] " , " [ TABLE ] " ) ;
* String consistencyToken = " " ;
* CheckConsistencyResponse response = baseBigtableTableAdminClient . checkConsistency ( name . toString ( ) , consistencyToken ) ;
* < / code > < / pre >
* @ param name The unique name of the Table for which to check replication consistency . Values are
* of the form ` projects / & lt ; project & gt ; / instances / & lt ; instance & gt ; / tables / & lt ; table & gt ; ` .
* @ param consistencyToken The token created using GenerateConsistencyToken for the Table .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final CheckConsistencyResponse checkConsistency ( String name , String consistencyToken ) { } } | CheckConsistencyRequest request = CheckConsistencyRequest . newBuilder ( ) . setName ( name ) . setConsistencyToken ( consistencyToken ) . build ( ) ; return checkConsistency ( request ) ; |
public class PaymentSource { public static CreateUsingTempTokenRequest createUsingTempToken ( ) throws IOException { } } | String uri = uri ( "payment_sources" , "create_using_temp_token" ) ; return new CreateUsingTempTokenRequest ( Method . POST , uri ) ; |
public class CreateProductRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CreateProductRequest createProductRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( createProductRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createProductRequest . getAcceptLanguage ( ) , ACCEPTLANGUAGE_BINDING ) ; protocolMarshaller . marshall ( createProductRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( createProductRequest . getOwner ( ) , OWNER_BINDING ) ; protocolMarshaller . marshall ( createProductRequest . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( createProductRequest . getDistributor ( ) , DISTRIBUTOR_BINDING ) ; protocolMarshaller . marshall ( createProductRequest . getSupportDescription ( ) , SUPPORTDESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( createProductRequest . getSupportEmail ( ) , SUPPORTEMAIL_BINDING ) ; protocolMarshaller . marshall ( createProductRequest . getSupportUrl ( ) , SUPPORTURL_BINDING ) ; protocolMarshaller . marshall ( createProductRequest . getProductType ( ) , PRODUCTTYPE_BINDING ) ; protocolMarshaller . marshall ( createProductRequest . getTags ( ) , TAGS_BINDING ) ; protocolMarshaller . marshall ( createProductRequest . getProvisioningArtifactParameters ( ) , PROVISIONINGARTIFACTPARAMETERS_BINDING ) ; protocolMarshaller . marshall ( createProductRequest . getIdempotencyToken ( ) , IDEMPOTENCYTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MtasSolrMtasResult { /** * Merge .
* @ param newItem the new item
* @ throws IOException Signals that an I / O exception has occurred . */
void merge ( MtasSolrMtasResult newItem ) throws IOException { } } | HashMap < MtasDataCollector < ? , ? > , MtasDataCollector < ? , ? > > map = new HashMap < > ( ) ; if ( newItem . dataCollector . withTotal ( ) ) { dataCollector . setWithTotal ( ) ; } dataCollector . merge ( newItem . dataCollector , map , true ) ; if ( newItem . functionData != null ) { if ( functionData == null ) { functionData = new HashMap < > ( ) ; } for ( MtasDataCollector < ? , ? > keyCollector : newItem . functionData . keySet ( ) ) { if ( map . containsKey ( keyCollector ) ) { // compute mapped key
MtasDataCollector < ? , ? > newKeyCollector = keyCollector ; while ( map . containsKey ( newKeyCollector ) ) { newKeyCollector = map . get ( keyCollector ) ; } if ( functionData . containsKey ( newKeyCollector ) ) { HashMap < String , MtasSolrMtasResult > tmpList = functionData . get ( newKeyCollector ) ; for ( String functionKey : newItem . functionData . get ( keyCollector ) . keySet ( ) ) { if ( tmpList . containsKey ( functionKey ) ) { tmpList . get ( functionKey ) . merge ( newItem . functionData . get ( keyCollector ) . get ( functionKey ) ) ; } else { tmpList . put ( functionKey , newItem . functionData . get ( keyCollector ) . get ( functionKey ) ) ; } } } else { functionData . put ( newKeyCollector , newItem . functionData . get ( keyCollector ) ) ; } } } } |
public class MapTilePersisterModel { /** * Count the active tiles .
* @ param widthInTile The horizontal tiles .
* @ param step The step number .
* @ param s The s value .
* @ return The active tiles . */
private int countTiles ( int widthInTile , int step , int s ) { } } | int count = 0 ; for ( int tx = 0 ; tx < widthInTile ; tx ++ ) { for ( int ty = 0 ; ty < map . getInTileHeight ( ) ; ty ++ ) { if ( map . getTile ( tx + s * step , ty ) != null ) { count ++ ; } } } return count ; |
public class MeasureExtractor { /** * Obtains a HashMap with the measures extracted from a JSONObject representing the sensor data .
* @ author Marcos García Casado */
public HashMap < String , Double > getArrayMeasures ( JSONObject jsonContent ) { } } | HashMap < String , Double > i = new HashMap < String , Double > ( ) ; return i ; |
public class MCAAuthorizationManager { /** * Registers authentication listener for specified realm .
* @ param realm authentication realm .
* @ param listener authentication listener . */
public void registerAuthenticationListener ( String realm , AuthenticationListener listener ) { } } | if ( realm == null || realm . isEmpty ( ) ) { throw new InvalidParameterException ( "The realm name can't be null or empty." ) ; } if ( listener == null ) { throw new InvalidParameterException ( "The authentication listener object can't be null." ) ; } ChallengeHandler handler = new ChallengeHandler ( ) ; handler . initialize ( realm , listener ) ; challengeHandlers . put ( realm , handler ) ; |
public class LogWatchStorageManager { /** * Get index of the last plus one message that the follower has access to .
* @ param follower
* Follower in question .
* @ return Ending message ID after { @ link # followerTerminated ( Follower ) } .
* { @ link MessageStore # getLatestPosition ( ) } between
* { @ link # followerStarted ( Follower ) } and
* { @ link # followerTerminated ( Follower ) } . Will throw an exception
* otherwise . */
private synchronized int getEndingMessageId ( final Follower follower ) { } } | if ( this . isFollowerActive ( follower ) ) { return this . messages . getLatestPosition ( ) ; } else if ( this . isFollowerTerminated ( follower ) ) { return this . terminatedFollowerRanges . get ( follower ) [ 1 ] ; } else { throw new IllegalStateException ( "Follower never before seen." ) ; } |
public class StatusAPI { /** * Creates a new status message for a user on a specific space . A status
* update is simply a short text message that the user wishes to share with
* the rest of the space .
* @ param status
* The data for the new status message
* @ return The id of the newly created status message */
public int createStatus ( int spaceId , StatusCreate status ) { } } | return getResourceFactory ( ) . getApiResource ( "/status/space/" + spaceId + "/" ) . entity ( status , MediaType . APPLICATION_JSON_TYPE ) . post ( StatusCreateResponse . class ) . getId ( ) ; |
public class Stream { /** * Performs the given indexed action on each element .
* < p > This is a terminal operation .
* @ param from the initial value of the index ( inclusive )
* @ param step the step of the index
* @ param action the action to be performed on each element
* @ since 1.1.6 */
public void forEachIndexed ( int from , int step , @ NotNull IndexedConsumer < ? super T > action ) { } } | int index = from ; while ( iterator . hasNext ( ) ) { action . accept ( index , iterator . next ( ) ) ; index += step ; } |
public class SleepThrottle { /** * This method can only be called at the rate set by the { @ link # setRate } method , if it is called faster than this
* it will inject short pauses to restrict the call rate to that rate .
* @ throws InterruptedException If interrupted whilst performing a blocking wait on the throttle . */
public synchronized void throttle ( ) throws InterruptedException { } } | // Get the current time in nanos .
long currentTimeNanos = System . nanoTime ( ) ; // Don ' t introduce any pause on the first call .
if ( ! firstCall ) { // Check if there is any time left in the cycle since the last call to this method and introduce a short pause
// to fill that time if there is .
long remainingTimeNanos = cycleTimeNanos - ( currentTimeNanos - lastTimeNanos ) ; if ( remainingTimeNanos > 0 ) { long milliPause = remainingTimeNanos / 1000000 ; int nanoPause = ( int ) ( remainingTimeNanos % 1000000 ) ; Thread . sleep ( milliPause , nanoPause ) ; } } else { firstCall = false ; } // Update the last time stamp .
lastTimeNanos = System . nanoTime ( ) ; |
public class DummyInternalTransaction { /** * ( non - Javadoc )
* @ see com . ibm . ws . objectManager . InternalTransaction # lock ( com . ibm . ws . objectManager . ManagedObject ) */
protected synchronized void lock ( ManagedObject managedObject ) throws ObjectManagerException { } } | throw new InvalidStateException ( this , InternalTransaction . stateTerminated , InternalTransaction . stateNames [ InternalTransaction . stateTerminated ] ) ; |
public class ConstructorUtils { /** * < p > Finds an accessible constructor with compatible parameters . < / p >
* < p > This checks all the constructor and finds one with compatible parameters
* This requires that every parameter is assignable from the given parameter types .
* This is a more flexible search than the normal exact matching algorithm . < / p >
* < p > First it checks if there is a constructor matching the exact signature .
* If not then all the constructors of the class are checked to see if their
* signatures are assignment - compatible with the parameter types .
* The first assignment - compatible matching constructor is returned . < / p >
* @ param < T > the constructor type
* @ param cls the class to find a constructor for , not { @ code null }
* @ param parameterTypes find method with compatible parameters
* @ return the constructor , null if no matching accessible constructor found
* @ throws NullPointerException if { @ code cls } is { @ code null } */
public static < T > Constructor < T > getMatchingAccessibleConstructor ( final Class < T > cls , final Class < ? > ... parameterTypes ) { } } | Validate . notNull ( cls , "class cannot be null" ) ; // see if we can find the constructor directly
// most of the time this works and it ' s much faster
try { final Constructor < T > ctor = cls . getConstructor ( parameterTypes ) ; MemberUtils . setAccessibleWorkaround ( ctor ) ; return ctor ; } catch ( final NoSuchMethodException e ) { // NOPMD - Swallow
} Constructor < T > result = null ; /* * ( 1 ) Class . getConstructors ( ) is documented to return Constructor < T > so as
* long as the array is not subsequently modified , everything ' s fine . */
final Constructor < ? > [ ] ctors = cls . getConstructors ( ) ; // return best match :
for ( Constructor < ? > ctor : ctors ) { // compare parameters
if ( MemberUtils . isMatchingConstructor ( ctor , parameterTypes ) ) { // get accessible version of constructor
ctor = getAccessibleConstructor ( ctor ) ; if ( ctor != null ) { MemberUtils . setAccessibleWorkaround ( ctor ) ; if ( result == null || MemberUtils . compareConstructorFit ( ctor , result , parameterTypes ) < 0 ) { // temporary variable for annotation , see comment above ( 1)
@ SuppressWarnings ( "unchecked" ) final Constructor < T > constructor = ( Constructor < T > ) ctor ; result = constructor ; } } } } return result ; |
public class ExampleUtils { /** * Fills the { @ link org . javasimon . SimonManager } with specified number of Simons ( or slightly more ) .
* @ param roughCount how many Stopwatches to create ( or a bit more ) */
public static void fillManagerWithSimons ( int roughCount ) { } } | System . out . print ( "Filling manager with ~" + roughCount + " Simons..." ) ; while ( SimonManager . getSimonNames ( ) . size ( ) < roughCount ) { SimonManager . getStopwatch ( generateRandomName ( RANDOM . nextInt ( 10 ) + 1 ) ) ; } System . out . println ( " " + SimonManager . getSimonNames ( ) . size ( ) + " created." ) ; |
public class ClasspathFileReader { /** * Resolves the given file name , relative to the classpath , and returns a
* corresponding < code > File < / code > object . Only files that actually exist
* on their own on disk ( as opposed to being in a JAR ) will be resolved .
* @ param fileName the name of the file to lookup , relative to the classpath
* @ return the requested file
* @ throws FileNotFoundException if the file could not be found */
public File getFile ( String fileName ) throws FileNotFoundException { } } | final String methodName = "getFile(): " ; lastTimeDiskWasAccessed = System . currentTimeMillis ( ) ; List classpath = ClasspathUtils . getClasspathDirectories ( ) ; log . debug ( methodName + "looking for file '" + fileName + "' in classpath" ) ; File file = findFile ( fileName , classpath ) ; if ( file != null ) { log . debug ( methodName + " found file '" + fileName + "'" ) ; return file ; } log . debug ( methodName + " did not find file '" + fileName + "'" ) ; throw new FileNotFoundException ( "Could not locate file in classpath" ) ; |
public class OkVolley { /** * build the default User - Agent
* @ param context
* @ return */
public static String generateUserAgent ( Context context ) { } } | StringBuilder ua = new StringBuilder ( "api-client/" ) ; ua . append ( VERSION ) ; String packageName = context . getApplicationContext ( ) . getPackageName ( ) ; ua . append ( " " ) ; ua . append ( packageName ) ; PackageInfo pi = null ; try { pi = context . getPackageManager ( ) . getPackageInfo ( packageName , 0 ) ; } catch ( PackageManager . NameNotFoundException e ) { e . printStackTrace ( ) ; } if ( pi != null ) { ua . append ( "/" ) ; ua . append ( pi . versionName ) ; ua . append ( "(" ) ; ua . append ( pi . versionCode ) ; ua . append ( ")" ) ; } ua . append ( " Android/" ) ; ua . append ( Build . VERSION . SDK_INT ) ; try { ua . append ( " " ) ; ua . append ( Build . PRODUCT ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } try { ua . append ( " " ) ; ua . append ( Build . MANUFACTURER ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } try { ua . append ( " " ) ; ua . append ( Build . MODEL ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return ua . toString ( ) ; |
public class DicLibrary { /** * 动态添加词典
* @ param dicDefault
* @ param dicDefault2
* @ param dic2 */
public static void put ( String key , String path , Forest forest ) { } } | DIC . put ( key , KV . with ( path , forest ) ) ; MyStaticValue . ENV . put ( key , path ) ; |
public class DefaultKamCacheService { /** * { @ inheritDoc } */
@ Override public String loadKam ( KamInfo ki , KamFilter kf ) throws KamCacheServiceException { } } | if ( ki == null ) { throw new InvalidArgument ( "KamInfo required" ) ; } String ret ; Callable < String > callable ; if ( kf != null ) { // Check the fltrdMap cache first
FilteredKAMKey key = new FilteredKAMKey ( ki , kf ) ; read . lock ( ) ; try { ret = fltrdMap . get ( key ) ; } finally { read . unlock ( ) ; } if ( ret != null ) { // Cache hit
return ret ; } // Cache miss , create a callable to defer loading
callable = new CacheCallable ( ki , kf ) ; } else { read . lock ( ) ; try { ret = unfltrdMap . get ( ki ) ; } finally { read . unlock ( ) ; } if ( ret != null ) { // Cache hit
return ret ; } // Cache miss , create a callable to defer loading
callable = new CacheCallable ( ki , null ) ; } // Block , waiting for KAM to load
try { ret = execSvc . submit ( callable ) . get ( ) ; } catch ( ExecutionException e ) { throw new KamCacheServiceException ( e ) ; } catch ( InterruptedException e ) { throw new KamCacheServiceException ( e ) ; } return ret ; |
public class SqlUtils { /** * 通过Mapper方法名获取sql */
public static String getMapperSql ( SqlSession session , String fullMapperMethodName , Object ... args ) { } } | if ( args == null || args . length == 0 ) { return getNamespaceSql ( session , fullMapperMethodName , null ) ; } String methodName = fullMapperMethodName . substring ( fullMapperMethodName . lastIndexOf ( '.' ) + 1 ) ; Class < ? > mapperInterface = null ; try { mapperInterface = Class . forName ( fullMapperMethodName . substring ( 0 , fullMapperMethodName . lastIndexOf ( '.' ) ) ) ; return getMapperSql ( session , mapperInterface , methodName , args ) ; } catch ( ClassNotFoundException e ) { throw new IllegalArgumentException ( "参数" + fullMapperMethodName + "无效!" ) ; } |
public class MsgSettingController { /** * Download api .
* @ param req the req
* @ param method the method
* @ param url the url
* @ param res the res */
@ GetMapping ( "/setting/download/api/excel" ) public void downloadApi ( HttpServletRequest req , @ RequestParam ( "method" ) String method , @ RequestParam ( "url" ) String url , HttpServletResponse res ) { } } | this . validationSessionComponent . sessionCheck ( req ) ; url = new String ( Base64 . getDecoder ( ) . decode ( url ) ) ; PoiWorkBook workBook = this . msgExcelService . getExcel ( method , url ) ; workBook . writeFile ( "ValidationApis_" + System . currentTimeMillis ( ) , res ) ; |
public class CoingiAdapters { /** * Adapts a CoingiBalances to an AccountInfo
* @ param coingiBalances The Coingi balance
* @ param userName The user name
* @ return The account info */
public static AccountInfo adaptAccountInfo ( CoingiBalances coingiBalances , String userName ) { } } | List < Balance > balances = new ArrayList < > ( ) ; for ( CoingiBalance coingiBalance : coingiBalances . getList ( ) ) { BigDecimal total = coingiBalance . getAvailable ( ) . add ( coingiBalance . getBlocked ( ) ) . add ( coingiBalance . getWithdrawing ( ) ) . add ( coingiBalance . getDeposited ( ) ) ; Balance xchangeBalance = new Balance ( Currency . getInstance ( coingiBalance . getCurrency ( ) . getName ( ) . toUpperCase ( ) ) , total , // total = available + frozen - borrowed + loaned + withdrawing + depositing
coingiBalance . getAvailable ( ) , // available
coingiBalance . getBlocked ( ) , BigDecimal . ZERO , // borrowed is always 0
BigDecimal . ZERO , // loaned is always 0
coingiBalance . getWithdrawing ( ) , coingiBalance . getDeposited ( ) ) ; balances . add ( xchangeBalance ) ; } return new AccountInfo ( userName , new Wallet ( balances ) ) ; |
public class TransactionHelper { /** * Returns all objects of the given class in persistence context .
* @ param < T >
* type of searched objects
* @ param clazz
* type of searched objects
* @ return list of found objects
* @ throws IllegalArgumentException
* if the instance is not an entity
* @ throws Exception
* selecting objects failed */
public final < T > List < T > loadAllObjects ( final Class < T > clazz ) throws Exception { } } | final Entity entityAnnotation = clazz . getAnnotation ( Entity . class ) ; if ( entityAnnotation == null ) { throw new IllegalArgumentException ( "Unknown entity: " + clazz . getName ( ) ) ; } return executeInTransaction ( new Runnable < List < T > > ( ) { @ Override @ SuppressWarnings ( "unchecked" ) public List < T > run ( final EntityManager entityManager ) { final String fromEntity = entityAnnotation . name ( ) . isEmpty ( ) ? clazz . getSimpleName ( ) : entityAnnotation . name ( ) ; final String alias = fromEntity . toLowerCase ( ) ; return entityManager . createQuery ( "SELECT " + alias + " FROM " + fromEntity + " " + alias ) . getResultList ( ) ; } } ) ; |
public class LocalNetworkGatewaysInner { /** * Updates a local network gateway tags .
* @ param resourceGroupName The name of the resource group .
* @ param localNetworkGatewayName The name of the local network gateway .
* @ param tags Resource tags .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the LocalNetworkGatewayInner object if successful . */
public LocalNetworkGatewayInner beginUpdateTags ( String resourceGroupName , String localNetworkGatewayName , Map < String , String > tags ) { } } | return beginUpdateTagsWithServiceResponseAsync ( resourceGroupName , localNetworkGatewayName , tags ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class TypeRegistry { /** * Determine if something has changed in a particular type related to a particular descriptor and so the dispatcher
* interface should be used . The type registry ID and class ID are merged in the ' ids ' parameter . This method is for
* INVOKEINTERFACE rewrites and so performs additional checks because it assumes the target is an interface .
* Methods on interfaces cannot really ' change ' - the visibility is always public and they are never static . This
* means everything that the descriptor embodies everything about a method interface . Therefore , if something
* changes about the descriptor it is considered an entirely different method ( and the old form is a deleted
* method ) . For this reason there is no need to consider ' changed ' methods , because the static - ness nor visibility
* cannot change .
* @ param ids packed representation of the registryId ( top 16bits ) and typeId ( bottom 16bits )
* @ param nameAndDescriptor the name and descriptor of the method about to be INVOKEINTERFACE ' d
* @ return true if the original method operation must be intercepted */
@ UsedByGeneratedCode public static boolean iincheck ( int ids , String nameAndDescriptor ) { } } | if ( GlobalConfiguration . isRuntimeLogging && log . isLoggable ( Level . FINER ) ) { log . entering ( "TypeRegistry" , "iincheck" , new Object [ ] { ids , nameAndDescriptor } ) ; } int registryId = ids >>> 16 ; int typeId = ids & 0xffff ; TypeRegistry typeRegistry = registryInstances [ registryId ] . get ( ) ; ReloadableType reloadableType = typeRegistry . getReloadableType ( typeId ) ; if ( reloadableType == null ) { reloadableType = searchForReloadableType ( typeId , typeRegistry ) ; } // Check 2 : Info computed earlier
if ( reloadableType != null && ! reloadableType . isAffectedByReload ( ) ) { return false ; } if ( reloadableType != null && reloadableType . hasBeenReloaded ( ) ) { MethodMember method = reloadableType . getLiveVersion ( ) . incrementalTypeDescriptor . getFromLatestByDescriptor ( nameAndDescriptor ) ; boolean dispatchThroughDescriptor = false ; if ( method == null ) { // method does not exist
throw new NoSuchMethodError ( reloadableType . getBaseName ( ) + "." + nameAndDescriptor ) ; } else if ( IncrementalTypeDescriptor . isBrandNewMethod ( method ) ) { // definetly need to use the dispatcher
dispatchThroughDescriptor = true ; } if ( dispatchThroughDescriptor ) { if ( GlobalConfiguration . isRuntimeLogging && log . isLoggable ( Level . FINER ) ) { log . info ( "versionstamp " + reloadableType . getLiveVersion ( ) . versionstamp ) ; log . exiting ( "TypeRegistry" , "iincheck" , true ) ; } return true ; } } if ( GlobalConfiguration . isRuntimeLogging && log . isLoggable ( Level . FINER ) ) { log . exiting ( "TypeRegistry" , "icheck" , false ) ; } return false ; |
public class cacheselector { /** * Use this API to fetch cacheselector resource of given name . */
public static cacheselector get ( nitro_service service , String selectorname ) throws Exception { } } | cacheselector obj = new cacheselector ( ) ; obj . set_selectorname ( selectorname ) ; cacheselector response = ( cacheselector ) obj . get_resource ( service ) ; return response ; |
public class Queue { /** * Pushes a messages onto the queue .
* @ param msg The array of the messages to push .
* @ param delay The message ' s delay in seconds .
* @ return The IDs of new messages
* @ throws io . iron . ironmq . HTTPException If the IronMQ service returns a status other than 200 OK .
* @ throws java . io . IOException If there is an error accessing the IronMQ server . */
public Ids pushMessages ( String [ ] msg , long delay ) throws IOException { } } | ArrayList < Message > messages = new ArrayList < Message > ( ) ; for ( String messageName : msg ) { Message message = new Message ( ) ; message . setBody ( messageName ) ; message . setDelay ( delay ) ; messages . add ( message ) ; } MessagesArrayList msgs = new MessagesArrayList ( messages ) ; IronReader reader = client . post ( "queues/" + name + "/messages" , msgs ) ; Ids ids = gson . fromJson ( reader . reader , Ids . class ) ; reader . close ( ) ; return ids ; |
public class TasksBase { /** * Returns the compact representations of all of the dependents of a task .
* @ param task The task to get dependents on .
* @ return Request object */
public ItemRequest < Task > dependents ( String task ) { } } | String path = String . format ( "/tasks/%s/dependents" , task ) ; return new ItemRequest < Task > ( this , Task . class , path , "GET" ) ; |
public class AddCacheRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AddCacheRequest addCacheRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( addCacheRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( addCacheRequest . getGatewayARN ( ) , GATEWAYARN_BINDING ) ; protocolMarshaller . marshall ( addCacheRequest . getDiskIds ( ) , DISKIDS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class JSONs { /** * Read an expected list of nodes .
* @ param mo the associated model to browse
* @ param o the object to parse
* @ param id the key in the map that points to the list
* @ return the parsed list
* @ throws JSONConverterException if the key does not point to a list of nodes identifiers */
public static List < Node > requiredNodes ( Model mo , JSONObject o , String id ) throws JSONConverterException { } } | checkKeys ( o , id ) ; Object x = o . get ( id ) ; if ( ! ( x instanceof JSONArray ) ) { throw new JSONConverterException ( "integers expected at key '" + id + "'" ) ; } return nodesFromJSON ( mo , ( JSONArray ) x ) ; |
public class HadoopDruidIndexerConfig { /** * Make the intermediate path for this job run .
* @ return the intermediate path for this job run . */
public Path makeIntermediatePath ( ) { } } | return new Path ( StringUtils . format ( "%s/%s/%s_%s" , getWorkingPath ( ) , schema . getDataSchema ( ) . getDataSource ( ) , StringUtils . removeChar ( schema . getTuningConfig ( ) . getVersion ( ) , ':' ) , schema . getUniqueId ( ) ) ) ; |
public class SocketBinding { /** * Create and bind a server socket
* @ return the server socket
* @ throws IOException */
public ServerSocket createServerSocket ( ) throws IOException { } } | final ServerSocket socket = getServerSocketFactory ( ) . createServerSocket ( name ) ; socket . bind ( getSocketAddress ( ) ) ; return socket ; |
public class ProfilingTimer { /** * Same as { @ link # create ( Log , String , Object . . . ) } but logs subtasks as well */
public static ProfilingTimer createLoggingSubtasks ( final Log log , final String processName , final Object ... args ) { } } | return create ( log , false , null , processName , args ) ; |
public class CuckooHashing { /** * Adds an element to one of the tables for Cuckoo Hashing .
* @ param currentElement
* entry to add in a table
* @ param rehash
* if < code > true < / code > the hash table will be rebuild when the
* stash became too big . */
private void fileElement ( Entry < T > currentElement , boolean rehash ) { } } | int maxFailures = Math . max ( ( int ) Math . log ( this . numElements ) , this . numTables * 2 ) ; int currentTable = 0 ; for ( int i = 0 ; i < maxFailures ; i ++ ) { int hash = this . hashfunctions . get ( currentTable ) . hash ( currentElement . getKey ( ) ) ; currentElement = this . tables . get ( currentTable ) . set ( hash , currentElement ) ; if ( currentElement == null ) { break ; } currentTable = ( currentTable + 1 ) % this . numTables ; } if ( currentElement != null ) { this . stash . add ( currentElement ) ; this . stashSize ++ ; } while ( rehash && this . stashSize > this . maxStashSize ) { reset ( ) ; if ( this . stashSize > this . maxStashSize ) { increaseAndReset ( ) ; } } |
public class JobStatistics { /** * Set key value of type double */
public void setValue ( Enum key , double value ) { } } | this . _job . put ( key , Double . toString ( value ) ) ; |
public class WebJarController { /** * Retrieves an asset .
* @ param path the asset path
* @ return the Asset object , or { @ literal null } if the current provider can ' t serve this asset . */
@ Override public Asset < ? > assetAt ( String path ) { } } | List < WebJarLib > candidates = findLibsContaining ( path ) ; if ( candidates . size ( ) == 1 ) { // Perfect ! only one match
return new DefaultAsset < > ( "/libs/" + candidates . get ( 0 ) . name + "/" + candidates . get ( 0 ) . version + "/" + path , candidates . get ( 0 ) . get ( path ) , candidates . get ( 0 ) . toString ( ) , candidates . get ( 0 ) . lastModified ( ) , CacheUtils . computeEtag ( candidates . get ( 0 ) . lastModified ( ) , configuration , crypto ) ) ; } else if ( candidates . size ( ) > 1 ) { // Several candidates
logger ( ) . warn ( "{} WebJars provide '{}' - returning the one from {}-{}" , candidates . size ( ) , path , candidates . get ( 0 ) . name , candidates . get ( 0 ) . version ) ; return new DefaultAsset < > ( "/libs/" + candidates . get ( 0 ) . name + "/" + candidates . get ( 0 ) . version + "/" + path , candidates . get ( 0 ) . get ( path ) , candidates . get ( 0 ) . toString ( ) , candidates . get ( 0 ) . lastModified ( ) , CacheUtils . computeEtag ( candidates . get ( 0 ) . lastModified ( ) , configuration , crypto ) ) ; } else { Matcher matcher = PATTERN . matcher ( path ) ; if ( ! matcher . matches ( ) ) { // It should have been handled by the path match .
return null ; } final String name = matcher . group ( 1 ) ; final String version = matcher . group ( 3 ) ; if ( version != null ) { String rel = matcher . group ( 4 ) ; // We have a name and a version
// Try to find the matching library
WebJarLib lib = find ( name , version ) ; if ( lib != null ) { return new DefaultAsset < > ( rel , lib . get ( rel ) , lib . toString ( ) , lib . lastModified ( ) , CacheUtils . computeEtag ( lib . lastModified ( ) , configuration , crypto ) ) ; } // If not found , it may be because the version is not really the version but a segment of the path .
} // If we reach this point it means that the name / version lookup has failed , try without the version
String rel = matcher . group ( 4 ) ; if ( version != null ) { // We have a group 3
rel = version + "/" + rel ; } List < WebJarLib > libs = find ( name ) ; if ( libs . size ( ) == 1 ) { // Only on library has the given name
if ( libs . get ( 0 ) . contains ( rel ) ) { WebJarLib lib = libs . get ( 0 ) ; return new DefaultAsset < > ( "/libs/" + lib . name + "/" + lib . version + "/" + rel , lib . get ( rel ) , lib . toString ( ) , lib . lastModified ( ) , CacheUtils . computeEtag ( lib . lastModified ( ) , configuration , crypto ) ) ; } } else if ( libs . size ( ) > 1 ) { // Several candidates
WebJarLib higher = null ; ComparableVersion higherVersion = null ; for ( WebJarLib lib : libs ) { if ( lib . contains ( rel ) ) { if ( higher == null ) { higher = lib ; higherVersion = new ComparableVersion ( higher . version ) ; } else { ComparableVersion newVersion = new ComparableVersion ( lib . version ) ; if ( newVersion . compareTo ( higherVersion ) > 0 ) { higher = lib ; higherVersion = new ComparableVersion ( higher . version ) ; } } } } if ( higher != null ) { logger ( ) . warn ( "{} WebJars match the request '{}' - returning the resource from {}-{}" , libs . size ( ) , path , higher . name , higher . version ) ; return new DefaultAsset < > ( "/libs/" + higher . name + "/" + higher . version + "/" + rel , higher . get ( rel ) , higher . toString ( ) , higher . lastModified ( ) , CacheUtils . computeEtag ( higher . lastModified ( ) , configuration , crypto ) ) ; } } return null ; } |
public class LTieFltConsumerBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */
@ Nonnull public static < T > LTieFltConsumer < T > tieFltConsumerFrom ( Consumer < LTieFltConsumerBuilder < T > > buildingFunction ) { } } | LTieFltConsumerBuilder builder = new LTieFltConsumerBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ; |
public class SoapResponseMessageCallback { /** * Callback method called with actual web service response message . Method constructs a Spring Integration
* message from this web service message for further processing . */
public void doWithMessage ( WebServiceMessage responseMessage ) throws IOException , TransformerException { } } | // convert and set response for later access via getResponse ( ) :
response = endpointConfiguration . getMessageConverter ( ) . convertInbound ( responseMessage , endpointConfiguration , context ) ; |
public class AbstractTagLibrary { /** * ( non - Javadoc )
* @ see org . apache . myfaces . view . facelets . tag . TagLibrary # createTagHandler ( java . lang . String , java . lang . String ,
* org . apache . myfaces . view . facelets . tag . TagConfig ) */
public TagHandler createTagHandler ( String ns , String localName , TagConfig tag ) throws FacesException { } } | if ( containsNamespace ( ns ) ) { TagHandlerFactory f = _factories . get ( localName ) ; if ( f != null ) { return f . createHandler ( tag ) ; } } return null ; |
public class IfcBSplineCurveImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public EList < IfcCartesianPoint > getControlPointsList ( ) { } } | return ( EList < IfcCartesianPoint > ) eGet ( Ifc4Package . Literals . IFC_BSPLINE_CURVE__CONTROL_POINTS_LIST , true ) ; |
public class AmazonEC2Client { /** * Describes one or more launch templates .
* @ param describeLaunchTemplatesRequest
* @ return Result of the DescribeLaunchTemplates operation returned by the service .
* @ sample AmazonEC2 . DescribeLaunchTemplates
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / DescribeLaunchTemplates " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public DescribeLaunchTemplatesResult describeLaunchTemplates ( DescribeLaunchTemplatesRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDescribeLaunchTemplates ( request ) ; |
public class StructuredSyntaxDocumentFilter { /** * Parse the Document to update the character styles given an initial start
* position . Called by the filter after it has updated the text .
* @ param offset
* @ param length
* @ throws BadLocationException */
protected void parseDocument ( int offset , int length ) throws BadLocationException { } } | // initialize the segment with the complete document so the segment doesn ' t
// have an underlying gap in the buffer
styledDocument . getText ( 0 , styledDocument . getLength ( ) , segment ) ; buffer = CharBuffer . wrap ( segment . array ) . asReadOnlyBuffer ( ) ; // initialize the lexer if necessary
if ( ! lexer . isInitialized ( ) ) { // prime the parser and reparse whole document
lexer . initialize ( ) ; offset = 0 ; length = styledDocument . getLength ( ) ; } else { int end = offset + length ; offset = calcBeginParse ( offset ) ; length = calcEndParse ( end ) - offset ; // clean the tree by ensuring multi line styles are reset in area
// of parsing
SortedSet set = mlTextRunSet . subSet ( offset , offset + length ) ; if ( set != null ) { set . clear ( ) ; } } // parse the document
lexer . parse ( buffer , offset , length ) ; |
public class Canvas { /** * Draws a subregion of a image { @ code ( sw x sh ) @ ( sx , sy ) } at the specified size
* { @ code ( dw x dh ) } and location { @ code ( dx , dy ) } .
* TODO ( jgw ) : Document whether out - of - bounds source coordinates clamp , repeat , or do nothing . */
public Canvas draw ( Drawable image , float dx , float dy , float dw , float dh , float sx , float sy , float sw , float sh ) { } } | image . draw ( gc ( ) , dx , dy , dw , dh , sx , sy , sw , sh ) ; isDirty = true ; return this ; |
public class Restarter { /** * Start the application .
* @ param failureHandler a failure handler for application that won ' t start
* @ throws Exception in case of errors */
protected void start ( FailureHandler failureHandler ) throws Exception { } } | do { Throwable error = doStart ( ) ; if ( error == null ) { return ; } if ( failureHandler . handle ( error ) == Outcome . ABORT ) { return ; } } while ( true ) ; |
public class TaskTerminateOptions { /** * Set a timestamp indicating the last modified time of the resource known to the client . The operation will be performed only if the resource on the service has been modified since the specified time .
* @ param ifModifiedSince the ifModifiedSince value to set
* @ return the TaskTerminateOptions object itself . */
public TaskTerminateOptions withIfModifiedSince ( DateTime ifModifiedSince ) { } } | if ( ifModifiedSince == null ) { this . ifModifiedSince = null ; } else { this . ifModifiedSince = new DateTimeRfc1123 ( ifModifiedSince ) ; } return this ; |
public class OWLObjectUnionOfImpl_CustomFieldSerializer { /** * Serializes the content of the object into the
* { @ link com . google . gwt . user . client . rpc . SerializationStreamWriter } .
* @ param streamWriter the { @ link com . google . gwt . user . client . rpc . SerializationStreamWriter } to write the
* object ' s content to
* @ param instance the object instance to serialize
* @ throws com . google . gwt . user . client . rpc . SerializationException
* if the serialization operation is not
* successful */
@ Override public void serializeInstance ( SerializationStreamWriter streamWriter , OWLObjectUnionOfImpl instance ) throws SerializationException { } } | serialize ( streamWriter , instance ) ; |
public class ConditionalCheck { /** * Ensures that a readable sequence of { @ code char } values matches a specified pattern . If the given character
* sequence does not match against the passed pattern , an { @ link IllegalPatternArgumentException } will be thrown .
* @ param condition
* condition must be { @ code true } ^ so that the check will be performed
* @ param pattern
* pattern , that the { @ code chars } must correspond to
* @ param chars
* a readable sequence of { @ code char } values which should match the given pattern
* @ param name
* name of object reference ( in source code )
* @ throws IllegalNullArgumentException
* if the given argument { @ code chars } is { @ code null }
* @ throws IllegalPatternArgumentException
* if the given { @ code chars } that does not match the { @ code pattern } */
@ ArgumentsChecked @ Throws ( { } } | IllegalNullArgumentException . class , IllegalPatternArgumentException . class } ) public static < T extends CharSequence > void matchesPattern ( final boolean condition , @ Nonnull final Pattern pattern , @ Nonnull final T chars , @ Nullable final String name ) { if ( condition ) { Check . matchesPattern ( pattern , chars , name ) ; } |
public class DescribeCommentsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeCommentsRequest describeCommentsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeCommentsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeCommentsRequest . getAuthenticationToken ( ) , AUTHENTICATIONTOKEN_BINDING ) ; protocolMarshaller . marshall ( describeCommentsRequest . getDocumentId ( ) , DOCUMENTID_BINDING ) ; protocolMarshaller . marshall ( describeCommentsRequest . getVersionId ( ) , VERSIONID_BINDING ) ; protocolMarshaller . marshall ( describeCommentsRequest . getLimit ( ) , LIMIT_BINDING ) ; protocolMarshaller . marshall ( describeCommentsRequest . getMarker ( ) , MARKER_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class TransactionEventListener { /** * Adds the { @ code List } of { @ code MeterValue } s to the { @ code Transaction } .
* @ param transaction the { @ code Transaction } to which to add the { @ code MeterValue } s .
* @ param meterValues the { @ code List } of { @ code MeterValue } s to add . */
private void addMeterValuesToTransaction ( final Transaction transaction , final List < MeterValue > meterValues ) { } } | for ( MeterValue meterValue : meterValues ) { addMeterValueToTransaction ( transaction , meterValue ) ; } |
public class AWSCodePipelineClient { /** * Provides information to AWS CodePipeline about new revisions to a source .
* @ param putActionRevisionRequest
* Represents the input of a PutActionRevision action .
* @ return Result of the PutActionRevision operation returned by the service .
* @ throws PipelineNotFoundException
* The specified pipeline was specified in an invalid format or cannot be found .
* @ throws StageNotFoundException
* The specified stage was specified in an invalid format or cannot be found .
* @ throws ActionNotFoundException
* The specified action cannot be found .
* @ throws ValidationException
* The validation was specified in an invalid format .
* @ sample AWSCodePipeline . PutActionRevision
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / codepipeline - 2015-07-09 / PutActionRevision " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public PutActionRevisionResult putActionRevision ( PutActionRevisionRequest request ) { } } | request = beforeClientExecution ( request ) ; return executePutActionRevision ( request ) ; |
public class NTLMResponses { /** * Calculates the NTLMv2 Response for the given challenge , using the
* specified authentication target , username , password , target information
* block , and client nonce .
* @ param target The authentication target ( i . e . , domain ) .
* @ param user The username .
* @ param password The user ' s password .
* @ param targetInformation The target information block from the Type 2
* message .
* @ param challenge The Type 2 challenge from the server .
* @ param clientNonce The random 8 - byte client nonce .
* @ return The NTLMv2 Response . */
public static byte [ ] getNTLMv2Response ( String target , String user , String password , byte [ ] targetInformation , byte [ ] challenge , byte [ ] clientNonce ) throws Exception { } } | return getNTLMv2Response ( target , user , password , targetInformation , challenge , clientNonce , System . currentTimeMillis ( ) ) ; |
public class MouseMoveAwt { /** * Teleport mouse with robot .
* @ param nx The new X .
* @ param ny The new Y . */
void robotTeleport ( int nx , int ny ) { } } | oldX = nx ; oldY = ny ; x = nx ; y = ny ; wx = nx ; wy = ny ; mx = 0 ; my = 0 ; moved = false ; |
public class BitVector { /** * a , b not null a size not greater than b size */
private static int compareNumeric ( BitVector a , BitVector b ) { } } | final int aSize = a . size ( ) ; final int bSize = b . size ( ) ; if ( aSize != bSize && ! b . isAllZerosAdj ( b . finish - bSize + aSize , b . finish ) ) return - 1 ; // more optimizations are possible but probably not worthwhile
if ( a . isAligned ( ) && b . isAligned ( ) ) { int pos = aSize & ~ ADDRESS_MASK ; if ( pos != aSize ) { int bits = aSize - pos ; long aBits = a . getBitsAdj ( pos , bits ) ; long bBits = b . getBitsAdj ( pos , bits ) ; if ( aBits != bBits ) { return aBits < bBits ? - 1 : 1 ; } } final long [ ] aArr = a . bits ; final long [ ] bArr = b . bits ; for ( int i = ( pos >> ADDRESS_BITS ) - 1 ; i >= 0 ; i -- ) { long aBits = aArr [ i ] ; long bBits = bArr [ i ] ; if ( aBits == bBits ) continue ; boolean aNeg = aBits < 0L ; boolean bNeg = bBits < 0L ; if ( bNeg && ! aNeg ) return - 1 ; if ( aNeg && ! bNeg ) return 1 ; return aBits < bBits ? - 1 : 1 ; } return 0 ; } else { final int aStart = a . start ; final int bStart = b . start ; int offset ; for ( offset = aSize - ADDRESS_SIZE ; offset >= 0 ; offset -= ADDRESS_SIZE ) { long aBits = a . getBitsAdj ( offset + aStart , ADDRESS_SIZE ) ; long bBits = b . getBitsAdj ( offset + bStart , ADDRESS_SIZE ) ; if ( aBits == bBits ) continue ; boolean aNeg = aBits < 0L ; boolean bNeg = bBits < 0L ; if ( bNeg && ! aNeg ) return - 1 ; if ( aNeg && ! bNeg ) return 1 ; return aBits < bBits ? - 1 : 1 ; } if ( offset != 0 ) { long aBits = a . getBitsAdj ( aStart , ADDRESS_SIZE + offset ) ; long bBits = b . getBitsAdj ( bStart , ADDRESS_SIZE + offset ) ; if ( aBits == bBits ) return 0 ; return aBits < bBits ? - 1 : 1 ; } return 0 ; } |
public class CmsSecurityManager { /** * Returns a List of all siblings of the specified resource ,
* the specified resource being always part of the result set . < p >
* @ param context the request context
* @ param resource the specified resource
* @ param filter a filter object
* @ return a list of < code > { @ link CmsResource } < / code > s that
* are siblings to the specified resource ,
* including the specified resource itself
* @ throws CmsException if something goes wrong */
public List < CmsResource > readSiblings ( CmsRequestContext context , CmsResource resource , CmsResourceFilter filter ) throws CmsException { } } | List < CmsResource > result = null ; CmsDbContext dbc = m_dbContextFactory . getDbContext ( context ) ; try { result = m_driverManager . readSiblings ( dbc , resource , filter ) ; } catch ( Exception e ) { dbc . report ( null , Messages . get ( ) . container ( Messages . ERR_READ_SIBLINGS_1 , context . getSitePath ( resource ) ) , e ) ; } finally { dbc . clear ( ) ; } return result ; |
public class DeviceProxy { public void setPipeConfig ( PipeInfo pipeInfo ) throws DevFailed { } } | ArrayList < PipeInfo > infoList = new ArrayList < PipeInfo > ( 1 ) ; infoList . add ( pipeInfo ) ; setPipeConfig ( infoList ) ; |
public class MultiKindFeedParser { /** * Parses the given HTTP response using the given feed class and entry classes .
* @ param < T > feed type
* @ param < E > entry type
* @ param response HTTP response
* @ param namespaceDictionary XML namespace dictionary
* @ param feedClass feed class
* @ param entryClasses entry class
* @ return Atom multi - kind feed pull parser
* @ throws IOException I / O exception
* @ throws XmlPullParserException XML pull parser exception */
public static < T , E > MultiKindFeedParser < T > create ( HttpResponse response , XmlNamespaceDictionary namespaceDictionary , Class < T > feedClass , Class < E > ... entryClasses ) throws IOException , XmlPullParserException { } } | InputStream content = response . getContent ( ) ; try { Atom . checkContentType ( response . getContentType ( ) ) ; XmlPullParser parser = Xml . createParser ( ) ; parser . setInput ( content , null ) ; MultiKindFeedParser < T > result = new MultiKindFeedParser < T > ( namespaceDictionary , parser , content , feedClass ) ; result . setEntryClasses ( entryClasses ) ; return result ; } finally { content . close ( ) ; } |
public class AbstractDatabaseEngine { /** * Adds an entity to the engine . It will create tables and everything necessary so persistence can work .
* @ param entity The entity to add .
* @ param recovering True if entities are being add due to recovery .
* @ throws DatabaseEngineException If something goes wrong while creating the structures . */
private void addEntity ( DbEntity entity , boolean recovering ) throws DatabaseEngineException { } } | if ( ! recovering ) { try { getConnection ( ) ; } catch ( final Exception e ) { throw new DatabaseEngineException ( "Could not add entity" , e ) ; } validateEntity ( entity ) ; if ( entities . containsKey ( entity . getName ( ) ) ) { throw new DatabaseEngineException ( String . format ( "Entity '%s' is already defined" , entity . getName ( ) ) ) ; } if ( this . properties . isSchemaPolicyDropCreate ( ) ) { dropEntity ( entity ) ; } } if ( ! this . properties . isSchemaPolicyNone ( ) ) { createTable ( entity ) ; addPrimaryKey ( entity ) ; addFks ( entity ) ; addIndexes ( entity ) ; addSequences ( entity ) ; } loadEntity ( entity ) ; |
public class MkLocalShuffer { /** * Don ' t need to take care of multiple thread racing condition , one thread per task */
private void refreshLocalNodeTasks ( ) { } } | Set < Integer > localNodeTasks = workerData . getLocalNodeTasks ( ) ; if ( localNodeTasks == null || localNodeTasks . equals ( lastLocalNodeTasks ) ) { return ; } LOG . info ( "Old localNodeTasks:" + lastLocalNodeTasks + ", new:" + localNodeTasks ) ; lastLocalNodeTasks = localNodeTasks ; List < Integer > localNodeOutTasks = new ArrayList < > ( ) ; for ( Integer outTask : allTargetTasks ) { if ( localNodeTasks . contains ( outTask ) ) { localNodeOutTasks . add ( outTask ) ; } } if ( ! localNodeOutTasks . isEmpty ( ) ) { this . outTasks = localNodeOutTasks ; } randomrange = new RandomRange ( outTasks . size ( ) ) ; |
public class JmsJcaReferenceUtilsImpl { /** * Dynamically populates the reference that it has been given using the
* properties currently stored in this ConnectionFactory . Note that this way
* of doing things automatically handles the adding of extra properties
* without the need to change this code .
* @ param reference
* the reference to populate
* @ param properties
* the properties to populate the reference with
* @ param defaults
* the default set of properties to be used ( if properties in theProps are set to
* these defaults , they will be omitted from the reference ) */
public void populateReference ( final Reference reference , final Map properties , final Map defaults ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "populateReference" , new Object [ ] { reference , properties , defaults } ) ; } // Make sure no - one can pull the rug from beneath us .
synchronized ( properties ) { // Convert the map of properties into an encoded form , where the
// keys have the necessary prefix on the front , and the values are
// all Strings .
Map < String , String > encodedMap = getStringEncodedMap ( properties , defaults ) ; for ( Map . Entry < String , String > entry : encodedMap . entrySet ( ) ) { reference . add ( new StringRefAddr ( entry . getKey ( ) , entry . getValue ( ) ) ) ; } } // sync
if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "populateReference" ) ; } |
public class OutputUtilities { /** * Creates a Map < String , String > with the RETURN _ CODE Success ( 0 ) , and the RETURN _ RESULT the returnResult string value
* @ param returnResult the return result
* @ return a Map < String , String > with the RETURN _ CODE Success ( 0 ) , and the RETURN _ RESULT the returnResult string value */
@ NotNull public static Map < String , String > getSuccessResultsMap ( @ NotNull final String returnResult ) { } } | final Map < String , String > results = new HashMap < > ( ) ; results . put ( OutputNames . RETURN_CODE , ReturnCodes . SUCCESS ) ; results . put ( OutputNames . RETURN_RESULT , returnResult ) ; return results ; |
public class DefaultGoApiResponse { /** * Creates an instance DefaultGoApiResponse which represents incomplete request with response code 412
* @ param responseBody Response body
* @ return an instance of DefaultGoApiResponse */
public static DefaultGoApiResponse incompleteRequest ( String responseBody ) { } } | DefaultGoApiResponse defaultGoApiResponse = new DefaultGoApiResponse ( 412 ) ; defaultGoApiResponse . setResponseBody ( responseBody ) ; return defaultGoApiResponse ; |
public class PatriciaTrieFormatter { /** * Format trie and write to file
* @ param trie trie to format
* @ param file file to write to
* @ param formatBitString true if the bits for this key should be included in the node
* @ throws FileNotFoundException if the file exists but is a directory rather than a regular file ,
* does not exist but cannot be created , or cannot be opened for any other reason */
public void format ( PatriciaTrie < V > trie , File file , boolean formatBitString ) throws FileNotFoundException { } } | PrintWriter writer = new PrintWriter ( new FileOutputStream ( file ) ) ; writer . println ( format ( trie , formatBitString ) ) ; writer . close ( ) ; |
public class vpntrafficaction { /** * Use this API to fetch filtered set of vpntrafficaction resources .
* filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */
public static vpntrafficaction [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } } | vpntrafficaction obj = new vpntrafficaction ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; vpntrafficaction [ ] response = ( vpntrafficaction [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class BlobStoreWriter { /** * Call this to cancel before finishing the data . */
public void cancel ( ) { } } | try { // FileOutputStream is also closed cascadingly
if ( outStream != null ) { outStream . close ( ) ; outStream = null ; } // Clear encryptor :
encryptor = null ; } catch ( IOException e ) { Log . w ( Log . TAG_BLOB_STORE , "Exception closing buffered output stream" , e ) ; } tempFile . delete ( ) ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcMaterialLayer ( ) { } } | if ( ifcMaterialLayerEClass == null ) { ifcMaterialLayerEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 309 ) ; } return ifcMaterialLayerEClass ; |
public class StateSaver { /** * Save the state of the given view and the other state inside of the returned { @ link Parcelable } .
* @ param target The view containing fields annotated with { @ link State } .
* @ param state The super state of the parent class of the view . Usually it isn ' t { @ code null } .
* @ return A parcelable containing the view ' s state and its super state . */
@ NonNull public static < T extends View > Parcelable saveInstanceState ( @ NonNull T target , @ Nullable Parcelable state ) { } } | return IMPL . saveInstanceState ( target , state ) ; |
public class PersistenceApi { /** * Entity exists
* Find Managed Entity by primary Key within Partition ( optional ) and determine if it exists
* @ param request Managed Entity Request Object ( required )
* @ return ApiResponse & lt ; Boolean & gt ;
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiResponse < Boolean > existsWithIdPostWithHttpInfo ( FindRequest request ) throws ApiException { } } | com . squareup . okhttp . Call call = existsWithIdPostValidateBeforeCall ( request , null , null ) ; Type localVarReturnType = new TypeToken < Boolean > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class PowerShell { /** * Execute a single command in PowerShell console and gets result
* @ param command the command to execute
* @ return response with the output of the command */
public static PowerShellResponse executeSingleCommand ( String command ) { } } | PowerShellResponse response = null ; try ( PowerShell session = PowerShell . openSession ( ) ) { response = session . executeCommand ( command ) ; } catch ( PowerShellNotAvailableException ex ) { logger . log ( Level . SEVERE , "PowerShell not available" , ex ) ; } return response ; |
public class MaterialListValueBox { /** * Returns all selected values of the list box , or empty array if none .
* @ return the selected values of the list box */
public String [ ] getItemsSelected ( ) { } } | List < String > selected = new LinkedList < > ( ) ; for ( int i = getIndexOffset ( ) ; i < listBox . getItemCount ( ) ; i ++ ) { if ( listBox . isItemSelected ( i ) ) { selected . add ( listBox . getValue ( i ) ) ; } } return selected . toArray ( new String [ selected . size ( ) ] ) ; |
public class AWTTerminalFontConfiguration { /** * Returns the default font to use depending on the platform
* @ return Default font to use , system - dependent */
protected static Font [ ] selectDefaultFont ( ) { } } | String osName = System . getProperty ( "os.name" , "" ) . toLowerCase ( ) ; if ( osName . contains ( "win" ) ) { List < Font > windowsFonts = getDefaultWindowsFonts ( ) ; return windowsFonts . toArray ( new Font [ windowsFonts . size ( ) ] ) ; } else if ( osName . contains ( "linux" ) ) { List < Font > linuxFonts = getDefaultLinuxFonts ( ) ; return linuxFonts . toArray ( new Font [ linuxFonts . size ( ) ] ) ; } else { List < Font > defaultFonts = getDefaultFonts ( ) ; return defaultFonts . toArray ( new Font [ defaultFonts . size ( ) ] ) ; } |
public class DescribeRaidArraysResult { /** * A < code > RaidArrays < / code > object that describes the specified RAID arrays .
* @ return A < code > RaidArrays < / code > object that describes the specified RAID arrays . */
public java . util . List < RaidArray > getRaidArrays ( ) { } } | if ( raidArrays == null ) { raidArrays = new com . amazonaws . internal . SdkInternalList < RaidArray > ( ) ; } return raidArrays ; |
public class CreatePublicDnsNamespaceRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CreatePublicDnsNamespaceRequest createPublicDnsNamespaceRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( createPublicDnsNamespaceRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createPublicDnsNamespaceRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( createPublicDnsNamespaceRequest . getCreatorRequestId ( ) , CREATORREQUESTID_BINDING ) ; protocolMarshaller . marshall ( createPublicDnsNamespaceRequest . getDescription ( ) , DESCRIPTION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class FormLayout { /** * Distributes free space over columns and rows and returns the sizes after this distribution
* process .
* @ param formSpecs the column / row specifications to work with
* @ param totalSize the total available size
* @ param totalPrefSize the sum of all preferred sizes
* @ param inputSizes the input sizes
* @ return the distributed sizes */
private static int [ ] distributedSizes ( List formSpecs , int totalSize , int totalPrefSize , int [ ] inputSizes ) { } } | double totalFreeSpace = totalSize - totalPrefSize ; // Do nothing if there ' s no free space .
if ( totalFreeSpace < 0 ) { return inputSizes ; } // Compute the total weight .
int count = formSpecs . size ( ) ; double totalWeight = 0.0 ; for ( int i = 0 ; i < count ; i ++ ) { FormSpec formSpec = ( FormSpec ) formSpecs . get ( i ) ; totalWeight += formSpec . getResizeWeight ( ) ; } // Do nothing if there ' s no resizing column .
if ( totalWeight == 0.0 ) { return inputSizes ; } int [ ] sizes = new int [ count ] ; double restSpace = totalFreeSpace ; int roundedRestSpace = ( int ) totalFreeSpace ; for ( int i = 0 ; i < count ; i ++ ) { FormSpec formSpec = ( FormSpec ) formSpecs . get ( i ) ; double weight = formSpec . getResizeWeight ( ) ; if ( weight == FormSpec . NO_GROW ) { sizes [ i ] = inputSizes [ i ] ; } else { double roundingCorrection = restSpace - roundedRestSpace ; double extraSpace = totalFreeSpace * weight / totalWeight ; double correctedExtraSpace = extraSpace - roundingCorrection ; int roundedExtraSpace = ( int ) Math . round ( correctedExtraSpace ) ; sizes [ i ] = inputSizes [ i ] + roundedExtraSpace ; restSpace -= extraSpace ; roundedRestSpace -= roundedExtraSpace ; } } return sizes ; |
public class ClientBuilder { /** * Creates a builder which is pre - configured from a { @ link KubeConfig } .
* < p > To load a < tt > KubeConfig < / tt > , see { @ link KubeConfig # loadKubeConfig ( Reader ) } .
* @ param config The { @ link KubeConfig } to configure the builder from .
* @ return < tt > ClientBuilder < / tt > configured from the provided < tt > KubeConfig < / tt >
* @ throws IOException if the files specified in the provided < tt > KubeConfig < / tt > are not readable */
public static ClientBuilder kubeconfig ( KubeConfig config ) throws IOException { } } | final ClientBuilder builder = new ClientBuilder ( ) ; String server = config . getServer ( ) ; if ( ! server . contains ( "://" ) ) { if ( server . contains ( ":443" ) ) { server = "https://" + server ; } else { server = "http://" + server ; } } final byte [ ] caBytes = KubeConfig . getDataOrFile ( config . getCertificateAuthorityData ( ) , config . getCertificateAuthorityFile ( ) ) ; if ( caBytes != null ) { builder . setCertificateAuthority ( caBytes ) ; } builder . setVerifyingSsl ( config . verifySSL ( ) ) ; builder . setBasePath ( server ) ; builder . setAuthentication ( new KubeconfigAuthentication ( config ) ) ; return builder ; |
public class FilesImpl { /** * Deletes the specified task file from the compute node where the task ran .
* @ param jobId The ID of the job that contains the task .
* @ param taskId The ID of the task whose file you want to delete .
* @ param filePath The path to the task file or directory that you want to delete .
* @ param recursive Whether to delete children of a directory . If the filePath parameter represents a directory instead of a file , you can set recursive to true to delete the directory and all of the files and subdirectories in it . If recursive is false then the directory must be empty or deletion will fail .
* @ param fileDeleteFromTaskOptions Additional parameters for the operation
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceResponseWithHeaders } object if successful . */
public Observable < Void > deleteFromTaskAsync ( String jobId , String taskId , String filePath , Boolean recursive , FileDeleteFromTaskOptions fileDeleteFromTaskOptions ) { } } | return deleteFromTaskWithServiceResponseAsync ( jobId , taskId , filePath , recursive , fileDeleteFromTaskOptions ) . map ( new Func1 < ServiceResponseWithHeaders < Void , FileDeleteFromTaskHeaders > , Void > ( ) { @ Override public Void call ( ServiceResponseWithHeaders < Void , FileDeleteFromTaskHeaders > response ) { return response . body ( ) ; } } ) ; |
public class MapModel { /** * Update the visibility of the layers .
* @ param event
* change event */
public void onMapViewChanged ( MapViewChangedEvent event ) { } } | for ( Layer < ? > layer : layers ) { layer . updateShowing ( ) ; // If the map is resized quickly after a previous resize , tile requests are sent out , but when they come
// back , the world - to - pan matrix will have altered , and so the tiles are placed at the wrong positions . . . .
// so we clear the store .
if ( layer instanceof RasterLayer && event . isMapResized ( ) ) { ( ( RasterLayer ) layer ) . getStore ( ) . clear ( ) ; } } |
public class BaseStore { /** * Create an { @ code OperationObserver } using { @ code this } for the context .
* @ param name name of the statistic
* @ param outcome class of the possible outcomes
* @ param canBeDisabled if this statistic can be disabled by a { @ link StoreStatisticsConfiguration }
* @ param < T > type of the outcome
* @ return the created observer */
protected < T extends Enum < T > > OperationObserver < T > createObserver ( String name , Class < T > outcome , boolean canBeDisabled ) { } } | if ( ! operationStatisticsEnabled && canBeDisabled ) { return ZeroOperationStatistic . get ( ) ; } return operation ( outcome ) . named ( name ) . of ( this ) . tag ( getStatisticsTag ( ) ) . build ( ) ; |
public class BuildInfoProvider { /** * Parses { @ code hazelcast - runtime . properties } for { @ code BuildInfo } ; also checks for overrides in System . properties .
* Never cache result of this method in a static context - as it can change due versions overriding - this method
* already does caching whenever it ' s possible - i . e . when overrides is disabled .
* @ return the parsed BuildInfo */
public static BuildInfo getBuildInfo ( ) { } } | if ( Overrides . isEnabled ( ) ) { // never use cache when override is enabled - > we need to re - parse everything
Overrides overrides = Overrides . fromProperties ( ) ; return getBuildInfoInternalVersion ( overrides ) ; } return BUILD_INFO_CACHE ; |
public class FutureConverter { /** * Converts { @ link ListenableFuture } to { @ link io . reactivex . Single } .
* The original future is canceled upon unsubscribe . */
public static < T > Single < T > toSingle ( ListenableFuture < T > listenableFuture ) { } } | return RxJava2FutureUtils . createSingle ( SpringFutureUtils . createValueSource ( listenableFuture ) ) ; |
public class ProcessGroovyMethods { /** * Gets the output and error streams from a process and reads them
* to keep the process from blocking due to a full output buffer .
* The processed stream data is appended to the supplied Appendable .
* For this , two Threads are started , but join ( ) ed , so we wait .
* As implied by the waitFor . . . name , we also wait until we finish
* as well . Finally , the input , output and error streams are closed .
* @ param self a Process
* @ param output an Appendable to capture the process stdout
* @ param error an Appendable to capture the process stderr
* @ since 1.7.5 */
public static void waitForProcessOutput ( Process self , Appendable output , Appendable error ) { } } | Thread tout = consumeProcessOutputStream ( self , output ) ; Thread terr = consumeProcessErrorStream ( self , error ) ; try { tout . join ( ) ; } catch ( InterruptedException ignore ) { } try { terr . join ( ) ; } catch ( InterruptedException ignore ) { } try { self . waitFor ( ) ; } catch ( InterruptedException ignore ) { } closeStreams ( self ) ; |
public class VirtualMachineScaleSetRollingUpgradesInner { /** * Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image OS version . Instances which are already running the latest available OS version are not affected .
* @ param resourceGroupName The name of the resource group .
* @ param vmScaleSetName The name of the VM scale set .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the OperationStatusResponseInner object */
public Observable < OperationStatusResponseInner > beginStartOSUpgradeAsync ( String resourceGroupName , String vmScaleSetName ) { } } | return beginStartOSUpgradeWithServiceResponseAsync ( resourceGroupName , vmScaleSetName ) . map ( new Func1 < ServiceResponse < OperationStatusResponseInner > , OperationStatusResponseInner > ( ) { @ Override public OperationStatusResponseInner call ( ServiceResponse < OperationStatusResponseInner > response ) { return response . body ( ) ; } } ) ; |
public class LauncherModel { /** * Compute the vector used for launch .
* @ param vector The initial vector used for launch .
* @ return The vector used for launch . */
private Force computeVector ( Force vector ) { } } | if ( target != null ) { return computeVector ( vector , target ) ; } vector . setDestination ( vector . getDirectionHorizontal ( ) , vector . getDirectionVertical ( ) ) ; return vector ; |
public class DefaultFastFileStorageClient { /** * 根据传入比例生成缩略图
* @ param inputStream
* @ param thumbImage
* @ return
* @ throws IOException */
private ByteArrayInputStream generateThumbImageByPercent ( InputStream inputStream , ThumbImage thumbImage ) throws IOException { } } | LOGGER . debug ( "根据传入比例生成缩略图" ) ; // 在内存当中生成缩略图
ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; // @ formatter : off
Thumbnails . of ( inputStream ) . scale ( thumbImage . getPercent ( ) ) . toOutputStream ( out ) ; // @ formatter : on
return new ByteArrayInputStream ( out . toByteArray ( ) ) ; |
public class Logger { /** * Log a message at the WARN level .
* @ param marker The marker specific to this log statement
* @ param message the message string to be logged
* @ param object the argument
* @ since 1.0.0 */
public void warn ( final Marker marker , final String message , final Object object ) { } } | log . warn ( marker , sanitize ( message ) , object ) ; |
public class Properties { /** * Associates the specified map with the specified property key . If the properties previously contained a mapping for the property key , the old
* value is replaced by the specified map .
* @ param < K >
* the type of keys maintained by the map
* @ param < V >
* the type of mapped values
* @ param property
* the property key with which the specified map is to be associated
* @ param value
* the map to be associated with the specified property key */
public < K , V > void set ( PropertyMapKey < K , V > property , Map < K , V > value ) { } } | properties . put ( property . getName ( ) , value ) ; |
public class CmsModuleManager { /** * Initializes the list of export points from all configured modules . < p > */
private synchronized void initModuleExportPoints ( ) { } } | Set < CmsExportPoint > exportPoints = new HashSet < CmsExportPoint > ( ) ; Iterator < CmsModule > i = m_modules . values ( ) . iterator ( ) ; while ( i . hasNext ( ) ) { CmsModule module = i . next ( ) ; List < CmsExportPoint > moduleExportPoints = module . getExportPoints ( ) ; for ( int j = 0 ; j < moduleExportPoints . size ( ) ; j ++ ) { CmsExportPoint point = moduleExportPoints . get ( j ) ; if ( exportPoints . contains ( point ) ) { if ( LOG . isWarnEnabled ( ) ) { LOG . warn ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_DUPLICATE_EXPORT_POINT_2 , point , module . getName ( ) ) ) ; } } else { exportPoints . add ( point ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_ADD_EXPORT_POINT_2 , point , module . getName ( ) ) ) ; } } } } m_moduleExportPoints = Collections . unmodifiableSet ( exportPoints ) ; |
public class MurmurHash3v2 { /** * Self mix of k1
* @ param k1 input argument
* @ return mix */
private static long mixK1 ( long k1 ) { } } | k1 *= C1 ; k1 = Long . rotateLeft ( k1 , 31 ) ; k1 *= C2 ; return k1 ; |
public class ExpressRoutePortsInner { /** * Update ExpressRoutePort tags .
* @ param resourceGroupName The name of the resource group .
* @ param expressRoutePortName The name of the ExpressRoutePort resource .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the ExpressRoutePortInner object if successful . */
public ExpressRoutePortInner beginUpdateTags ( String resourceGroupName , String expressRoutePortName ) { } } | return beginUpdateTagsWithServiceResponseAsync ( resourceGroupName , expressRoutePortName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class BureauRegistry { /** * Registers a launcher for a given type . When an agent is started and no bureaus are
* running , the < code > bureauType < / code > is used to determine the < code > Launcher < / code >
* instance to call . If the launched bureau does not connect within the given number of
* milliseconds , it will be logged as an error and future attempts to launch the bureau
* will invoke the < code > launch < / code > method again .
* @ param bureauType the type of bureau that will be launched
* @ param launcher the launcher to be used for bureaus of < code > bureauType < / code >
* @ param timeout milliseconds to wait for the bureau or 0 to wait forever */
public void setLauncher ( String bureauType , Launcher launcher , int timeout ) { } } | if ( _launchers . get ( bureauType ) != null ) { log . warning ( "Launcher for type already exists" , "type" , bureauType ) ; return ; } _launchers . put ( bureauType , new LauncherEntry ( launcher , timeout ) ) ; |
public class AuthLocalSessionDataFactory { /** * / * ( non - Javadoc )
* @ see org . jdiameter . common . api . app . IAppSessionDataFactory # getAppSessionData ( java . lang . Class , java . lang . String ) */
@ Override public IAuthSessionData getAppSessionData ( Class < ? extends AppSession > clazz , String sessionId ) { } } | if ( clazz . equals ( ClientAuthSession . class ) ) { ClientAuthSessionDataLocalImpl data = new ClientAuthSessionDataLocalImpl ( ) ; data . setSessionId ( sessionId ) ; return data ; } else if ( clazz . equals ( ServerAuthSession . class ) ) { ServerAuthSessionDataLocalImpl data = new ServerAuthSessionDataLocalImpl ( ) ; data . setSessionId ( sessionId ) ; return data ; } throw new IllegalArgumentException ( clazz . toString ( ) ) ; |
public class GDLHandler { /** * Append the given GDL string to the current database .
* @ param asciiString GDL string ( must not be { @ code null } ) . */
public void append ( String asciiString ) { } } | if ( asciiString == null ) { throw new IllegalArgumentException ( "AsciiString must not be null" ) ; } ANTLRInputStream antlrInputStream = new ANTLRInputStream ( asciiString ) ; GDLLexer lexer = new GDLLexer ( antlrInputStream ) ; GDLParser parser = new GDLParser ( new CommonTokenStream ( lexer ) ) ; // update the loader state while walking the parse tree
new ParseTreeWalker ( ) . walk ( loader , parser . database ( ) ) ; |
public class Escrows { /** * This method allows you to release a payment with escrow .
* @ param escrowId
* { @ code String } the Moip escrow external ID .
* @ param setup
* { @ code Setup } the setup object .
* @ return { @ code Map < String , Object > } */
public Map < String , Object > release ( String escrowId , Setup setup ) { } } | this . requestMaker = new RequestMaker ( setup ) ; RequestProperties props = new RequestPropertiesBuilder ( ) . method ( "POST" ) . endpoint ( String . format ( "%s/%s/release" , ENDPOINT , escrowId ) ) . type ( Escrows . class ) . contentType ( CONTENT_TYPE ) . build ( ) ; return this . requestMaker . doRequest ( props ) ; |
public class CompletableFuture { /** * Waits if necessary for this future to complete , and then
* returns its result .
* @ return the result value
* @ throws CancellationException if this future was cancelled
* @ throws ExecutionException if this future completed exceptionally
* @ throws InterruptedException if the current thread was interrupted
* while waiting */
public T get ( ) throws InterruptedException , ExecutionException { } } | Object r ; return reportGet ( ( r = result ) == null ? waitingGet ( true ) : r ) ; |
public class TypesafeConfigUtils { /** * Get list of sub - configurations . Return { @ code null } if missing or wrong type .
* @ param config
* @ param path
* @ return */
public static Optional < List < ? extends Config > > getConfigListOptional ( Config config , String path ) { } } | return Optional . ofNullable ( getConfigList ( config , path ) ) ; |
public class TrustedAdvisorResourcesSummaryMarshaller { /** * Marshall the given parameter object . */
public void marshall ( TrustedAdvisorResourcesSummary trustedAdvisorResourcesSummary , ProtocolMarshaller protocolMarshaller ) { } } | if ( trustedAdvisorResourcesSummary == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( trustedAdvisorResourcesSummary . getResourcesProcessed ( ) , RESOURCESPROCESSED_BINDING ) ; protocolMarshaller . marshall ( trustedAdvisorResourcesSummary . getResourcesFlagged ( ) , RESOURCESFLAGGED_BINDING ) ; protocolMarshaller . marshall ( trustedAdvisorResourcesSummary . getResourcesIgnored ( ) , RESOURCESIGNORED_BINDING ) ; protocolMarshaller . marshall ( trustedAdvisorResourcesSummary . getResourcesSuppressed ( ) , RESOURCESSUPPRESSED_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Checks { /** * Performs emptiness and nullness check .
* @ param reference reference to check
* @ param errorMessage the exception message to use if the check fails ; will
* be converted to a string using { @ link String # valueOf ( Object ) }
* @ param < T > the reference type
* @ return the checked reference
* @ throws IllegalArgumentException if the { @ code reference } is empty
* @ throws NullPointerException if the { @ code reference } is null
* @ see # checkNotEmpty ( Object , String , Object . . . ) */
public static < T > T checkNotEmpty ( T reference , @ Nullable Object errorMessage ) { } } | checkNotEmpty ( reference , String . valueOf ( errorMessage ) , EMPTY_ERROR_MESSAGE_ARGS ) ; return reference ; |
public class Asserts { /** * Checks that a class has a no - argument private constructor and calls that
* constructor to instantiate the class ( usually for code coverage
* purposes ) .
* @ param < T >
* type of class being checked
* @ param cls
* class being checked */
static void assertConstructorIsPrivateAndCall ( Class < ? > cls ) { } } | Constructor < ? > constructor ; try { constructor = cls . getDeclaredConstructor ( ) ; } catch ( NoSuchMethodException e1 ) { throw new RuntimeException ( "private constructor without arguments not found" , e1 ) ; } catch ( SecurityException e1 ) { throw new RuntimeException ( e1 ) ; } assertTrue ( "constructor is not private" , Modifier . isPrivate ( constructor . getModifiers ( ) ) ) ; constructor . setAccessible ( true ) ; try { constructor . newInstance ( ) ; } catch ( InstantiationException e ) { throw new RuntimeException ( e ) ; } catch ( IllegalAccessException e ) { throw new RuntimeException ( e ) ; } catch ( IllegalArgumentException e ) { throw new RuntimeException ( e ) ; } catch ( InvocationTargetException e ) { // don ' t care if constructor threw an exception !
} |
public class PDIndexerManager { /** * Queue a new work item
* @ param aParticipantID
* Participant ID to use .
* @ param eType
* Action type .
* @ param sOwnerID
* Owner of this action
* @ param sRequestingHost
* Requesting host ( IP address )
* @ return { @ link EChange # UNCHANGED } if the item was queued ,
* { @ link EChange # UNCHANGED } if this item is already in the queue ! */
@ Nonnull public EChange queueWorkItem ( @ Nonnull final IParticipantIdentifier aParticipantID , @ Nonnull final EIndexerWorkItemType eType , @ Nonnull @ Nonempty final String sOwnerID , @ Nonnull @ Nonempty final String sRequestingHost ) { } } | // Build item
final IIndexerWorkItem aWorkItem = new IndexerWorkItem ( aParticipantID , eType , sOwnerID , sRequestingHost ) ; // And queue it
return _queueUniqueWorkItem ( aWorkItem ) ; |
public class Encoder { /** * Encode the given object into a series of statements and expressions .
* The implementation simply finds the < code > PersistenceDelegate < / code > responsible for the object ' s class , and delegate the call to it .
* @ param o
* the object to encode */
protected void writeObject ( Object o ) { } } | if ( o == null ) { return ; } getPersistenceDelegate ( o . getClass ( ) ) . writeObject ( o , this ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.