idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
24,400
public String getQualifiedTypeNameForFile ( ) { String typeName = getTypeNameForFile ( ) ; String qualifiedTypeName = mDoc . qualifiedTypeName ( ) ; int packageLength = qualifiedTypeName . length ( ) - typeName . length ( ) ; if ( packageLength <= 0 ) { return typeName ; } String packagePath = qualifiedTypeName . substring ( 0 , packageLength ) ; return packagePath + typeName ; }
Converts inner class names .
95
6
24,401
public MethodDoc getMatchingMethod ( MethodDoc method ) { MethodDoc [ ] methods = getMethods ( ) ; for ( int i = 0 ; i < methods . length ; i ++ ) { if ( method . getName ( ) . equals ( methods [ i ] . getName ( ) ) && method . getSignature ( ) . equals ( methods [ i ] . getSignature ( ) ) ) { return methods [ i ] ; } } return null ; }
Get a MethodDoc in this ClassDoc with a name and signature matching that of the specified MethodDoc
98
20
24,402
public MethodDoc getMatchingMethod ( MethodDoc method , MethodFinder mf ) { MethodDoc md = getMatchingMethod ( method ) ; if ( md != null ) { if ( mf . checkMethod ( md ) ) { return md ; } } return null ; }
Get a MethodDoc in this ClassDoc with a name and signature matching that of the specified MethodDoc and accepted by the specified MethodFinder
59
28
24,403
public MethodDoc findMatchingMethod ( MethodDoc method , MethodFinder mf ) { // Look in this class's interface set MethodDoc md = findMatchingInterfaceMethod ( method , mf ) ; if ( md != null ) { return md ; } // Look in this class's superclass ancestry ClassDoc superClass = getSuperclass ( ) ; if ( superClass != null ) { md = superClass . getMatchingMethod ( method , mf ) ; if ( md != null ) { return md ; } return superClass . findMatchingMethod ( method , mf ) ; } return null ; }
Find a MethodDoc with a name and signature matching that of the specified MethodDoc and accepted by the specified MethodFinder . This method searches the interfaces and super class ancestry of the class represented by this ClassDoc for a matching method .
129
47
24,404
public String getTagValue ( String tagName ) { Tag [ ] tags = getTagMap ( ) . get ( tagName ) ; if ( tags == null || tags . length == 0 ) { return null ; } return tags [ tags . length - 1 ] . getText ( ) ; }
Gets the text value of the first tag in doc that matches tagName
61
15
24,405
public static Map < String , PropertyDescriptor > getAllProperties ( GenericType root ) throws IntrospectionException { Map < String , PropertyDescriptor > properties = cPropertiesCache . get ( root ) ; if ( properties == null ) { GenericType rootType = root . getRootType ( ) ; if ( rootType == null ) { rootType = root ; } properties = Collections . unmodifiableMap ( createProperties ( rootType , root ) ) ; cPropertiesCache . put ( root , properties ) ; } return properties ; }
A function that returns a Map of all the available properties on a given class including write - only properties . The properties returned is mostly a superset of those returned from the standard JavaBeans Introspector except pure indexed properties are discarded .
117
48
24,406
public static String findTemplateName ( org . teatrove . tea . compiler . Scanner scanner ) { // System.out.println("<-- findTemplateName -->"); Token token ; String name = null ; try { while ( ( ( token = scanner . readToken ( ) ) . getID ( ) ) != Token . EOF ) { /* System.out.println("Token [Code: " + token.getCode() + "] [Image: " + token.getImage() + "] [Value: " + token.getStringValue() + "] [Id: " + token.getID() + "]"); */ if ( token . getID ( ) == Token . TEMPLATE ) { token = scanner . readToken ( ) ; if ( token . getID ( ) == Token . IDENT ) { name = token . getStringValue ( ) ; } break ; } } } catch ( IOException ioe ) { ioe . printStackTrace ( ) ; } return name ; }
Finds the name of the template using the specified tea scanner .
215
13
24,407
public Template parseTeaTemplate ( String templateName ) throws IOException { if ( templateName == null ) { return null ; } preserveParseTree ( templateName ) ; compile ( templateName ) ; CompilationUnit unit = getCompilationUnit ( templateName , null ) ; if ( unit == null ) { return null ; } return unit . getParseTree ( ) ; }
Perform Tea parsing . This method will compile the named template .
79
13
24,408
public boolean isValueKnown ( ) { Type type = getType ( ) ; if ( type != null ) { Class < ? > clazz = type . getObjectClass ( ) ; return Number . class . isAssignableFrom ( clazz ) || clazz . isAssignableFrom ( Number . class ) ; } else { return false ; } }
Value is known only if type is a number or can be assigned a number .
75
16
24,409
public Object [ ] cloneArray ( Object [ ] array ) { Class < ? > clazz = array . getClass ( ) . getComponentType ( ) ; Object newArray = Array . newInstance ( clazz , array . length ) ; System . arraycopy ( array , 0 , newArray , 0 , array . length ) ; return ( Object [ ] ) newArray ; }
Clone the given array into a new instance of the same type and dimensions . The values are directly copied by memory so this is not a deep clone operation . However manipulation of the contents of the array will not impact the given array .
79
47
24,410
public HttpClient setHeader ( String name , Object value ) { if ( mHeaders == null ) { mHeaders = new HttpHeaderMap ( ) ; } mHeaders . put ( name , value ) ; return this ; }
Set a header name - value pair to the request .
51
11
24,411
public HttpClient addHeader ( String name , Object value ) { if ( mHeaders == null ) { mHeaders = new HttpHeaderMap ( ) ; } mHeaders . add ( name , value ) ; return this ; }
Add a header name - value pair to the request in order for multiple values to be specified .
51
19
24,412
public Response getResponse ( PostData postData ) throws ConnectException , SocketException { CheckedSocket socket = mFactory . getSocket ( mSession ) ; try { CharToByteBuffer request = new FastCharToByteBuffer ( new DefaultByteBuffer ( ) , "8859_1" ) ; request = new InternedCharToByteBuffer ( request ) ; request . append ( mMethod ) ; request . append ( ' ' ) ; request . append ( mURI ) ; request . append ( ' ' ) ; request . append ( mProtocol ) ; request . append ( "\r\n" ) ; if ( mHeaders != null ) { mHeaders . appendTo ( request ) ; } request . append ( "\r\n" ) ; Response response ; try { response = sendRequest ( socket , request , postData ) ; } catch ( InterruptedIOException e ) { // If timed out, throw exception rather than risk double // posting. throw e ; } catch ( IOException e ) { response = null ; } if ( response == null ) { // Try again with new connection. Persistent connection may // have timed out and been closed by server. try { socket . close ( ) ; } catch ( IOException e ) { } socket = mFactory . createSocket ( mSession ) ; response = sendRequest ( socket , request , postData ) ; if ( response == null ) { throw new ConnectException ( "No response from server " + socket . getInetAddress ( ) + ":" + socket . getPort ( ) ) ; } } return response ; } catch ( SocketException e ) { throw e ; } catch ( InterruptedIOException e ) { throw new ConnectException ( "Read timeout expired: " + mReadTimeout + ", " + e ) ; } catch ( IOException e ) { throw new SocketException ( e . toString ( ) ) ; } }
Opens a connection passes on the current request settings and returns the server s response . The optional PostData parameter is used to supply post data to the server . The Content - Length header specifies how much data will be read from the PostData InputStream . If it is not specified data will be read from the InputStream until EOF is reached .
396
70
24,413
public void addRootLogListener ( LogListener listener ) { if ( mParent == null ) { addLogListener ( listener ) ; } else { mParent . addRootLogListener ( listener ) ; } }
adds a listener to the root log the log with a null parent
43
14
24,414
public void debug ( String s ) { if ( isEnabled ( ) && isDebugEnabled ( ) ) { dispatchLogMessage ( new LogEvent ( this , LogEvent . DEBUG_TYPE , s ) ) ; } }
Simple method for logging a single debugging message .
44
9
24,415
public void debug ( Throwable t ) { if ( isEnabled ( ) && isDebugEnabled ( ) ) { dispatchLogException ( new LogEvent ( this , LogEvent . DEBUG_TYPE , t ) ) ; } }
Simple method for logging a single debugging exception .
45
9
24,416
public void info ( String s ) { if ( isEnabled ( ) && isInfoEnabled ( ) ) { dispatchLogMessage ( new LogEvent ( this , LogEvent . INFO_TYPE , s ) ) ; } }
Simple method for logging a single information message .
44
9
24,417
public void info ( Throwable t ) { if ( isEnabled ( ) && isInfoEnabled ( ) ) { dispatchLogException ( new LogEvent ( this , LogEvent . INFO_TYPE , t ) ) ; } }
Simple method for logging a single information exception .
45
9
24,418
public void warn ( String s ) { if ( isEnabled ( ) && isWarnEnabled ( ) ) { dispatchLogMessage ( new LogEvent ( this , LogEvent . WARN_TYPE , s ) ) ; } }
Simple method for logging a single warning message .
45
9
24,419
public void warn ( Throwable t ) { if ( isEnabled ( ) && isWarnEnabled ( ) ) { dispatchLogException ( new LogEvent ( this , LogEvent . WARN_TYPE , t ) ) ; } }
Simple method for logging a single warning exception .
46
9
24,420
public void error ( String s ) { if ( isEnabled ( ) && isErrorEnabled ( ) ) { dispatchLogMessage ( new LogEvent ( this , LogEvent . ERROR_TYPE , s ) ) ; } }
Simple method for logging a single error message .
44
9
24,421
public void error ( Throwable t ) { if ( isEnabled ( ) && isErrorEnabled ( ) ) { dispatchLogException ( new LogEvent ( this , LogEvent . ERROR_TYPE , t ) ) ; } }
Simple method for logging a single error exception .
45
9
24,422
public Log [ ] getChildren ( ) { Collection copy ; synchronized ( mChildren ) { copy = new ArrayList ( mChildren . size ( ) ) ; Iterator it = mChildren . iterator ( ) ; while ( it . hasNext ( ) ) { Log child = ( Log ) ( ( WeakReference ) it . next ( ) ) . get ( ) ; if ( child == null ) { it . remove ( ) ; } else { copy . add ( child ) ; } } } return ( Log [ ] ) copy . toArray ( new Log [ copy . size ( ) ] ) ; }
Returns a copy of the children Logs .
124
9
24,423
public void setEnabled ( boolean enabled ) { setEnabled ( enabled , ENABLED_MASK ) ; if ( enabled ) { Log parent ; if ( ( parent = mParent ) != null ) { parent . setEnabled ( true ) ; } } }
When this Log is enabled all parent Logs are also enabled . When this Log is disabled parent Logs are unaffected .
54
24
24,424
public void applyProperties ( Map properties ) { if ( properties . containsKey ( "enabled" ) ) { setEnabled ( ! "false" . equalsIgnoreCase ( ( String ) properties . get ( "enabled" ) ) ) ; } if ( properties . containsKey ( "debug" ) ) { setDebugEnabled ( ! "false" . equalsIgnoreCase ( ( String ) properties . get ( "debug" ) ) ) ; } if ( properties . containsKey ( "info" ) ) { setInfoEnabled ( ! "false" . equalsIgnoreCase ( ( String ) properties . get ( "info" ) ) ) ; } if ( properties . containsKey ( "warn" ) ) { setWarnEnabled ( ! "false" . equalsIgnoreCase ( ( String ) properties . get ( "warn" ) ) ) ; } if ( properties . containsKey ( "error" ) ) { setErrorEnabled ( ! "false" . equalsIgnoreCase ( ( String ) properties . get ( "error" ) ) ) ; } }
Understands and applies the following boolean properties . True is the default value if the value doesn t equal false ignoring case .
221
25
24,425
private static PropertyDescriptor [ ] [ ] getBeanProperties ( Class < ? > beanType ) { List < PropertyDescriptor > readProperties = new ArrayList < PropertyDescriptor > ( ) ; List < PropertyDescriptor > writeProperties = new ArrayList < PropertyDescriptor > ( ) ; try { Map < ? , ? > map = CompleteIntrospector . getAllProperties ( beanType ) ; Iterator < ? > it = map . values ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { PropertyDescriptor pd = ( PropertyDescriptor ) it . next ( ) ; if ( pd . getReadMethod ( ) != null ) { readProperties . add ( pd ) ; } if ( pd . getWriteMethod ( ) != null ) { writeProperties . add ( pd ) ; } } } catch ( IntrospectionException e ) { throw new RuntimeException ( e . toString ( ) ) ; } PropertyDescriptor [ ] [ ] props = new PropertyDescriptor [ 2 ] [ ] ; props [ 0 ] = new PropertyDescriptor [ readProperties . size ( ) ] ; readProperties . toArray ( props [ 0 ] ) ; props [ 1 ] = new PropertyDescriptor [ writeProperties . size ( ) ] ; writeProperties . toArray ( props [ 1 ] ) ; return props ; }
Returns two arrays of PropertyDescriptors . Array 0 has contains read PropertyDescriptors array 1 contains the write PropertyDescriptors .
306
28
24,426
static void writeShort ( OutputStream out , int i ) throws IOException { out . write ( ( byte ) i ) ; out . write ( ( byte ) ( i >> 8 ) ) ; }
Writes a short in Intel byte order .
41
9
24,427
void appendCompressed ( ByteData compressed , ByteData original ) throws IOException { mCompressedSegments ++ ; mBuffer . appendSurrogate ( new CompressedData ( compressed , original ) ) ; }
Called from DetachedResponseImpl .
44
8
24,428
public static int toDecimalDigits ( float v , char [ ] digits , int offset , int maxDigits , int maxFractDigits , int roundMode ) { int bits = Float . floatToIntBits ( v ) ; int f = bits & 0x7fffff ; int e = ( bits >> 23 ) & 0xff ; if ( e != 0 ) { // Normalized number. return toDecimalDigits ( f + 0x800000 , e - 126 , 24 , digits , offset , maxDigits , maxFractDigits , roundMode ) ; } else { // Denormalized number. return toDecimalDigits ( f , - 125 , 23 , digits , offset , maxDigits , maxFractDigits , roundMode ) ; } }
Produces decimal digits for non - zero finite floating point values . The sign of the value is discarded . Passing in Infinity or NaN produces invalid digits . The maximum number of decimal digits that this function will likely produce is 9 .
167
46
24,429
public static int toDecimalDigits ( double v , char [ ] digits , int offset , int maxDigits , int maxFractDigits , int roundMode ) { // NOTE: The value 144115188075855872 is converted to // 144115188075855870, which is as correct as possible. Java's // Double.toString method doesn't round off the last digit. long bits = Double . doubleToLongBits ( v ) ; long f = bits & 0xfffffffffffff L ; int e = ( int ) ( ( bits >> 52 ) & 0x7ff ) ; if ( e != 0 ) { // Normalized number. return toDecimalDigits ( f + 0x10000000000000 L , e - 1022 , 53 , digits , offset , maxDigits , maxFractDigits , roundMode ) ; } else { // Denormalized number. return toDecimalDigits ( f , - 1023 , 52 , digits , offset , maxDigits , maxFractDigits , roundMode ) ; } }
Produces decimal digits for non - zero finite floating point values . The sign of the value is discarded . Passing in Infinity or NaN produces invalid digits . The maximum number of decimal digits that this function will likely produce is 18 .
227
46
24,430
public TransactionQueueData add ( TransactionQueueData data ) { return new TransactionQueueData ( null , Math . min ( mSnapshotStart , data . mSnapshotStart ) , Math . max ( mSnapshotEnd , data . mSnapshotEnd ) , mQueueSize + data . mQueueSize , mThreadCount + data . mThreadCount , mServicingCount + data . mServicingCount , Math . max ( mPeakQueueSize , data . mPeakQueueSize ) , Math . max ( mPeakThreadCount , data . mPeakThreadCount ) , Math . max ( mPeakServicingCount , data . mPeakServicingCount ) , mTotalEnqueueAttempts + data . mTotalEnqueueAttempts , mTotalEnqueued + data . mTotalEnqueued , mTotalServiced + data . mTotalServiced , mTotalExpired + data . mTotalExpired , mTotalServiceExceptions + data . mTotalServiceExceptions , mTotalUncaughtExceptions + data . mTotalUncaughtExceptions , mTotalQueueDuration + data . mTotalQueueDuration , mTotalServiceDuration + data . mTotalServiceDuration ) ; }
Adds TransactionQueueData to another .
255
7
24,431
public Object get ( Object key ) { Object value = mCacheMap . get ( key ) ; if ( value != null || mCacheMap . containsKey ( key ) ) { return value ; } value = mBackingMap . get ( key ) ; if ( value != null || mBackingMap . containsKey ( key ) ) { mCacheMap . put ( key , value ) ; } return value ; }
Returns the value from the cache or if not found the backing map . If the backing map is accessed the value is saved in the cache for future gets .
87
31
24,432
public Object put ( Object key , Object value ) { mCacheMap . put ( key , value ) ; return mBackingMap . put ( key , value ) ; }
Puts the entry into both the cache and backing map . The old value in the backing map is returned .
36
22
24,433
public Object remove ( Object key ) { mCacheMap . remove ( key ) ; return mBackingMap . remove ( key ) ; }
Removes the key from both the cache and backing map . The old value in the backing map is returned .
29
22
24,434
public Plugin getPlugin ( String name ) { if ( mPluginContext != null ) { return mPluginContext . getPlugin ( name ) ; } return null ; }
Returns a Plugin by name .
34
6
24,435
public Plugin [ ] getPlugins ( ) { if ( mPluginContext != null ) { Collection c = mPluginContext . getPlugins ( ) . values ( ) ; if ( c != null ) { return ( Plugin [ ] ) c . toArray ( new Plugin [ c . size ( ) ] ) ; } } return new Plugin [ 0 ] ; }
Returns an array of all of the Plugins .
75
10
24,436
public boolean isOwnedBy ( String possibleOwner ) { boolean retval = false ; if ( this . owner != null ) { retval = ( this . owner . compareTo ( possibleOwner ) == 0 ) ; } return retval ; }
Convenience function for comparing possibleOwner against this . owner
51
12
24,437
public void deleteAtManagementGroup ( String policySetDefinitionName , String managementGroupId ) { deleteAtManagementGroupWithServiceResponseAsync ( policySetDefinitionName , managementGroupId ) . toBlocking ( ) . single ( ) . body ( ) ; }
Deletes a policy set definition . This operation deletes the policy set definition in the given management group with the given name .
53
25
24,438
public void delete ( String resourceGroupName , String workflowName ) { deleteWithServiceResponseAsync ( resourceGroupName , workflowName ) . toBlocking ( ) . single ( ) . body ( ) ; }
Deletes a workflow .
43
5
24,439
public Observable < Page < WorkflowInner > > listByResourceGroupNextAsync ( final String nextPageLink ) { return listByResourceGroupNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < WorkflowInner > > , Page < WorkflowInner > > ( ) { @ Override public Page < WorkflowInner > call ( ServiceResponse < Page < WorkflowInner > > response ) { return response . body ( ) ; } } ) ; }
Gets a list of workflows by resource group .
111
11
24,440
public Observable < Page < ClusterInner > > listByResourceGroupAsync ( String resourceGroupName ) { return listByResourceGroupWithServiceResponseAsync ( resourceGroupName ) . map ( new Func1 < ServiceResponse < List < ClusterInner > > , Page < ClusterInner > > ( ) { @ Override public Page < ClusterInner > call ( ServiceResponse < List < ClusterInner > > response ) { PageImpl < ClusterInner > page = new PageImpl <> ( ) ; page . setItems ( response . body ( ) ) ; return page ; } } ) ; }
Lists all Kusto clusters within a resource group .
128
12
24,441
public static EntityGetOperation < AssetDeliveryPolicyInfo > get ( String assetDeliveryPolicyId ) { return new DefaultGetOperation < AssetDeliveryPolicyInfo > ( ENTITY_SET , assetDeliveryPolicyId , AssetDeliveryPolicyInfo . class ) ; }
Create an operation that will retrieve the given asset delivery policy
51
11
24,442
public static DefaultListOperation < AssetDeliveryPolicyInfo > list ( LinkInfo < AssetDeliveryPolicyInfo > link ) { return new DefaultListOperation < AssetDeliveryPolicyInfo > ( link . getHref ( ) , new GenericType < ListResult < AssetDeliveryPolicyInfo > > ( ) { } ) ; }
Create an operation that will list all the asset delivery policies at the given link .
64
16
24,443
public Observable < AdvisorListResultInner > listByDatabaseAsync ( String resourceGroupName , String serverName , String databaseName ) { return listByDatabaseWithServiceResponseAsync ( resourceGroupName , serverName , databaseName ) . map ( new Func1 < ServiceResponse < AdvisorListResultInner > , AdvisorListResultInner > ( ) { @ Override public AdvisorListResultInner call ( ServiceResponse < AdvisorListResultInner > response ) { return response . body ( ) ; } } ) ; }
Returns a list of database advisors .
110
7
24,444
public AdvisorInner createOrUpdate ( String resourceGroupName , String serverName , String databaseName , String advisorName , AutoExecuteStatus autoExecuteValue ) { return createOrUpdateWithServiceResponseAsync ( resourceGroupName , serverName , databaseName , advisorName , autoExecuteValue ) . toBlocking ( ) . single ( ) . body ( ) ; }
Creates or updates a database advisor .
78
8
24,445
public static MSICredentials getMSICredentials ( String managementEndpoint ) { //check if we are running in a web app String websiteName = System . getenv ( "WEBSITE_SITE_NAME" ) ; if ( websiteName != null && ! websiteName . isEmpty ( ) ) { // We are in a web app... MSIConfigurationForAppService config = new MSIConfigurationForAppService ( managementEndpoint ) ; return forAppService ( config ) ; } else { //We are in a vm/container MSIConfigurationForVirtualMachine config = new MSIConfigurationForVirtualMachine ( managementEndpoint ) ; return forVirtualMachine ( config ) ; } }
This method checks if the env vars MSI_ENDPOINT and MSI_SECRET exist . If they do we return the msi creds class for APP Svcs otherwise we return one for VM
153
42
24,446
T unsafeGetIfOpened ( ) { if ( innerObject != null && innerObject . getState ( ) == IOObject . IOObjectState . OPENED ) { return innerObject ; } return null ; }
should be invoked from reactor thread
44
6
24,447
public void delete ( String resourceGroupName , String registryName , String taskName ) { deleteWithServiceResponseAsync ( resourceGroupName , registryName , taskName ) . toBlocking ( ) . last ( ) . body ( ) ; }
Deletes a specified task .
50
6
24,448
public static void main ( String [ ] args ) throws NoSuchAlgorithmException , InvalidKeyException { // The connection string value can be obtained by going to your App Configuration instance in the Azure portal // and navigating to "Access Keys" page under the "Settings" section. final String connectionString = "endpoint={endpoint_value};id={id_value};name={secret_value}" ; final HttpMethodRequestTracker tracker = new HttpMethodRequestTracker ( ) ; // Instantiate a client that will be used to call the service. // We add in a policy to track the type of HTTP method calls we make. // We also want to see the Header information of our HTTP requests, so we specify the detail level. final ConfigurationAsyncClient client = ConfigurationAsyncClient . builder ( ) . credentials ( new ConfigurationClientCredentials ( connectionString ) ) . addPolicy ( new HttpMethodRequestTrackingPolicy ( tracker ) ) . httpLogDetailLevel ( HttpLogDetailLevel . HEADERS ) . build ( ) ; // Adding a couple of settings and then fetching all the settings in our repository. final List < ConfigurationSetting > settings = Flux . concat ( client . addSetting ( new ConfigurationSetting ( ) . key ( "hello" ) . value ( "world" ) ) , client . setSetting ( new ConfigurationSetting ( ) . key ( "newSetting" ) . value ( "newValue" ) ) ) . then ( client . listSettings ( new SettingSelector ( ) . key ( "*" ) ) . collectList ( ) ) . block ( ) ; // Cleaning up after ourselves by deleting the values. final Stream < ConfigurationSetting > stream = settings == null ? Stream . empty ( ) : settings . stream ( ) ; Flux . merge ( stream . map ( client :: deleteSetting ) . collect ( Collectors . toList ( ) ) ) . blockLast ( ) ; // Check what sort of HTTP method calls we made. tracker . print ( ) ; }
Runs the sample algorithm and demonstrates how to add a custom policy to the HTTP pipeline .
420
18
24,449
public ConnectionStringBuilder setEndpoint ( String namespaceName , String domainName ) { try { this . endpoint = new URI ( String . format ( Locale . US , END_POINT_FORMAT , namespaceName , domainName ) ) ; } catch ( URISyntaxException exception ) { throw new IllegalConnectionStringFormatException ( String . format ( Locale . US , "Invalid namespace name: %s" , namespaceName ) , exception ) ; } return this ; }
Set an endpoint which can be used to connect to the EventHub instance .
100
15
24,450
public void marshalEntry ( Object content , OutputStream stream ) throws JAXBException { marshaller . marshal ( createEntry ( content ) , stream ) ; }
Convert the given content into an ATOM entry and write it to the given stream .
36
18
24,451
public Observable < Page < VaultInner > > listByResourceGroupAsync ( final String resourceGroupName , final Integer top ) { return listByResourceGroupWithServiceResponseAsync ( resourceGroupName , top ) . map ( new Func1 < ServiceResponse < Page < VaultInner > > , Page < VaultInner > > ( ) { @ Override public Page < VaultInner > call ( ServiceResponse < Page < VaultInner > > response ) { return response . body ( ) ; } } ) ; }
The List operation gets information about the vaults associated with the subscription and within the specified resource group .
110
20
24,452
public void setData ( String key , Object value ) { this . data = this . data . addData ( key , value ) ; }
Stores a key - value data in the context .
29
11
24,453
private void resetInputStreams ( ) throws IOException , MessagingException { for ( int ix = 0 ; ix < this . getCount ( ) ; ix ++ ) { BodyPart part = this . getBodyPart ( ix ) ; if ( part . getContent ( ) instanceof MimeMultipart ) { MimeMultipart subContent = ( MimeMultipart ) part . getContent ( ) ; for ( int jx = 0 ; jx < subContent . getCount ( ) ; jx ++ ) { BodyPart subPart = subContent . getBodyPart ( jx ) ; if ( subPart . getContent ( ) instanceof ByteArrayInputStream ) { ( ( ByteArrayInputStream ) subPart . getContent ( ) ) . reset ( ) ; } } } } }
reset all input streams to allow redirect filter to write the output twice
174
13
24,454
public Observable < Page < IntegrationAccountSessionInner > > listByIntegrationAccountsNextAsync ( final String nextPageLink ) { return listByIntegrationAccountsNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < IntegrationAccountSessionInner > > , Page < IntegrationAccountSessionInner > > ( ) { @ Override public Page < IntegrationAccountSessionInner > call ( ServiceResponse < Page < IntegrationAccountSessionInner > > response ) { return response . body ( ) ; } } ) ; }
Gets a list of integration account sessions .
120
9
24,455
public static JWSObject deserialize ( String json ) throws IOException { ObjectMapper mapper = new ObjectMapper ( ) ; return mapper . readValue ( json , JWSObject . class ) ; }
Construct JWSObject from json string .
46
8
24,456
public KeyIdentifier keyIdentifier ( ) { if ( key ( ) == null || key ( ) . kid ( ) == null || key ( ) . kid ( ) . length ( ) == 0 ) { return null ; } return new KeyIdentifier ( key ( ) . kid ( ) ) ; }
The key identifier .
63
4
24,457
public Map < String , String > getCachedChallenge ( HttpUrl url ) { if ( url == null ) { return null ; } String authority = getAuthority ( url ) ; authority = authority . toLowerCase ( Locale . ENGLISH ) ; return cachedChallenges . get ( authority ) ; }
Uses authority to retrieve the cached values .
67
9
24,458
public void addCachedChallenge ( HttpUrl url , Map < String , String > challenge ) { if ( url == null || challenge == null ) { return ; } String authority = getAuthority ( url ) ; authority = authority . toLowerCase ( Locale . ENGLISH ) ; cachedChallenges . put ( authority , challenge ) ; }
Uses authority to cache challenge .
74
7
24,459
public String getAuthority ( HttpUrl url ) { String scheme = url . scheme ( ) ; String host = url . host ( ) ; int port = url . port ( ) ; StringBuilder builder = new StringBuilder ( ) ; if ( scheme != null ) { builder . append ( scheme ) . append ( "://" ) ; } builder . append ( host ) ; if ( port >= 0 ) { builder . append ( ' ' ) . append ( port ) ; } return builder . toString ( ) ; }
Gets authority of a url .
108
7
24,460
static Mono < Object > decode ( HttpResponse httpResponse , SerializerAdapter serializer , HttpResponseDecodeData decodeData ) { Type headerType = decodeData . headersType ( ) ; if ( headerType == null ) { return Mono . empty ( ) ; } else { return Mono . defer ( ( ) -> { try { return Mono . just ( deserializeHeaders ( httpResponse . headers ( ) , serializer , decodeData ) ) ; } catch ( IOException e ) { return Mono . error ( new HttpRequestException ( "HTTP response has malformed headers" , httpResponse , e ) ) ; } } ) ; } }
Decode headers of the http response .
137
8
24,461
private static Object deserializeHeaders ( HttpHeaders headers , SerializerAdapter serializer , HttpResponseDecodeData decodeData ) throws IOException { final Type deserializedHeadersType = decodeData . headersType ( ) ; if ( deserializedHeadersType == null ) { return null ; } else { final String headersJsonString = serializer . serialize ( headers , SerializerEncoding . JSON ) ; Object deserializedHeaders = serializer . deserialize ( headersJsonString , deserializedHeadersType , SerializerEncoding . JSON ) ; final Class < ? > deserializedHeadersClass = TypeUtil . getRawClass ( deserializedHeadersType ) ; final Field [ ] declaredFields = deserializedHeadersClass . getDeclaredFields ( ) ; for ( final Field declaredField : declaredFields ) { if ( declaredField . isAnnotationPresent ( HeaderCollection . class ) ) { final Type declaredFieldType = declaredField . getGenericType ( ) ; if ( TypeUtil . isTypeOrSubTypeOf ( declaredField . getType ( ) , Map . class ) ) { final Type [ ] mapTypeArguments = TypeUtil . getTypeArguments ( declaredFieldType ) ; if ( mapTypeArguments . length == 2 && mapTypeArguments [ 0 ] == String . class && mapTypeArguments [ 1 ] == String . class ) { final HeaderCollection headerCollectionAnnotation = declaredField . getAnnotation ( HeaderCollection . class ) ; final String headerCollectionPrefix = headerCollectionAnnotation . value ( ) . toLowerCase ( Locale . ROOT ) ; final int headerCollectionPrefixLength = headerCollectionPrefix . length ( ) ; if ( headerCollectionPrefixLength > 0 ) { final Map < String , String > headerCollection = new HashMap <> ( ) ; for ( final HttpHeader header : headers ) { final String headerName = header . name ( ) ; if ( headerName . toLowerCase ( Locale . ROOT ) . startsWith ( headerCollectionPrefix ) ) { headerCollection . put ( headerName . substring ( headerCollectionPrefixLength ) , header . value ( ) ) ; } } final boolean declaredFieldAccessibleBackup = declaredField . isAccessible ( ) ; try { if ( ! declaredFieldAccessibleBackup ) { declaredField . setAccessible ( true ) ; } declaredField . set ( deserializedHeaders , headerCollection ) ; } catch ( IllegalAccessException ignored ) { } finally { if ( ! declaredFieldAccessibleBackup ) { declaredField . setAccessible ( declaredFieldAccessibleBackup ) ; } } } } } } } return deserializedHeaders ; } }
Deserialize the provided headers returned from a REST API to an entity instance declared as the model to hold Matching headers .
587
25
24,462
public Observable < AppServiceEnvironmentResourceInner > getByResourceGroupAsync ( String resourceGroupName , String name ) { return getByResourceGroupWithServiceResponseAsync ( resourceGroupName , name ) . map ( new Func1 < ServiceResponse < AppServiceEnvironmentResourceInner > , AppServiceEnvironmentResourceInner > ( ) { @ Override public AppServiceEnvironmentResourceInner call ( ServiceResponse < AppServiceEnvironmentResourceInner > response ) { return response . body ( ) ; } } ) ; }
Get the properties of an App Service Environment . Get the properties of an App Service Environment .
108
18
24,463
public PagedList < SiteInner > listWebApps ( final String resourceGroupName , final String name , final String propertiesToInclude ) { ServiceResponse < Page < SiteInner >> response = listWebAppsSinglePageAsync ( resourceGroupName , name , propertiesToInclude ) . toBlocking ( ) . single ( ) ; return new PagedList < SiteInner > ( response . body ( ) ) { @ Override public Page < SiteInner > nextPage ( String nextPageLink ) { return listWebAppsNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) . body ( ) ; } } ; }
Get all apps in an App Service Environment . Get all apps in an App Service Environment .
140
18
24,464
public Observable < List < ServerUsageInner > > listByServerAsync ( String resourceGroupName , String serverName ) { return listByServerWithServiceResponseAsync ( resourceGroupName , serverName ) . map ( new Func1 < ServiceResponse < List < ServerUsageInner > > , List < ServerUsageInner > > ( ) { @ Override public List < ServerUsageInner > call ( ServiceResponse < List < ServerUsageInner > > response ) { return response . body ( ) ; } } ) ; }
Returns server usages .
113
5
24,465
public static EntityGetOperation < ContentKeyAuthorizationPolicyInfo > get ( String contentKeyAuthorizationPolicyId ) { return new DefaultGetOperation < ContentKeyAuthorizationPolicyInfo > ( ENTITY_SET , contentKeyAuthorizationPolicyId , ContentKeyAuthorizationPolicyInfo . class ) ; }
Create an operation that will retrieve the given content key authorization policy
61
12
24,466
public static EntityGetOperation < ContentKeyAuthorizationPolicyInfo > get ( LinkInfo < ContentKeyAuthorizationPolicyInfo > link ) { return new DefaultGetOperation < ContentKeyAuthorizationPolicyInfo > ( link . getHref ( ) , ContentKeyAuthorizationPolicyInfo . class ) ; }
Create an operation that will retrieve the content key authorization policy at the given link
61
15
24,467
public static EntityLinkOperation linkOptions ( String contentKeyAuthorizationPolicyId , String contentKeyAuthorizationPolicyOptionId ) { String escapedContentKeyId = null ; try { escapedContentKeyId = URLEncoder . encode ( contentKeyAuthorizationPolicyOptionId , "UTF-8" ) ; } catch ( UnsupportedEncodingException e ) { throw new InvalidParameterException ( "contentKeyId" ) ; } URI contentKeyUri = URI . create ( String . format ( "ContentKeyAuthorizationPolicyOptions('%s')" , escapedContentKeyId ) ) ; return new EntityLinkOperation ( ENTITY_SET , contentKeyAuthorizationPolicyId , "Options" , contentKeyUri ) ; }
Link a content key authorization policy options .
151
8
24,468
public static EntityUnlinkOperation unlinkOptions ( String contentKeyAuthorizationPolicyId , String contentKeyAuthorizationPolicyOptionId ) { return new EntityUnlinkOperation ( ENTITY_SET , contentKeyAuthorizationPolicyId , "Options" , contentKeyAuthorizationPolicyOptionId ) ; }
Unlink content key authorization policy options .
61
8
24,469
public void beginDelete ( String resourceGroupName , String networkInterfaceName , String tapConfigurationName ) { beginDeleteWithServiceResponseAsync ( resourceGroupName , networkInterfaceName , tapConfigurationName ) . toBlocking ( ) . single ( ) . body ( ) ; }
Deletes the specified tap configuration from the NetworkInterface .
56
11
24,470
public Observable < List < ServiceObjectiveInner > > listByServerAsync ( String resourceGroupName , String serverName ) { return listByServerWithServiceResponseAsync ( resourceGroupName , serverName ) . map ( new Func1 < ServiceResponse < List < ServiceObjectiveInner > > , List < ServiceObjectiveInner > > ( ) { @ Override public List < ServiceObjectiveInner > call ( ServiceResponse < List < ServiceObjectiveInner > > response ) { return response . body ( ) ; } } ) ; }
Returns database service objectives .
118
5
24,471
public Observable < IotHubDescriptionInner > getByResourceGroupAsync ( String resourceGroupName , String resourceName ) { return getByResourceGroupWithServiceResponseAsync ( resourceGroupName , resourceName ) . map ( new Func1 < ServiceResponse < IotHubDescriptionInner > , IotHubDescriptionInner > ( ) { @ Override public IotHubDescriptionInner call ( ServiceResponse < IotHubDescriptionInner > response ) { return response . body ( ) ; } } ) ; }
Get the non - security related metadata of an IoT hub . Get the non - security related metadata of an IoT hub .
110
24
24,472
public static void inheritClientBehaviorsAndSetPublicProperty ( IInheritedBehaviors inheritingObject , Iterable < BatchClientBehavior > baseBehaviors ) { // implement inheritance of behaviors List < BatchClientBehavior > customBehaviors = new ArrayList <> ( ) ; // if there were any behaviors, pre-populate the collection (ie: inherit) if ( null != baseBehaviors ) { for ( BatchClientBehavior be : baseBehaviors ) { customBehaviors . add ( be ) ; } } // set the public property inheritingObject . withCustomBehaviors ( customBehaviors ) ; }
Inherit the BatchClientBehavior classes from parent object
142
13
24,473
public ServiceFuture < RefreshIndex > refreshIndexMethodAsync ( String listId , final ServiceCallback < RefreshIndex > serviceCallback ) { return ServiceFuture . fromResponse ( refreshIndexMethodWithServiceResponseAsync ( listId ) , serviceCallback ) ; }
Refreshes the index of the list with list Id equal to list Id passed .
51
17
24,474
public List < SubscriptionDescription > getSubscriptions ( String topicName ) throws ServiceBusException , InterruptedException { return Utils . completeFuture ( this . asyncClient . getSubscriptionsAsync ( topicName ) ) ; }
Retrieves the list of subscriptions for a given topic in the namespace .
49
15
24,475
public QueueDescription updateQueue ( QueueDescription queueDescription ) throws ServiceBusException , InterruptedException { return Utils . completeFuture ( this . asyncClient . updateQueueAsync ( queueDescription ) ) ; }
Updates an existing queue .
44
6
24,476
public TopicDescription updateTopic ( TopicDescription topicDescription ) throws ServiceBusException , InterruptedException { return Utils . completeFuture ( this . asyncClient . updateTopicAsync ( topicDescription ) ) ; }
Updates an existing topic .
42
6
24,477
public SubscriptionDescription updateSubscription ( SubscriptionDescription subscriptionDescription ) throws ServiceBusException , InterruptedException { return Utils . completeFuture ( this . asyncClient . updateSubscriptionAsync ( subscriptionDescription ) ) ; }
Updates an existing subscription .
46
6
24,478
public static void main ( String [ ] args ) throws NoSuchAlgorithmException , InvalidKeyException { // The connection string value can be obtained by going to your App Configuration instance in the Azure portal // and navigating to "Access Keys" page under the "Settings" section. String connectionString = "endpoint={endpoint_value};id={id_value};name={secret_value}" ; // Instantiate a client that will be used to call the service. ConfigurationAsyncClient client = ConfigurationAsyncClient . builder ( ) . credentials ( new ConfigurationClientCredentials ( connectionString ) ) . build ( ) ; // Name of the key to add to the configuration service. String key = "hello" ; // setSetting adds or updates a setting to Azure Application Configuration store. Alternatively, you can call // addSetting which only succeeds if the setting does not exist in the store. Or, you can call updateSetting to // update a setting that is already present in the store. // We subscribe and wait for the service call to complete then print out the contents of our newly added setting. // If an error occurs, we print out that error. On completion of the subscription, we delete the setting. // .block() exists there so the program does not end before the deletion has completed. client . setSetting ( key , "world" ) . subscribe ( result -> { ConfigurationSetting setting = result . value ( ) ; System . out . println ( String . format ( "Key: %s, Value: %s" , setting . key ( ) , setting . value ( ) ) ) ; } , error -> System . err . println ( "There was an error adding the setting: " + error . toString ( ) ) , ( ) -> { System . out . println ( "Completed. Deleting setting..." ) ; client . deleteSetting ( key ) . block ( ) ; } ) ; }
Runs the sample algorithm and demonstrates how to add get and delete a configuration setting .
391
17
24,479
public static Creator create ( String accessPolicyId , String assetId , LocatorType locatorType ) { return new Creator ( accessPolicyId , assetId , locatorType ) ; }
Create an operation to create a new locator entity .
39
11
24,480
public static EntityGetOperation < LocatorInfo > get ( String locatorId ) { return new DefaultGetOperation < LocatorInfo > ( ENTITY_SET , locatorId , LocatorInfo . class ) ; }
Create an operation to get the given locator .
46
10
24,481
public static DefaultListOperation < LocatorInfo > list ( LinkInfo < LocatorInfo > link ) { return new DefaultListOperation < LocatorInfo > ( link . getHref ( ) , new GenericType < ListResult < LocatorInfo > > ( ) { } ) ; }
Create an operation that will list all the locators at the given link .
60
15
24,482
public static Configuration configureWithAzureAdTokenProvider ( URI apiServer , TokenProvider azureAdTokenProvider ) { return configureWithAzureAdTokenProvider ( Configuration . getInstance ( ) , apiServer , azureAdTokenProvider ) ; }
Returns the default Configuration provisioned for the specified AMS account and token provider .
51
16
24,483
public static Configuration configureWithAzureAdTokenProvider ( Configuration configuration , URI apiServer , TokenProvider azureAdTokenProvider ) { configuration . setProperty ( AZURE_AD_API_SERVER , apiServer . toString ( ) ) ; configuration . setProperty ( AZURE_AD_TOKEN_PROVIDER , azureAdTokenProvider ) ; return configuration ; }
Setup a Configuration with specified Configuration AMS account and token provider
78
12
24,484
public static AzureCliCredentials create ( ) throws IOException { return create ( Paths . get ( System . getProperty ( "user.home" ) , ".azure" , "azureProfile.json" ) . toFile ( ) , Paths . get ( System . getProperty ( "user.home" ) , ".azure" , "accessTokens.json" ) . toFile ( ) ) ; }
Creates an instance of AzureCliCredentials with the default Azure CLI configuration .
91
18
24,485
public Observable < ExtendedServerBlobAuditingPolicyInner > getAsync ( String resourceGroupName , String serverName ) { return getWithServiceResponseAsync ( resourceGroupName , serverName ) . map ( new Func1 < ServiceResponse < ExtendedServerBlobAuditingPolicyInner > , ExtendedServerBlobAuditingPolicyInner > ( ) { @ Override public ExtendedServerBlobAuditingPolicyInner call ( ServiceResponse < ExtendedServerBlobAuditingPolicyInner > response ) { return response . body ( ) ; } } ) ; }
Gets an extended server s blob auditing policy .
119
11
24,486
@ SuppressWarnings ( "unchecked" ) protected static < T extends ExpandableStringEnum < T > > T fromString ( String name , Class < T > clazz ) { if ( name == null ) { return null ; } else if ( valuesByName != null ) { T value = ( T ) valuesByName . get ( uniqueKey ( clazz , name ) ) ; if ( value != null ) { return value ; } } try { T value = clazz . newInstance ( ) ; return value . withNameValue ( name , value , clazz ) ; } catch ( InstantiationException | IllegalAccessException e ) { return null ; } }
Creates an instance of the specific expandable string enum from a String .
142
15
24,487
@ SuppressWarnings ( "unchecked" ) protected static < T extends ExpandableStringEnum < T > > Collection < T > values ( Class < T > clazz ) { // Make a copy of all values Collection < ? extends ExpandableStringEnum < ? > > values = new ArrayList <> ( valuesByName . values ( ) ) ; Collection < T > list = new HashSet < T > ( ) ; for ( ExpandableStringEnum < ? > value : values ) { if ( value . getClass ( ) . isAssignableFrom ( clazz ) ) { list . add ( ( T ) value ) ; } } return list ; }
Gets a collection of all known values to an expandable string enum type .
143
16
24,488
public static EntityCreateOperation < NotificationEndPointInfo > create ( String name , EndPointType endPointType , String endPointAddress ) { return new Creator ( name , endPointType , endPointAddress ) ; }
Creates an operation to create a new notification end point .
45
12
24,489
public static EntityGetOperation < NotificationEndPointInfo > get ( String notificationEndPointId ) { return new DefaultGetOperation < NotificationEndPointInfo > ( ENTITY_SET , notificationEndPointId , NotificationEndPointInfo . class ) ; }
Create an operation that will retrieve the given notification end point
51
11
24,490
public static EntityGetOperation < NotificationEndPointInfo > get ( LinkInfo < NotificationEndPointInfo > link ) { return new DefaultGetOperation < NotificationEndPointInfo > ( link . getHref ( ) , NotificationEndPointInfo . class ) ; }
Create an operation that will retrieve the notification end point at the given link
53
14
24,491
public Observable < List < ReplicationUsageInner > > listAsync ( String resourceGroupName , String vaultName ) { return listWithServiceResponseAsync ( resourceGroupName , vaultName ) . map ( new Func1 < ServiceResponse < List < ReplicationUsageInner > > , List < ReplicationUsageInner > > ( ) { @ Override public List < ReplicationUsageInner > call ( ServiceResponse < List < ReplicationUsageInner > > response ) { return response . body ( ) ; } } ) ; }
Fetches the replication usages of the vault .
114
11
24,492
public void delete ( String resourceGroupName , String labAccountName ) { deleteWithServiceResponseAsync ( resourceGroupName , labAccountName ) . toBlocking ( ) . last ( ) . body ( ) ; }
Delete lab account . This operation can take a while to complete .
45
13
24,493
public JobType addJobNotificationSubscriptionType ( JobNotificationSubscriptionType jobNotificationSubscription ) { if ( this . jobNotificationSubscriptionTypes == null ) { this . jobNotificationSubscriptionTypes = new ArrayList < JobNotificationSubscriptionType > ( ) ; } this . jobNotificationSubscriptionTypes . add ( jobNotificationSubscription ) ; return this ; }
Adds the job notification subscription type .
84
7
24,494
public static String formatSubscriptionPath ( String topicPath , String subscriptionName ) { return String . join ( pathDelimiter , topicPath , subscriptionsSubPath , subscriptionName ) ; }
Formats the subscription path based on the topic path and subscription name .
39
14
24,495
public static String formatRulePath ( String topicPath , String subscriptionName , String ruleName ) { return String . join ( pathDelimiter , topicPath , subscriptionsSubPath , subscriptionName , rulesSubPath , ruleName ) ; }
Formats the rule path based on the topic path subscription name and the rule name .
49
17
24,496
public Response < ConfigurationSetting > addSetting ( String key , String value ) { return addSetting ( new ConfigurationSetting ( ) . key ( key ) . value ( value ) ) ; }
Adds a configuration value in the service if that key does not exist .
38
14
24,497
public Response < ConfigurationSetting > setSetting ( String key , String value ) { return setSetting ( new ConfigurationSetting ( ) . key ( key ) . value ( value ) ) ; }
Creates or updates a configuration value in the service with the given key .
38
15
24,498
public Response < ConfigurationSetting > updateSetting ( String key , String value ) { return updateSetting ( new ConfigurationSetting ( ) . key ( key ) . value ( value ) ) ; }
Updates an existing configuration value in the service with the given key . The setting must already exist .
38
20
24,499
public void delete ( String resourceGroupName , String serverName , String jobAgentName , String credentialName ) { deleteWithServiceResponseAsync ( resourceGroupName , serverName , jobAgentName , credentialName ) . toBlocking ( ) . single ( ) . body ( ) ; }
Deletes a job credential .
59
6