signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class RandomUtil { /** * 随机字母 , 固定长度 */
public static String randomLetterFixLength ( Random random , int length ) { } } | return RandomStringUtils . random ( length , 0 , 0 , true , false , null , random ) ; |
public class MsgpackIOUtil { /** * Serializes the { @ code message } using the given { @ code schema } . */
public static < T > byte [ ] toByteArray ( T message , Schema < T > schema , boolean numeric ) { } } | ArrayBufferOutput out = new ArrayBufferOutput ( ) ; try { writeTo ( out , message , schema , numeric ) ; } catch ( IOException e ) { throw new RuntimeException ( "Serializing to a byte array threw an IOException" , e ) ; } return out . toByteArray ( ) ; |
public class OperaProxy { /** * Parse an instance of { @ link Proxy } , merge and apply its configuration to the current Opera
* instance . */
public void parse ( Proxy proxy ) { } } | if ( proxy . getProxyType ( ) == Proxy . ProxyType . UNSPECIFIED ) { return ; } reset ( ) ; switch ( proxy . getProxyType ( ) ) { case DIRECT : if ( ! product . is ( MOBILE ) ) { setEnabled ( false ) ; } setUsePAC ( false ) ; break ; case MANUAL : if ( ! product . is ( MOBILE ) ) { setEnabled ( true ) ; } setUsePAC ( f... |
public class Slidr { /** * Attach a slideable mechanism to an activity that adds the slide to dismiss functionality
* and allows for the statusbar to transition between colors
* @ param activity the activity to attach the slider to
* @ param statusBarColor1 the primaryDark status bar color of the interface that t... | // Setup the slider panel and attach it to the decor
final SliderPanel panel = attachSliderPanel ( activity , null ) ; // Set the panel slide listener for when it becomes closed or opened
panel . setOnPanelSlideListener ( new ColorPanelSlideListener ( activity , statusBarColor1 , statusBarColor2 ) ) ; // Return the loc... |
public class PluginWrapper { /** * Returns the URL of the index page jelly script . */
public URL getIndexPage ( ) { } } | // In the current impl dependencies are checked first , so the plugin itself
// will add the last entry in the getResources result .
URL idx = null ; try { Enumeration < URL > en = classLoader . getResources ( "index.jelly" ) ; while ( en . hasMoreElements ( ) ) idx = en . nextElement ( ) ; } catch ( IOException ignore... |
public class StringIterate { /** * For each token in a string separated by the specified separator , execute the specified StringProcedure
* by calling the valueOfString method . */
public static void forEachToken ( String string , String separator , Procedure < String > procedure ) { } } | for ( StringTokenizer stringTokenizer = new StringTokenizer ( string , separator ) ; stringTokenizer . hasMoreTokens ( ) ; ) { String token = stringTokenizer . nextToken ( ) ; procedure . value ( token ) ; } |
public class QuickStart { /** * Main launcher for the QuickStart example . */
public static void main ( String [ ] args ) throws InterruptedException { } } | TagContextBuilder tagContextBuilder = tagger . currentBuilder ( ) . put ( FRONTEND_KEY , TagValue . create ( "mobile-ios9.3.5" ) ) ; SpanBuilder spanBuilder = tracer . spanBuilder ( "my.org/ProcessVideo" ) . setRecordEvents ( true ) . setSampler ( Samplers . alwaysSample ( ) ) ; viewManager . registerView ( VIDEO_SIZE_... |
public class AWSSimpleSystemsManagementClient { /** * Modifies the target of an existing Maintenance Window . You can ' t change the target type , but you can change the
* following :
* The target from being an ID target to a Tag target , or a Tag target to an ID target .
* IDs for an ID target .
* Tags for a T... | request = beforeClientExecution ( request ) ; return executeUpdateMaintenanceWindowTarget ( request ) ; |
public class CircuitBreaker { /** * Wrap the given service call with the { @ link CircuitBreaker }
* protection logic .
* @ param r the { @ link Runnable } to attempt
* @ throws CircuitBreakerException if the
* breaker was OPEN or HALF _ CLOSED and this attempt wasn ' t the
* reset attempt
* @ throws Except... | if ( ! byPass ) { if ( ! allowRequest ( ) ) { throw mapException ( new CircuitBreakerException ( ) ) ; } try { isAttemptLive = true ; r . run ( ) ; close ( ) ; return ; } catch ( Throwable cause ) { handleFailure ( cause ) ; } throw new IllegalStateException ( "not possible" ) ; } else { r . run ( ) ; } |
public class AutoMlClient { /** * Imports data into a dataset . For Tables this method can only be called on an empty Dataset .
* < p > For Tables : & # 42 ; A
* [ schema _ inference _ version ] [ google . cloud . automl . v1beta1 . InputConfig . params ] parameter must be
* explicitly set . Returns an empty resp... | ImportDataRequest request = ImportDataRequest . newBuilder ( ) . setName ( name == null ? null : name . toString ( ) ) . setInputConfig ( inputConfig ) . build ( ) ; return importDataAsync ( request ) ; |
public class ValueCollectionFactory { /** * Returns corresponding { @ link MultiMapConfig . ValueCollectionType } of a { @ link java . util . Collection }
* @ param collection { @ link MultiMapConfig . ValueCollectionType } to be find
* @ return corresponding { @ link MultiMapConfig . ValueCollectionType } of a { @... | if ( collection instanceof Set ) { return MultiMapConfig . ValueCollectionType . SET ; } else if ( collection instanceof List ) { return MultiMapConfig . ValueCollectionType . LIST ; } throw new IllegalArgumentException ( "[" + collection . getClass ( ) + "] is not a known MultiMapConfig.ValueCollectionType!" ) ; |
public class ST_Graph { /** * Create the nodes and edges tables from the input table containing
* LINESTRINGs in the given column .
* If the input table has name ' input ' , then the output tables are named
* ' input _ nodes ' and ' input _ edges ' .
* @ param connection Connection
* @ param tableName Input t... | // The default tolerance is zero .
return createGraph ( connection , tableName , spatialFieldName , 0.0 ) ; |
public class NodeSchema { /** * Append the provided schema to this schema and return the result
* as a new schema . Columns order : [ this ] [ provided schema columns ] . */
NodeSchema join ( NodeSchema schema ) { } } | NodeSchema copy = this . clone ( ) ; for ( SchemaColumn column : schema . getColumns ( ) ) { copy . addColumn ( column . clone ( ) ) ; } return copy ; |
public class BunyanFormatter { /** * { @ inheritDoc } */
@ Override public String format ( LogRecord record ) { } } | final JsonObject jsonEvent = new JsonObject ( ) ; jsonEvent . addProperty ( "v" , 0 ) ; jsonEvent . addProperty ( "level" , BUNYAN_LEVEL . get ( record . getLevel ( ) ) ) ; jsonEvent . addProperty ( "name" , record . getLoggerName ( ) ) ; jsonEvent . addProperty ( "hostname" , HOSTNAME ) ; jsonEvent . addProperty ( "pi... |
public class ArgumentUnitUtils { /** * Extract properties from { @ code properties } field of the given argument unit
* @ param argumentUnit argument unit
* @ return properties
* @ throws IllegalArgumentException if argumentUnit is null */
public static Properties getProperties ( ArgumentUnit argumentUnit ) throw... | if ( argumentUnit == null ) { throw new IllegalArgumentException ( "argumentUnit is null" ) ; } return stringToProperties ( argumentUnit . getProperties ( ) ) ; |
public class AbstractVersionIdentifier { /** * This method performs the part of { @ link # compareTo ( VersionIdentifier ) } for the
* { @ link # getVersionSegment ( int ) version number } .
* @ param otherVersion is the { @ link VersionIdentifier } to compare to .
* @ return the result of comparison . */
private... | // Example version : 1.2.3.4
// Direct successors : 1.2.3.5 / 1.2.4 [ . 0 ] / 1.3 . [ . 0 [ . 0 ] ] / 2 . [ . 0 [ . 0 [ . 0 ] ] ]
// Direct predecessors : 1.2.3.3 [ . * ]
boolean equivalent = true ; int result = 0 ; int maxSegmentCount = StrictMath . max ( getVersionSegmentCount ( ) , otherVersion . getVersionSegmentCo... |
public class ValueReferenceScanner { /** * Scan given class and look for possible references annotated by given annotation
* @ param < H > Only field or method annotated with this annotation is inspected
* @ param expectedAnnotation Only field or method annotated with this annotation is inspected
* @ param listen... | BeanInfo beanInfo ; try { beanInfo = Introspector . getBeanInfo ( beanType ) ; } catch ( IntrospectionException e ) { throw new RuntimeException ( "Can't get bean info of " + beanType ) ; } for ( PropertyDescriptor desc : beanInfo . getPropertyDescriptors ( ) ) { AccessibleObject access = findAnnotatedAccess ( desc , e... |
public class ProfilingFilter { /** * SAX methods */
@ Override public void startElement ( final String uri , final String localName , final String qName , final Attributes atts ) throws SAXException { } } | Set < Flag > flags = null ; final DitaClass cls = atts . getValue ( ATTRIBUTE_NAME_CLASS ) != null ? new DitaClass ( atts . getValue ( ATTRIBUTE_NAME_CLASS ) ) : new DitaClass ( "" ) ; if ( cls . isValid ( ) && ( TOPIC_TOPIC . matches ( cls ) || MAP_MAP . matches ( cls ) ) ) { final String domains = atts . getValue ( A... |
public class ServerManager { /** * Stop the server and clear all
* @ throws DevFailed */
public void stop ( ) throws DevFailed { } } | try { if ( isStarted . get ( ) ) { tangoClasses . clear ( ) ; if ( tangoExporter != null ) { tangoExporter . clearClass ( ) ; tangoExporter . unexportAll ( ) ; } TangoCacheManager . shutdown ( ) ; EventManager . getInstance ( ) . close ( ) ; if ( monitoring != null ) { monitoring . stop ( ) ; } } } finally { ORBManager... |
public class ColorPicker { /** * Convert a color to an angle .
* @ param color The RGB value of the color to " find " on the color wheel .
* @ return The angle ( in rad ) the " normalized " color is displayed on the
* color wheel . */
private float colorToAngle ( int color ) { } } | float [ ] colors = new float [ 3 ] ; Color . colorToHSV ( color , colors ) ; return ( float ) Math . toRadians ( - colors [ 0 ] ) ; |
public class Compiler { /** * Compile a location path . The LocPathIterator itself may create
* { @ link org . apache . xpath . axes . AxesWalker } children .
* @ param opPos The current position in the m _ opMap array .
* @ return reference to { @ link org . apache . xpath . axes . LocPathIterator } instance .
... | locPathDepth ++ ; try { DTMIterator iter = WalkerFactory . newDTMIterator ( this , opPos , ( locPathDepth == 0 ) ) ; return ( Expression ) iter ; // cast OK , I guess .
} finally { locPathDepth -- ; } |
public class AbstractSecurityAuthorizationTable { /** * ( non - Javadoc )
* @ see com . ibm . ws . security . authorization . AuthorizationTableService # isAuthzInfoAvailableForApp ( java . lang . String ) */
@ Override public boolean isAuthzInfoAvailableForApp ( String appName ) { } } | if ( roles != null && ! roles . isEmpty ( ) ) return true ; else return false ; |
public class Entry { /** * Returns a newly - created { @ link Entry } of a JSON file .
* @ param revision the revision of the JSON file
* @ param path the path of the JSON file
* @ param content the content of the JSON file
* @ throws JsonParseException if the { @ code content } is not a valid JSON */
public st... | return ofJson ( revision , path , Jackson . readTree ( content ) ) ; |
public class PathEndsWithOneOf { /** * Get a new < code > PathEndsWithOneOf < / code > that will accept only URIs whose suffix is one of the allowed suffixes
* @ param spec a string containing the allowed suffixes ( separated by ' , ' )
* @ return a new < code > PathEndsWithOneOf < / code > that will accept only UR... | return new PathEndsWithOneOf ( Iterables . toArray ( SPLITTER . split ( spec ) , String . class ) ) ; |
public class PathResolver { /** * resolve symlinks to a path that could be the bin directory of the cloud sdk */
@ VisibleForTesting static void getLocationsFromLink ( List < String > possiblePaths , Path link ) { } } | try { Path resolvedLink = link . toRealPath ( ) ; Path possibleBinDir = resolvedLink . getParent ( ) ; // check if the parent is " bin " , we actually depend on that for other resolution
if ( possibleBinDir != null && possibleBinDir . getFileName ( ) . toString ( ) . equals ( "bin" ) ) { Path possibleCloudSdkHome = pos... |
public class CustomAPI { /** * 删除客服帐号
* @ param accountName 客服帐号名
* @ return 删除结果 */
public ResultType deleteCustomAccount ( String accountName ) { } } | LOG . debug ( "删除客服帐号信息......" ) ; String url = BASE_API_URL + "customservice/kfaccount/del?access_token=#&kf_account=" + accountName ; BaseResponse response = executePost ( url , null ) ; return ResultType . get ( response . getErrcode ( ) ) ; |
public class SDVariable { /** * Maximum array reduction operation , optionally along specified dimensions < br >
* Note that if keepDims = true , the output variable has the same rank as the input variable ,
* with the reduced dimensions having size 1 . This can be useful for later broadcast operations ( such as su... | return sameDiff . max ( name , this , keepDims , dimensions ) ; |
public class CacheUnitImpl { /** * This implements the method in the CacheUnit interface .
* This is called to create event source object .
* It calls ObjectCacheUnit to perform this operation .
* @ param createAsyncEventSource boolean true - using async thread context for callback ; false - using caller thread f... | if ( objectCacheUnit == null ) { throw new DynamicCacheServiceNotStarted ( "Object cache service has not been started." ) ; } return objectCacheUnit . createEventSource ( createAsyncEventSource , cacheName ) ; |
public class DirectedAcyclicGraph { /** * Convenience method for easily constructing an instance of { @ link IGraph } with an empty set of vertices .
* @ param < TVertex > Type of { @ link IVertex } of the vertices in the new { @ link IGraph } .
* @ return A new instance of { @ link IGraph } with an empty set of ve... | return build ( ( TVertex [ ] ) null ) ; |
public class XPath { /** * Returns a function view of this { @ code XPath } expression that produces a { @ code List < T > }
* result given an input object . If this { @ code XPath } is lenient , evaluation of the function
* will return an empty list on failure , rather than throwing an
* { @ link IllegalArgument... | Preconditions . checkNotNull ( resultClass ) ; return new Function < Object , List < T > > ( ) { @ Override public List < T > apply ( @ Nullable final Object object ) { Preconditions . checkNotNull ( object ) ; return eval ( object , resultClass ) ; } } ; |
public class JapaneseDate { /** * Returns a copy of this date with the year altered .
* This method changes the year of the date .
* If the month - day is invalid for the year , then the previous valid day
* will be selected instead .
* This instance is immutable and unaffected by this method call .
* @ param... | int year = JapaneseChronology . INSTANCE . prolepticYear ( era , yearOfEra ) ; return with ( isoDate . withYear ( year ) ) ; |
public class BackupSelectionMarshaller { /** * Marshall the given parameter object . */
public void marshall ( BackupSelection backupSelection , ProtocolMarshaller protocolMarshaller ) { } } | if ( backupSelection == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( backupSelection . getSelectionName ( ) , SELECTIONNAME_BINDING ) ; protocolMarshaller . marshall ( backupSelection . getIamRoleArn ( ) , IAMROLEARN_BINDING ) ; protocolM... |
public class KeyUtils { /** * TODO If the given keys have different length the function will not give the right result . */
public static int compareKey ( byte [ ] key1 , byte [ ] key2 , int length ) { } } | return Bytes . compareTo ( key1 , 0 , length , key2 , 0 , length ) ; |
public class ServersInner { /** * List all the servers in a given resource group .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ return the observable to the List & lt ; ServerInner & gt ; obj... | return listByResourceGroupWithServiceResponseAsync ( resourceGroupName ) . map ( new Func1 < ServiceResponse < List < ServerInner > > , Page < ServerInner > > ( ) { @ Override public Page < ServerInner > call ( ServiceResponse < List < ServerInner > > response ) { PageImpl < ServerInner > page = new PageImpl < > ( ) ; ... |
public class WorkBookAccesser { /** * 获取指定sheet的指定行列单元格
* @ param column 单元格所在列
* @ param row 单元格所在行
* @ return 指定行列的单元格 */
public Cell getCell ( int column , int row ) { } } | return this . workbook . getSheetAt ( sheetIndex ) . getRow ( row ) . getCell ( column ) ; |
public class DataLabelingServiceClient { /** * Creates an instruction for how data should be labeled .
* < p > Sample code :
* < pre > < code >
* try ( DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient . create ( ) ) {
* String formattedParent = DataLabelingServiceClient . formatPr... | PROJECT_PATH_TEMPLATE . validate ( parent , "createInstruction" ) ; CreateInstructionRequest request = CreateInstructionRequest . newBuilder ( ) . setParent ( parent ) . setInstruction ( instruction ) . build ( ) ; return createInstructionAsync ( request ) ; |
public class SrvShoppingCart { /** * < p > Create OnlineBuyer . < / p >
* @ param pRqVs additional param
* @ param pRqDt Request Data
* @ return buyer
* @ throws Exception - an exception */
public final OnlineBuyer createOnlineBuyer ( final Map < String , Object > pRqVs , final IRequestData pRqDt ) throws Excep... | OnlineBuyer buyer = null ; List < OnlineBuyer > brs = getSrvOrm ( ) . retrieveListWithConditions ( pRqVs , OnlineBuyer . class , "where FRE=1 and REGISTEREDPASSWORD is null" ) ; if ( brs . size ( ) > 0 ) { double rd = Math . random ( ) ; if ( rd > 0.5 ) { buyer = brs . get ( brs . size ( ) - 1 ) ; } else { buyer = brs ... |
public class PasswordFilter { /** * / * ( non - Javadoc )
* @ see java . util . logging . Logger # logrb ( java . util . logging . Level , java . lang . String , java . lang . String , java . util . ResourceBundle , java . lang . String , java . lang . Object [ ] ) */
@ Override public void logrb ( Level level , Stri... | super . logrb ( level , sourceClass , sourceMethod , bundle , maskPassword ( msg ) , params ) ; |
public class MemberUpdater { /** * Synchronize organization membership of a user from a list of ALM organization specific ids
* Please note that no commit will not be executed . */
public void synchronizeUserOrganizationMembership ( DbSession dbSession , UserDto user , ALM alm , Set < String > organizationAlmIds ) { ... | Set < String > userOrganizationUuids = dbClient . organizationMemberDao ( ) . selectOrganizationUuidsByUser ( dbSession , user . getId ( ) ) ; Set < String > userOrganizationUuidsWithMembersSyncEnabled = dbClient . organizationAlmBindingDao ( ) . selectByOrganizationUuids ( dbSession , userOrganizationUuids ) . stream ... |
public class RpcConfigs { /** * Gets string value .
* @ param primaryKey the primary key
* @ return the string value */
public static String getStringValue ( String primaryKey ) { } } | String val = ( String ) CFG . get ( primaryKey ) ; if ( val == null ) { throw new SofaRpcRuntimeException ( "Not Found Key: " + primaryKey ) ; } else { return val ; } |
public class QueryableStateClient { /** * Shuts down the client and waits until shutdown is completed .
* < p > If an exception is thrown , a warning is logged containing
* the exception message . */
public void shutdownAndWait ( ) { } } | try { client . shutdown ( ) . get ( ) ; LOG . info ( "The Queryable State Client was shutdown successfully." ) ; } catch ( Exception e ) { LOG . warn ( "The Queryable State Client shutdown failed: " , e ) ; } |
public class CmsVfsFileWidget { /** * Checks whether the given type list contains only folder types . < p >
* @ param types the type list
* @ return < code > true < / code > if the given type list contains only folder types */
private boolean isOnlyFolders ( String types ) { } } | boolean result = true ; for ( String type : types . split ( "[, ]+" ) ) { try { if ( ! OpenCms . getResourceManager ( ) . getResourceType ( type ) . isFolder ( ) ) { result = false ; break ; } } catch ( CmsLoaderException e ) { // ignore
} } return result ; |
public class MarkLogicRepositoryConnection { /** * remove without commit
* supplied to honor interface
* @ param subject
* @ param predicate
* @ param object
* @ param contexts
* @ throws RepositoryException */
@ Override protected void removeWithoutCommit ( Resource subject , URI predicate , Value object ,... | remove ( subject , predicate , object , contexts ) ; |
public class Phaser { /** * Implementation of register , bulkRegister
* @ param registrations number to add to both parties and
* unarrived fields . Must be greater than zero . */
private int doRegister ( int registrations ) { } } | // adjustment to state
long adjust = ( ( long ) registrations << PARTIES_SHIFT ) | registrations ; final Phaser parent = this . parent ; int phase ; for ( ; ; ) { long s = ( parent == null ) ? state : reconcileState ( ) ; int counts = ( int ) s ; int parties = counts >>> PARTIES_SHIFT ; int unarrived = counts & UNARRIV... |
public class OBOOntology { /** * Look up a term by name , and return its ID and the IDs of all of its
* ancestors .
* @ param s
* The term name to look up .
* @ return The full set of IDs , empty if the term was not found . */
public Set < String > getIdsForTermWithAncestors ( String s ) { } } | if ( ! indexByName . containsKey ( s ) ) return new HashSet < String > ( ) ; Stack < String > idsToConsider = new Stack < String > ( ) ; idsToConsider . addAll ( getIdsForTerm ( s ) ) ; Set < String > resultIds = new HashSet < String > ( ) ; while ( ! idsToConsider . isEmpty ( ) ) { String id = idsToConsider . pop ( ) ... |
public class BlobContainersInner { /** * Creates a new container under the specified account as described by request body . The container resource includes metadata and properties for that container . It does not include a list of the blobs contained by the container .
* @ param resourceGroupName The name of the reso... | return ServiceFuture . fromResponse ( createWithServiceResponseAsync ( resourceGroupName , accountName , containerName ) , serviceCallback ) ; |
public class ServiceTicketRequestWebflowEventResolver { /** * Grant service ticket for the given credential based on the service and tgt
* that are found in the request context .
* @ param context the context
* @ return the resulting event . Warning , authentication failure or error .
* @ since 4.1.0 */
protect... | val ticketGrantingTicketId = WebUtils . getTicketGrantingTicketId ( context ) ; val credential = getCredentialFromContext ( context ) ; try { val service = WebUtils . getService ( context ) ; val authn = getWebflowEventResolutionConfigurationContext ( ) . getTicketRegistrySupport ( ) . getAuthenticationFrom ( ticketGra... |
public class MLFeatureUtils { /** * Generates a vector of regression outputs for every record
* @ param data
* @ return */
public static double [ ] toRegressionOutputVector ( Iterable < MLRegressionRecord > data ) { } } | final Stream < MLRegressionRecord > stream = StreamSupport . stream ( data . spliterator ( ) , false ) ; return stream . mapToDouble ( MLRegressionRecord :: getRegressionOutput ) . toArray ( ) ; |
public class DecimalFormatSymbols { /** * < strong > [ icu ] < / strong > Sets the string used for permille sign .
* < b > Note : < / b > When the input permille String is represented
* by multiple Java chars , then { @ link # getPerMill ( ) } will
* return the default permille character ( ' & # x2030 ; ' ) .
*... | if ( perMillString == null ) { throw new NullPointerException ( "The input permille string is null" ) ; } this . perMillString = perMillString ; if ( perMillString . length ( ) == 1 ) { this . perMill = perMillString . charAt ( 0 ) ; } else { // Use the default permille character as fallback
this . perMill = DEF_PERMIL... |
public class PlainDate { /** * / * [ deutsch ]
* < p > Entspricht { @ code at ( PlainTime . of ( hour , minute , second ) ) } . < / p >
* @ param hour hour of day in range ( 0-24)
* @ param minute minute of hour in range ( 0-59)
* @ param second second of hour in range ( 0-59)
* @ return local timestamp as co... | return this . at ( PlainTime . of ( hour , minute , second ) ) ; |
public class Icon { /** * Initializes this { @ link Icon } . Called from the icon this one depends on , copying the < b > baseIcon < / b > values .
* @ param baseIcon the base icon
* @ param width the width
* @ param height the height
* @ param x the x
* @ param y the y
* @ param rotated the rotated */
prot... | copyFrom ( baseIcon ) ; |
public class NearestNeighborsClient { /** * Add the specified authentication header to the specified HttpRequest
* @ param request HTTP Request to add the authentication header to */
protected HttpRequest addAuthHeader ( HttpRequest request ) { } } | if ( authToken != null ) { request . header ( "authorization" , "Bearer " + authToken ) ; } return request ; |
public class JwtWebSecurityConfigurer { /** * Configures application authorization for JWT signed with RS256.
* Will try to validate the token using the public key downloaded from " $ issuer / . well - known / jwks . json "
* and matched by the value of { @ code kid } of the JWT header
* @ param audience identifi... | "WeakerAccess" , "SameParameterValue" } ) public static JwtWebSecurityConfigurer forRS256 ( String audience , String issuer ) { final JwkProvider jwkProvider = new JwkProviderBuilder ( issuer ) . build ( ) ; return new JwtWebSecurityConfigurer ( audience , issuer , new JwtAuthenticationProvider ( jwkProvider , issuer ,... |
public class WebElementFinder { /** * Creates an new { @ link WebElementFinder } based on this { @ link WebElementFinder } restricting the enabled status of elements .
* @ param theEnabled
* { @ code true } if elements must be enabled , { @ code false } if elements must not be enabled
* @ return the new { @ link ... | Fields fields = new Fields ( this ) ; fields . enabled = theEnabled ; return new WebElementFinder ( fields ) ; |
public class KeyUtils { /** * Generates a { @ link RangeHashFunction } .
* @ param min
* the minimal value to expect
* @ param max
* the maximal value to expect
* @ param buckets
* the number of buckets
* @ param suffix
* the suffix for all files
* @ param prefix
* a prefix for all files
* @ retur... | String [ ] Sbuckets = new String [ buckets ] ; for ( int i = 0 ; i < buckets ; i ++ ) { Sbuckets [ i ] = i + "" ; } return generateRangeHashFunction ( min , max , Sbuckets , suffix , prefix ) ; |
public class S3StorageProvider { /** * Adds content to a hidden space .
* @ param spaceId hidden spaceId
* @ param contentId
* @ param contentMimeType
* @ param content
* @ return */
public String addHiddenContent ( String spaceId , String contentId , String contentMimeType , InputStream content ) { } } | log . debug ( "addHiddenContent(" + spaceId + ", " + contentId + ", " + contentMimeType + ")" ) ; // Will throw if bucket does not exist
String bucketName = getBucketName ( spaceId ) ; // Wrap the content in order to be able to retrieve a checksum
if ( contentMimeType == null || contentMimeType . equals ( "" ) ) { cont... |
public class JavaProxyFactory { /** * public static Object createProxy ( Config config , Component cfc , String className ) throws
* PageException , IOException { return createProxy ( cfc , null ,
* ClassUtil . loadClass ( config . getClassLoader ( ) , className ) ) ; } */
public static Object createProxy ( PageCon... | PageContextImpl pci = ( PageContextImpl ) pc ; // ( ( ConfigImpl ) pci . getConfig ( ) ) . getClassLoaderEnv ( )
ClassLoader [ ] parents = extractClassLoaders ( null , interfaces ) ; if ( extendz == null ) extendz = Object . class ; if ( interfaces == null ) interfaces = new Class [ 0 ] ; else { for ( int i = 0 ; i < i... |
public class Branch { /** * < p > Gets the credit history of the specified bucket and triggers a callback to handle the
* response . < / p >
* @ param bucket A { @ link String } value containing the name of the referral bucket that the
* code will belong to .
* @ param callback A { @ link BranchListResponseList... | getCreditHistory ( bucket , null , 100 , CreditHistoryOrder . kMostRecentFirst , callback ) ; |
public class DeadAssignmentsElimination { /** * Determines if any local variables are dead after the instruction { @ code n }
* and are assigned within the subtree of { @ code n } . Removes those assignments
* if there are any .
* @ param n Target instruction .
* @ param exprRoot The CFG node where the liveness... | Node parent = n . getParent ( ) ; boolean isDeclarationNode = NodeUtil . isNameDeclaration ( parent ) ; if ( NodeUtil . isAssignmentOp ( n ) || n . isInc ( ) || n . isDec ( ) || isDeclarationNode ) { if ( parent . isConst ( ) ) { // Removing the RHS of a const produces as invalid AST .
return ; } Node lhs = isDeclarati... |
public class MockSecurityGroupController { /** * Delete MockSecurityGroup .
* @ param securityGroupId
* securityGroupId to be deleted
* @ return MockSecurityGroup . */
public MockSecurityGroup deleteSecurityGroup ( final String securityGroupId ) { } } | if ( securityGroupId != null && allMockSecurityGroup . containsKey ( securityGroupId ) ) { return allMockSecurityGroup . remove ( securityGroupId ) ; } return null ; |
public class DocumentSession { /** * Query the specified index using Lucene syntax
* @ param clazz The result of the query */
public < T > IDocumentQuery < T > documentQuery ( Class < T > clazz ) { } } | return documentQuery ( clazz , null , null , false ) ; |
public class KeyStoreManager { /** * Adds the keyStore to the keyStoreMap .
* @ param keyStoreName
* @ param ks
* @ throws Exception */
public void addKeyStoreToMap ( String keyStoreName , WSKeyStore ks ) throws Exception { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "addKeyStoreToMap: " + keyStoreName + ", ks=" + ks ) ; if ( keyStoreMap . containsKey ( keyStoreName ) ) keyStoreMap . remove ( keyStoreName ) ; keyStoreMap . put ( keyStoreName , ks ) ; if ( TraceComponent . isAnyTracingEnable... |
public class CheckboxTreeNodeChildren { /** * Optimized set implementation to be used in sorting
* @ param index index of the element to replace
* @ param node node to be stored at the specified position
* @ return the node previously at the specified position */
@ Override public TreeNode setSibling ( int index ... | if ( node == null ) { throw new NullPointerException ( ) ; } else if ( ( index < 0 ) || ( index >= size ( ) ) ) { throw new IndexOutOfBoundsException ( ) ; } else { if ( ! parent . equals ( node . getParent ( ) ) ) { eraseParent ( node ) ; } TreeNode previous = get ( index ) ; super . set ( index , node ) ; node . setP... |
public class CmsJlanNetworkFile { /** * Adds the name of a child resource to this file ' s path . < p >
* @ param child the child resource
* @ return the path of the child */
protected String getFullChildPath ( CmsResource child ) { } } | String childName = child . getName ( ) ; String sep = getFullName ( ) . endsWith ( "\\" ) ? "" : "\\" ; return getFullName ( ) + sep + childName ; |
public class GCBEZRGImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . GCBEZRG__XPOS : setXPOS ( XPOS_EDEFAULT ) ; return ; case AfplibPackage . GCBEZRG__YPOS : setYPOS ( YPOS_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ; |
public class UEL { /** * Casts context objects per documented convention .
* @ param < T >
* @ param context
* @ param key
* @ param defaultValue
* @ return T */
public static < T > T getContext ( ELContext context , Class < T > key , T defaultValue ) { } } | @ SuppressWarnings ( "unchecked" ) final T result = ( T ) context . getContext ( key ) ; return result == null ? defaultValue : result ; |
public class RetryingOAuth { /** * Returns true if the access token has been updated */
public synchronized boolean updateAccessToken ( String requestAccessToken ) throws IOException { } } | if ( getAccessToken ( ) == null || getAccessToken ( ) . equals ( requestAccessToken ) ) { try { OAuthJSONAccessTokenResponse accessTokenResponse = oAuthClient . accessToken ( tokenRequestBuilder . buildBodyMessage ( ) ) ; if ( accessTokenResponse != null && accessTokenResponse . getAccessToken ( ) != null ) { setAccess... |
public class ImageInfoSpecific { @ Nonnull public static ImageInfoSpecific qcow2 ( @ Nonnull ImageInfoSpecificQCow2 qcow2 ) { } } | ImageInfoSpecific self = new ImageInfoSpecific ( ) ; self . type = Discriminator . qcow2 ; self . qcow2 = qcow2 ; return self ; |
public class StringProperties { /** * GET with MapExpression */
private final String eval ( final String str ) throws InvalidExpression { } } | if ( str == null ) return null ; return new MapExpression ( str , null , mapper , false ) . eval ( ) . get ( ) ; |
public class ScriptRunner { /** * Invokes the script defined by the specified element with the specified
* < code > TaskRequest < / code > .
* @ param m An < code > Element < / code > that defines a Task .
* @ param req A < code > TaskRequest < / code > prepared externally .
* @ return The < code > TaskResponse... | // Assertions .
if ( m == null ) { String msg = "Argument 'm [Element]' cannot be null." ; throw new IllegalArgumentException ( msg ) ; } return run ( compileTask ( m ) , req ) ; |
public class EntryIterator { /** * region Helpers */
private CompletableFuture < PageWrapper > locateNextPage ( TimeoutTimer timer ) { } } | if ( this . lastPage . get ( ) == null ) { // This is our very first invocation . Find the page containing the first key .
return this . locatePage . apply ( this . firstKey , this . pageCollection , timer ) ; } else { // We already have a pointer to a page ; find next page .
return getNextLeafPage ( timer ) ; } |
public class PageContextImpl { /** * Proprietary method to evaluate EL expressions . XXX - This method should
* go away once the EL interpreter moves out of JSTL and into its own
* project . For now , this is necessary because the standard machinery is too
* slow .
* @ param expression
* The expression to be ... | Object retValue ; ExpressionFactory exprFactorySetInPageContext = ( ExpressionFactory ) pageContext . getAttribute ( Constants . JSP_EXPRESSION_FACTORY_OBJECT ) ; if ( exprFactorySetInPageContext == null ) { exprFactorySetInPageContext = JspFactory . getDefaultFactory ( ) . getJspApplicationContext ( pageContext . getS... |
public class DefaultAWSCloudClient { /** * / * If the instance is tagged with correct */
private boolean isInstanceTagged ( Instance currInstance ) { } } | List < Tag > tags = currInstance . getTags ( ) ; if ( settings . getValidTagKey ( ) . isEmpty ( ) ) return false ; for ( Tag currTag : tags ) { for ( String tagKey : settings . getValidTagKey ( ) ) { if ( currTag . getKey ( ) . equals ( tagKey ) ) return true ; } } return false ; |
public class CmsRelationSystemValidator { /** * Validates the relations against the online project . < p >
* The result is printed to the given report . < p >
* Validating references means to answer the question , whether
* we would have broken links in the online project if the given
* publish list would get p... | // check if progress should be set in the thread
A_CmsProgressThread thread = null ; if ( Thread . currentThread ( ) instanceof A_CmsProgressThread ) { thread = ( A_CmsProgressThread ) Thread . currentThread ( ) ; } Map < String , List < CmsRelation > > invalidResources = new HashMap < String , List < CmsRelation > > (... |
public class PollingState { /** * Sets the polling status .
* @ param status the polling status .
* @ param statusCode the HTTP status code
* @ throws IllegalArgumentException thrown if status is null . */
PollingState < T > withStatus ( String status , int statusCode ) throws IllegalArgumentException { } } | if ( status == null ) { throw new IllegalArgumentException ( "Status is null." ) ; } this . status = status ; this . statusCode = statusCode ; return this ; |
public class VirtualMachine { /** * SDK2.5 signature for back compatibility */
public Task revertToCurrentSnapshot_Task ( HostSystem host ) throws VmConfigFault , SnapshotFault , TaskInProgress , InvalidState , InsufficientResourcesFault , NotFound , RuntimeFault , RemoteException { } } | return revertToCurrentSnapshot_Task ( host , null ) ; |
public class CmsContextMenu { /** * Opens the context menu of the given table . < p >
* @ param event the click event
* @ param table the table */
public void openForTable ( ItemClickEvent event , Table table ) { } } | fireEvent ( new ContextMenuOpenedOnTableRowEvent ( this , table , event . getItemId ( ) , event . getPropertyId ( ) ) ) ; open ( event . getClientX ( ) , event . getClientY ( ) ) ; |
public class AbstractPojoPathNavigator { /** * This method gets the { @ link PojoPathFunction } for the given { @ code functionName } .
* @ param functionName is the { @ link PojoPathFunctionManager # getFunction ( String ) name } of the requested
* { @ link PojoPathFunction } .
* @ param context is the { @ link ... | PojoPathFunction function = null ; // context overrides functions . . .
PojoPathFunctionManager manager = context . getAdditionalFunctionManager ( ) ; if ( manager != null ) { function = manager . getFunction ( functionName ) ; } if ( function == null ) { // global functions as fallback . . .
manager = getFunctionManag... |
public class AbstractJobEntityImpl { /** * getters and setters / / / / / */
public void setExecution ( ExecutionEntity execution ) { } } | executionId = execution . getId ( ) ; processInstanceId = execution . getProcessInstanceId ( ) ; processDefinitionId = execution . getProcessDefinitionId ( ) ; |
public class LocalEnvironment { @ Override public JobExecutionResult execute ( String jobName ) throws Exception { } } | if ( executor == null ) { startNewSession ( ) ; } Plan p = createProgramPlan ( jobName ) ; // Session management is disabled , revert this commit to enable
// p . setJobId ( jobID ) ;
// p . setSessionTimeout ( sessionTimeout ) ;
JobExecutionResult result = executor . executePlan ( p ) ; this . lastJobExecutionResult =... |
public class InternalSARLParser { /** * InternalSARL . g : 12043:1 : ruleXAssignment returns [ EObject current = null ] : ( ( ( ) ( ( ruleFeatureCallID ) ) ruleOpSingleAssign ( ( lv _ value _ 3_0 = ruleXAssignment ) ) ) | ( this _ XOrExpression _ 4 = ruleXOrExpression ( ( ( ( ( ) ( ( ruleOpMultiAssign ) ) ) ) = > ( ( )... | EObject current = null ; EObject lv_value_3_0 = null ; EObject this_XOrExpression_4 = null ; EObject lv_rightOperand_7_0 = null ; enterRule ( ) ; try { // InternalSARL . g : 12049:2 : ( ( ( ( ) ( ( ruleFeatureCallID ) ) ruleOpSingleAssign ( ( lv _ value _ 3_0 = ruleXAssignment ) ) ) | ( this _ XOrExpression _ 4 = ruleX... |
public class DnsNameResolver { /** * Hook designed for extensibility so one can pass a different cache on each resolution attempt
* instead of using the global one . */
protected void doResolveAll ( String inetHost , DnsRecord [ ] additionals , Promise < List < InetAddress > > promise , DnsCache resolveCache ) throws... | if ( inetHost == null || inetHost . isEmpty ( ) ) { // If an empty hostname is used we should use " localhost " , just like InetAddress . getAllByName ( . . . ) does .
promise . setSuccess ( Collections . singletonList ( loopbackAddress ( ) ) ) ; return ; } final byte [ ] bytes = NetUtil . createByteArrayFromIpAddressS... |
public class MakeValidOp { /** * Decompose a geometry recursively into simple components .
* @ param geometry input geometry
* @ param list a list of simple components ( Point , LineString or Polygon ) */
private static void decompose ( Geometry geometry , Collection < Geometry > list ) { } } | for ( int i = 0 ; i < geometry . getNumGeometries ( ) ; i ++ ) { Geometry component = geometry . getGeometryN ( i ) ; if ( component instanceof GeometryCollection ) { decompose ( component , list ) ; } else { list . add ( component ) ; } } |
public class InstanceFailoverGroupsInner { /** * Creates or updates a failover group .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param locationName The name of the region where the resourc... | return createOrUpdateWithServiceResponseAsync ( resourceGroupName , locationName , failoverGroupName , parameters ) . toBlocking ( ) . last ( ) . body ( ) ; |
public class GeoCodeBasic { /** * { @ inheritDoc } */
@ Override public final int countNotFound ( ) { } } | logger . debug ( "Count the places that couldn't be found" ) ; final int count = notFoundKeys ( ) . size ( ) ; logger . debug ( count + " places not found" ) ; return count ; |
public class FragmentSignatureUtils { /** * Processes a set of parameters that have been specified for a fragment signature .
* This processing matches the specified parameters against the ones in the signature , allowing the specified
* ones ( usually coming from a fragment selection like { @ code th : include } )... | Validate . notNull ( fragmentSignature , "Fragment signature cannot be null" ) ; if ( specifiedParameters == null || specifiedParameters . size ( ) == 0 ) { if ( fragmentSignature . hasParameters ( ) ) { // Fragment signature requires parameters , but we haven ' t specified them !
throw new TemplateProcessingException ... |
public class CandidateComparator { /** * < pre >
* function to actually calculate the scores for the two objects that are being compared .
* the comparison follows the following logic -
* 1 . if both objects are equal return 0 score for both .
* 2 . if one side is null , the other side gets all the score .
* ... | logger . debug ( String . format ( "start comparing '%s' with '%s', total weight = %s " , object1 == null ? "(null)" : object1 . toString ( ) , object2 == null ? "(null)" : object2 . toString ( ) , this . getTotalWeight ( ) ) ) ; int result1 = 0 ; int result2 = 0 ; // short cut if object equals .
if ( object1 == objec... |
public class PlacementConstraintMarshaller { /** * Marshall the given parameter object . */
public void marshall ( PlacementConstraint placementConstraint , ProtocolMarshaller protocolMarshaller ) { } } | if ( placementConstraint == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( placementConstraint . getType ( ) , TYPE_BINDING ) ; protocolMarshaller . marshall ( placementConstraint . getExpression ( ) , EXPRESSION_BINDING ) ; } catch ( Excep... |
public class ContentSceneController { /** * Called on system pause . The current active content scene moves to invisible state - - see
* { @ link ContentScene # hide ( ) } */
public void pause ( ) { } } | new ExecutionChain ( mGvrContext ) . runOnMainThread ( new Runnable ( ) { @ Override public void run ( ) { if ( ! mContentSceneViewStack . isEmpty ( ) ) { mContentSceneViewStack . peek ( ) . hide ( ) ; WidgetLib . getTouchManager ( ) . setFlingHandler ( null ) ; } } } ) . execute ( ) ; |
public class ConnectionMaintainerImpl { /** * Returns a server identifier to try .
* @ return A server identifier to try . If we are unable to come up with any
* candidates , a < code > None < / code > object is returned . */
private Optional < T > getServerIdToTry ( ) { } } | if ( m_serverIdsToTry . isEmpty ( ) ) { final Collection < T > moreCandidates = getMoreCandidates ( ) ; if ( moreCandidates . isEmpty ( ) ) { // We were unable to find more candidates . To avoid hammering
// the service that provides potential candidates , flag that we
// should sleep for a little while before trying a... |
public class AWSSystemsManagerPropertiesProvider { /** * todo - ensure prefixe parameter takes precedence */
private String forceResolve ( String key ) { } } | GetParametersRequest request ; if ( key . startsWith ( "aws." ) ) { log . warn ( "Will not try to resolve unprefixed key (" + key + ") - AWS does not allow this" ) ; if ( org . apache . commons . lang3 . StringUtils . isNotEmpty ( parameterPrefix ) ) { request = new GetParametersRequest ( ) . withNames ( parameterPrefi... |
public class authenticationradiuspolicy_systemglobal_binding { /** * Use this API to fetch authenticationradiuspolicy _ systemglobal _ binding resources of given name . */
public static authenticationradiuspolicy_systemglobal_binding [ ] get ( nitro_service service , String name ) throws Exception { } } | authenticationradiuspolicy_systemglobal_binding obj = new authenticationradiuspolicy_systemglobal_binding ( ) ; obj . set_name ( name ) ; authenticationradiuspolicy_systemglobal_binding response [ ] = ( authenticationradiuspolicy_systemglobal_binding [ ] ) obj . get_resources ( service ) ; return response ; |
public class AmazonConfigClient { /** * Runs an on - demand remediation for the specified AWS Config rules against the last known remediation
* configuration . It runs an execution against the current state of your resources . Remediation execution is
* asynchronous .
* You can specify up to 100 resource keys per... | request = beforeClientExecution ( request ) ; return executeStartRemediationExecution ( request ) ; |
public class OrRange { /** * ( non - Javadoc )
* @ see net . ossindex . version . IVersionRange # contains ( net . ossindex . version . IVersion ) */
@ Override public boolean contains ( IVersion version ) { } } | for ( IVersionRange range : ranges ) { if ( range . contains ( version ) ) { return true ; } } return false ; |
public class MMCIFFileTools { /** * Converts an Atom object to an { @ link AtomSite } object .
* @ param a the atom
* @ param model the model number for the output AtomSites
* @ param chainName the chain identifier ( author id ) for the output AtomSites
* @ param chainId the internal chain identifier ( asym id ... | /* ATOM 7 C CD . GLU A 1 24 ? - 10.109 15.374 38.853 1.00 50.05 ? ? ? ? ? ? 24 GLU A CD 1
ATOM 8 O OE1 . GLU A 1 24 ? - 9.659 14.764 37.849 1.00 49.80 ? ? ? ? ? ? 24 GLU A OE1 1
ATOM 9 O OE2 . GLU A 1 24 ? - 11.259 15.171 39.310 1.00 50.51 ? ? ? ? ? ? 24 GLU A OE2 1
ATOM 10 N N . LEU A 1 25 ? - 5.907 18.743 37.41... |
public class DiameterStackMultiplexer { /** * ( non - Javadoc )
* @ see org . mobicents . diameter . stack . DiameterStackMultiplexerMBean # _ Network _ Peers _ addPeer ( java . lang . String , boolean , int , String ) */
@ Override public void _Network_Peers_addPeer ( String name , boolean attemptConnect , int ratin... | try { NetworkImpl n = ( NetworkImpl ) stack . unwrap ( Network . class ) ; /* Peer p = */
n . addPeer ( name , realm , attemptConnect ) ; } catch ( IllegalArgumentException e ) { logger . warn ( e . getMessage ( ) ) ; } catch ( InternalException e ) { throw new MBeanException ( e , "Failed to add peer with name '" + na... |
public class PlainTextDocumentReaderAndWriter { /** * Print the classifications for the document to the given Writer . This method
* now checks the < code > outputFormat < / code > property , and can print in
* slashTags , inlineXML , or xml ( stand - Off XML ) . For both the XML output
* formats , it preserves s... | String style = null ; if ( flags != null ) { style = flags . outputFormat ; } if ( style == null || "" . equals ( style ) ) { style = "slashTags" ; } OutputStyle outputStyle = OutputStyle . fromShortName ( style ) ; printAnswers ( list , out , outputStyle , ! "slashTags" . equals ( style ) ) ; |
public class ResourceValues { /** * Returns new instance of OptionalValue with given value
* @ param value wrapped object
* @ param < T > type of the wrapped object
* @ return given object wrapped in OptionalValue */
public static < T > OptionalValue < T > ofNullable ( T value ) { } } | return new GenericOptionalValue < T > ( RUNTIME_SOURCE , DEFAULT_KEY , value ) ; |
public class ItemFilter { /** * add a list of items at the given position within the existing items
* @ param position the global position
* @ param items the items to add */
public ModelAdapter < ? , Item > add ( int position , List < Item > items ) { } } | if ( mOriginalItems != null && items . size ( ) > 0 ) { if ( mItemAdapter . isUseIdDistributor ( ) ) { mItemAdapter . getIdDistributor ( ) . checkIds ( items ) ; } mOriginalItems . addAll ( getAdapterPosition ( mItemAdapter . getAdapterItems ( ) . get ( position ) ) - mItemAdapter . getFastAdapter ( ) . getPreItemCount... |
public class SslCodec { /** * Forwards a close event upstream .
* @ param event
* the close event
* @ throws SSLException if an SSL related problem occurs
* @ throws InterruptedException if the execution was interrupted */
@ Handler public void onClose ( Close event , PlainChannel plainChannel ) throws Interrup... | if ( plainChannel . hub ( ) != this ) { return ; } plainChannel . close ( event ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.