idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
149,700
public void updateBuildpackInstallations ( String appName , List < String > buildpacks ) { connection . execute ( new BuildpackInstallationUpdate ( appName , buildpacks ) , apiKey ) ; }
Update the list of buildpacks installed on an app
149,701
static Artifact resolveConstrained ( MavenProject project , String gav , Pattern versionRegex , ArtifactResolver resolver ) throws VersionRangeResolutionException , ArtifactResolutionException { boolean latest = gav . endsWith ( ":LATEST" ) ; if ( latest || gav . endsWith ( ":RELEASE" ) ) { Artifact a = new DefaultArti...
Resolves the gav using the resolver . If the gav corresponds to the project artifact and is an unresolved version for a RELEASE or LATEST the gav is resolved such it a release not newer than the project version is found that optionally corresponds to the provided version regex if provided .
149,702
public static < X > ServiceTypeLoader < X > load ( Class < X > serviceType ) { return load ( serviceType , Thread . currentThread ( ) . getContextClassLoader ( ) ) ; }
Locates the services in the context classloader of the current thread .
149,703
public static String stringifyJavascriptObject ( Object object ) { StringBuilder bld = new StringBuilder ( ) ; stringify ( object , bld ) ; return bld . toString ( ) ; }
Converts the provided javascript object to JSON string .
149,704
@ SuppressWarnings ( "unchecked" ) protected < T extends JavaElement > ActiveElements < T > popIfActive ( ) { return ( ActiveElements < T > ) ( ! activations . isEmpty ( ) && activations . peek ( ) . depth == depth ? activations . pop ( ) : null ) ; }
Pops the top of the stack of active elements if the current position in the call stack corresponds to the one that pushed the active elements .
149,705
public static Builder builder ( Revapi revapi ) { List < String > knownExtensionIds = new ArrayList < > ( ) ; addExtensionIds ( revapi . getPipelineConfiguration ( ) . getApiAnalyzerTypes ( ) , knownExtensionIds ) ; addExtensionIds ( revapi . getPipelineConfiguration ( ) . getTransformTypes ( ) , knownExtensionIds ) ; ...
Returns a new analysis context builder that extracts the information about the available extensions from the provided Revapi instance .
149,706
public AnalysisContext copyWithConfiguration ( ModelNode configuration ) { return new AnalysisContext ( this . locale , configuration , this . oldApi , this . newApi , this . data ) ; }
This is generally only useful for extensions that delegate some of their functionality to other internal extensions of their own that they need to configure .
149,707
public static PipelineConfiguration . Builder parse ( ModelNode json ) { ModelNode analyzerIncludeNode = json . get ( "analyzers" ) . get ( "include" ) ; ModelNode analyzerExcludeNode = json . get ( "analyzers" ) . get ( "exclude" ) ; ModelNode filterIncludeNode = json . get ( "filters" ) . get ( "include" ) ; ModelNod...
Parses the configuration node and provides a pipeline configuration without any extensions marked for loading . The configuration node is supposed to conform to the pipeline configuration JSON schema .
149,708
private static void firstDotConstellation ( int [ ] dollarPositions , int [ ] dotPositions , int nestingLevel ) { int i = 0 ; int unassigned = dotPositions . length - nestingLevel ; for ( ; i < unassigned ; ++ i ) { dotPositions [ i ] = - 1 ; } for ( ; i < dotPositions . length ; ++ i ) { dotPositions [ i ] = dollarPos...
This will set the last nestingLevel elements in the dotPositions to the values present in the dollarPositions . The rest will be set to - 1 .
149,709
public static AnalysisResult fakeSuccess ( ) { return new AnalysisResult ( null , new Extensions ( Collections . emptyMap ( ) , Collections . emptyMap ( ) , Collections . emptyMap ( ) , Collections . emptyMap ( ) ) ) ; }
A factory method for users that need to report success without actually running any analysis . The returned result will be successful but will not contain the actual configurations of extensions .
149,710
static PlexusConfiguration convert ( ModelNode configuration , ModelNode jsonSchema , String extensionId , String id ) { ConversionContext ctx = new ConversionContext ( ) ; ctx . currentSchema = jsonSchema ; ctx . rootSchema = jsonSchema ; ctx . pushTag ( extensionId ) ; ctx . id = id ; return convert ( configuration ,...
visibility increased for testing
149,711
@ SuppressWarnings ( "unchecked" ) public < T extends Annotation > T getAnnotation ( Class < T > annotationType ) { for ( Annotation annotation : this . annotations ) { if ( annotation . annotationType ( ) . equals ( annotationType ) ) { return ( T ) annotation ; } } for ( Annotation metaAnn : this . annotations ) { T ...
Obtain the annotation associated with this type descriptor of the specified type .
149,712
public static String encodeScheme ( String scheme , String encoding ) throws UnsupportedEncodingException { return HierarchicalUriComponents . encodeUriComponent ( scheme , encoding , HierarchicalUriComponents . Type . SCHEME ) ; }
Encodes the given URI scheme with the given encoding .
149,713
public static String encodeAuthority ( String authority , String encoding ) throws UnsupportedEncodingException { return HierarchicalUriComponents . encodeUriComponent ( authority , encoding , HierarchicalUriComponents . Type . AUTHORITY ) ; }
Encodes the given URI authority with the given encoding .
149,714
public static String encodeUserInfo ( String userInfo , String encoding ) throws UnsupportedEncodingException { return HierarchicalUriComponents . encodeUriComponent ( userInfo , encoding , HierarchicalUriComponents . Type . USER_INFO ) ; }
Encodes the given URI user info with the given encoding .
149,715
public static String encodeHost ( String host , String encoding ) throws UnsupportedEncodingException { return HierarchicalUriComponents . encodeUriComponent ( host , encoding , HierarchicalUriComponents . Type . HOST_IPV4 ) ; }
Encodes the given URI host with the given encoding .
149,716
public static String encodePort ( String port , String encoding ) throws UnsupportedEncodingException { return HierarchicalUriComponents . encodeUriComponent ( port , encoding , HierarchicalUriComponents . Type . PORT ) ; }
Encodes the given URI port with the given encoding .
149,717
public static String encodePath ( String path , String encoding ) throws UnsupportedEncodingException { return HierarchicalUriComponents . encodeUriComponent ( path , encoding , HierarchicalUriComponents . Type . PATH ) ; }
Encodes the given URI path with the given encoding .
149,718
public static String encodePathSegment ( String segment , String encoding ) throws UnsupportedEncodingException { return HierarchicalUriComponents . encodeUriComponent ( segment , encoding , HierarchicalUriComponents . Type . PATH_SEGMENT ) ; }
Encodes the given URI path segment with the given encoding .
149,719
public static String encodeQuery ( String query , String encoding ) throws UnsupportedEncodingException { return HierarchicalUriComponents . encodeUriComponent ( query , encoding , HierarchicalUriComponents . Type . QUERY ) ; }
Encodes the given URI query with the given encoding .
149,720
public static String encodeQueryParam ( String queryParam , String encoding ) throws UnsupportedEncodingException { return HierarchicalUriComponents . encodeUriComponent ( queryParam , encoding , HierarchicalUriComponents . Type . QUERY_PARAM ) ; }
Encodes the given URI query parameter with the given encoding .
149,721
public static String encodeFragment ( String fragment , String encoding ) throws UnsupportedEncodingException { return HierarchicalUriComponents . encodeUriComponent ( fragment , encoding , HierarchicalUriComponents . Type . FRAGMENT ) ; }
Encodes the given URI fragment with the given encoding .
149,722
public void setReadTimeout ( int readTimeout ) { this . client = this . client . newBuilder ( ) . readTimeout ( readTimeout , TimeUnit . MILLISECONDS ) . build ( ) ; }
Sets the underlying read timeout in milliseconds . A value of 0 specifies an infinite timeout .
149,723
public void setWriteTimeout ( int writeTimeout ) { this . client = this . client . newBuilder ( ) . writeTimeout ( writeTimeout , TimeUnit . MILLISECONDS ) . build ( ) ; }
Sets the underlying write timeout in milliseconds . A value of 0 specifies an infinite timeout .
149,724
public void setConnectTimeout ( int connectTimeout ) { this . client = this . client . newBuilder ( ) . connectTimeout ( connectTimeout , TimeUnit . MILLISECONDS ) . build ( ) ; }
Sets the underlying connect timeout in milliseconds . A value of 0 specifies an infinite timeout .
149,725
public void addComparator ( Comparator < T > comparator , boolean ascending ) { this . comparators . add ( new InvertibleComparator < T > ( comparator , ascending ) ) ; }
Add a Comparator to the end of the chain using the provided sort order .
149,726
public static void copy ( String in , Writer out ) throws IOException { Assert . notNull ( in , "No input String specified" ) ; Assert . notNull ( out , "No Writer specified" ) ; try { out . write ( in ) ; } finally { try { out . close ( ) ; } catch ( IOException ex ) { } } }
Copy the contents of the given String to the given output Writer . Closes the writer when done .
149,727
public boolean matches ( String uri ) { if ( uri == null ) { return false ; } Matcher matcher = this . matchPattern . matcher ( uri ) ; return matcher . matches ( ) ; }
Indicate whether the given URI matches this template .
149,728
public boolean exists ( ) { try { return getFile ( ) . exists ( ) ; } catch ( IOException ex ) { try { InputStream is = getInputStream ( ) ; is . close ( ) ; return true ; } catch ( Throwable isEx ) { return false ; } } }
This implementation checks whether a File can be opened falling back to whether an InputStream can be opened . This will cover both directories and content resources .
149,729
static String expandUriComponent ( String source , UriTemplateVariables uriVariables ) { if ( source == null ) { return null ; } if ( source . indexOf ( '{' ) == - 1 ) { return source ; } Matcher matcher = NAMES_PATTERN . matcher ( source ) ; StringBuffer sb = new StringBuffer ( ) ; while ( matcher . find ( ) ) { Strin...
static expansion helpers
149,730
public static boolean isAssignable ( Type lhsType , Type rhsType ) { Assert . notNull ( lhsType , "Left-hand side type must not be null" ) ; Assert . notNull ( rhsType , "Right-hand side type must not be null" ) ; if ( lhsType . equals ( rhsType ) || lhsType . equals ( Object . class ) ) { return true ; } if ( lhsType ...
Check if the right - hand side type may be assigned to the left - hand side type following the Java generics rules .
149,731
static String encodeUriComponent ( String source , String encoding , Type type ) throws UnsupportedEncodingException { if ( source == null ) { return null ; } Assert . hasLength ( encoding , "Encoding must not be empty" ) ; byte [ ] bytes = encodeBytes ( source . getBytes ( encoding ) , type ) ; return new String ( byt...
Encodes the given source into an encoded String using the rules specified by the given component and with the given options .
149,732
protected HttpUriRequest createHttpRequest ( HttpMethod httpMethod , URI uri ) { switch ( httpMethod ) { case GET : return new HttpGet ( uri ) ; case DELETE : return new HttpDelete ( uri ) ; case HEAD : return new HttpHead ( uri ) ; case OPTIONS : return new HttpOptions ( uri ) ; case POST : return new HttpPost ( uri )...
Create a HttpComponents HttpUriRequest object for the given HTTP method and URI specification .
149,733
public static void registerConverters ( Set < ? > converters , ConverterRegistry registry ) { if ( converters != null ) { for ( Object converter : converters ) { if ( converter instanceof GenericConverter ) { registry . addConverter ( ( GenericConverter ) converter ) ; } else if ( converter instanceof Converter < ? , ?...
Register the given Converter objects with the given target ConverterRegistry .
149,734
public static < K , V > MultiValueMap < K , V > unmodifiableMultiValueMap ( MultiValueMap < ? extends K , ? extends V > map ) { Assert . notNull ( map , "'map' must not be null" ) ; Map < K , List < V > > result = new LinkedHashMap < K , List < V > > ( map . size ( ) ) ; for ( Map . Entry < ? extends K , ? extends List...
Returns an unmodifiable view of the specified multi - value map .
149,735
public static String copyToString ( InputStream in , Charset charset ) throws IOException { Assert . notNull ( in , "No InputStream specified" ) ; StringBuilder out = new StringBuilder ( ) ; InputStreamReader reader = new InputStreamReader ( in , charset ) ; char [ ] buffer = new char [ BUFFER_SIZE ] ; int bytesRead = ...
Copy the contents of the given InputStream into a String . Leaves the stream open when done .
149,736
public static void copy ( byte [ ] in , OutputStream out ) throws IOException { Assert . notNull ( in , "No input byte array specified" ) ; Assert . notNull ( out , "No OutputStream specified" ) ; out . write ( in ) ; }
Copy the contents of the given byte array to the given OutputStream . Leaves the stream open when done .
149,737
private int handleIOException ( IOException ex ) throws IOException { if ( AUTH_ERROR . equals ( ex . getMessage ( ) ) || AUTH_ERROR_JELLY_BEAN . equals ( ex . getMessage ( ) ) ) { return HttpStatus . UNAUTHORIZED . value ( ) ; } else if ( PROXY_AUTH_ERROR . equals ( ex . getMessage ( ) ) ) { return HttpStatus . PROXY_...
If credentials are incorrect or not provided for Basic Auth then Android may throw this exception when an HTTP 401 is received . A separate exception is thrown for proxy authentication errors . Checking for this response and returning the proper status .
149,738
public static TextEncryptor queryableText ( CharSequence password , CharSequence salt ) { return new HexEncodingTextEncryptor ( new AndroidAesBytesEncryptor ( password . toString ( ) , salt , AndroidKeyGenerators . shared ( 16 ) ) ) ; }
Creates an encryptor for queryable text strings that uses standard password - based encryption . Uses a shared or constant 16 byte initialization vector so encrypting the same data results in the same encryption result . This is done to allow encrypted data to be queried against . Encrypted text is hex - encoded .
149,739
public static UriComponentsBuilder fromPath ( String path ) { UriComponentsBuilder builder = new UriComponentsBuilder ( ) ; builder . path ( path ) ; return builder ; }
Returns a builder that is initialized with the given path .
149,740
public UriComponentsBuilder uri ( URI uri ) { Assert . notNull ( uri , "'uri' must not be null" ) ; this . scheme = uri . getScheme ( ) ; if ( uri . isOpaque ( ) ) { this . ssp = uri . getRawSchemeSpecificPart ( ) ; resetHierarchicalComponents ( ) ; } else { if ( uri . getRawUserInfo ( ) != null ) { this . userInfo = u...
Initialize all components of this URI builder with the components of the given URI .
149,741
public UriComponentsBuilder pathSegment ( String ... pathSegments ) throws IllegalArgumentException { Assert . notNull ( pathSegments , "'segments' must not be null" ) ; this . pathBuilder . addPathSegments ( pathSegments ) ; resetSchemeSpecificPart ( ) ; return this ; }
Append the given path segments to the existing path of this builder . Each given path segment may contain URI template variables .
149,742
public UriComponentsBuilder queryParams ( MultiValueMap < String , String > params ) { Assert . notNull ( params , "'params' must not be null" ) ; this . queryParams . putAll ( params ) ; return this ; }
Add the given query parameters .
149,743
public UriComponentsBuilder replaceQueryParam ( String name , Object ... values ) { Assert . notNull ( name , "'name' must not be null" ) ; this . queryParams . remove ( name ) ; if ( ! ObjectUtils . isEmpty ( values ) ) { queryParam ( name , values ) ; } resetSchemeSpecificPart ( ) ; return this ; }
Set the query parameter values overriding all existing query values for the same parameter . If no values are given the query parameter is removed .
149,744
private static void registerCommonClasses ( Class < ? > ... commonClasses ) { for ( Class < ? > clazz : commonClasses ) { commonClassCache . put ( clazz . getName ( ) , clazz ) ; } }
Register the given common classes with the ClassUtils cache .
149,745
public static ClassLoader overrideThreadContextClassLoader ( ClassLoader classLoaderToUse ) { Thread currentThread = Thread . currentThread ( ) ; ClassLoader threadContextClassLoader = currentThread . getContextClassLoader ( ) ; if ( classLoaderToUse != null && ! classLoaderToUse . equals ( threadContextClassLoader ) )...
Override the thread context ClassLoader with the environment s bean ClassLoader if necessary i . e . if the bean ClassLoader is not equivalent to the thread context ClassLoader already .
149,746
public static boolean isCacheSafe ( Class < ? > clazz , ClassLoader classLoader ) { Assert . notNull ( clazz , "Class must not be null" ) ; try { ClassLoader target = clazz . getClassLoader ( ) ; if ( target == null ) { return true ; } ClassLoader cur = classLoader ; if ( cur == target ) { return true ; } while ( cur !...
Check whether the given class is cache - safe in the given context i . e . whether it is loaded by the given ClassLoader or a parent of it .
149,747
public static String getShortName ( String className ) { Assert . hasLength ( className , "Class name must not be empty" ) ; int lastDotIndex = className . lastIndexOf ( PACKAGE_SEPARATOR ) ; int nameEndIndex = className . indexOf ( CGLIB_CLASS_SEPARATOR ) ; if ( nameEndIndex == - 1 ) { nameEndIndex = className . lengt...
Get the class name without the qualified package name .
149,748
public static Method getStaticMethod ( Class < ? > clazz , String methodName , Class < ? > ... args ) { Assert . notNull ( clazz , "Class must not be null" ) ; Assert . notNull ( methodName , "Method name must not be null" ) ; try { Method method = clazz . getMethod ( methodName , args ) ; return Modifier . isStatic ( ...
Return a public static method of a class .
149,749
public static boolean isPrimitiveArray ( Class < ? > clazz ) { Assert . notNull ( clazz , "Class must not be null" ) ; return ( clazz . isArray ( ) && clazz . getComponentType ( ) . isPrimitive ( ) ) ; }
Check if the given class represents an array of primitives i . e . boolean byte char short int long float or double .
149,750
public static boolean isPrimitiveWrapperArray ( Class < ? > clazz ) { Assert . notNull ( clazz , "Class must not be null" ) ; return ( clazz . isArray ( ) && isPrimitiveWrapper ( clazz . getComponentType ( ) ) ) ; }
Check if the given class represents an array of primitive wrappers i . e . Boolean Byte Character Short Integer Long Float or Double .
149,751
public static Class < ? > resolvePrimitiveIfNecessary ( Class < ? > clazz ) { Assert . notNull ( clazz , "Class must not be null" ) ; return ( clazz . isPrimitive ( ) && clazz != void . class ? primitiveTypeToWrapperMap . get ( clazz ) : clazz ) ; }
Resolve the given class if it is a primitive class returning the corresponding primitive wrapper type instead .
149,752
public static Class < ? > [ ] toClassArray ( Collection < Class < ? > > collection ) { if ( collection == null ) { return null ; } return collection . toArray ( new Class < ? > [ collection . size ( ) ] ) ; }
Copy the given Collection into a Class array . The Collection must contain Class elements only .
149,753
public static Class < ? > determineCommonAncestor ( Class < ? > clazz1 , Class < ? > clazz2 ) { if ( clazz1 == null ) { return clazz2 ; } if ( clazz2 == null ) { return clazz1 ; } if ( clazz1 . isAssignableFrom ( clazz2 ) ) { return clazz1 ; } if ( clazz2 . isAssignableFrom ( clazz1 ) ) { return clazz2 ; } Class < ? > ...
Determine the common ancestor of the given classes if any .
149,754
public static Class < ? > resolveReturnType ( Method method , Class < ? > clazz ) { Assert . notNull ( method , "Method must not be null" ) ; Type genericType = method . getGenericReturnType ( ) ; Assert . notNull ( clazz , "Class must not be null" ) ; Map < TypeVariable , Type > typeVariableMap = getTypeVariableMap ( ...
Determine the target type for the generic return type of the given method where formal type variables are declared on the given class .
149,755
public static Class < ? > resolveReturnTypeArgument ( Method method , Class < ? > genericIfc ) { Assert . notNull ( method , "method must not be null" ) ; Type returnType = method . getReturnType ( ) ; Type genericReturnType = method . getGenericReturnType ( ) ; if ( returnType . equals ( genericIfc ) ) { if ( genericR...
Resolve the single type argument of the given generic interface against the given target method which is assumed to return the given interface or an implementation of it .
149,756
public static Class < ? > resolveTypeArgument ( Class < ? > clazz , Class < ? > genericIfc ) { Class < ? > [ ] typeArgs = resolveTypeArguments ( clazz , genericIfc ) ; if ( typeArgs == null ) { return null ; } if ( typeArgs . length != 1 ) { throw new IllegalArgumentException ( "Expected 1 type argument on generic inte...
Resolve the single type argument of the given generic interface against the given target class which is assumed to implement the generic interface and possibly declare a concrete type for its type variable .
149,757
private static Class < ? > extractClass ( Class < ? > ownerClass , Type arg ) { if ( arg instanceof ParameterizedType ) { return extractClass ( ownerClass , ( ( ParameterizedType ) arg ) . getRawType ( ) ) ; } else if ( arg instanceof GenericArrayType ) { GenericArrayType gat = ( GenericArrayType ) arg ; Type gt = gat ...
Extract a Class from the given Type .
149,758
static Type getRawType ( Type genericType , Map < TypeVariable , Type > typeVariableMap ) { Type resolvedType = genericType ; if ( genericType instanceof TypeVariable ) { TypeVariable tv = ( TypeVariable ) genericType ; resolvedType = typeVariableMap . get ( tv ) ; if ( resolvedType == null ) { resolvedType = extractBo...
Determine the raw type for the given generic parameter type .
149,759
public static Class < ? > getMapValueFieldType ( Field mapField , int nestingLevel ) { return getGenericFieldType ( mapField , Map . class , 1 , null , nestingLevel ) ; }
Determine the generic value type of the given Map field .
149,760
private static Class < ? > getGenericReturnType ( Method method , Class < ? > source , int typeIndex , int nestingLevel ) { return extractType ( method . getGenericReturnType ( ) , source , typeIndex , null , null , nestingLevel , 1 ) ; }
Extract the generic return type from the given method .
149,761
private static Class < ? > extractTypeFromClass ( Class < ? > clazz , Class < ? > source , int typeIndex , Map < TypeVariable , Type > typeVariableMap , Map < Integer , Integer > typeIndexesPerLevel , int nestingLevel , int currentLevel ) { if ( clazz . getName ( ) . startsWith ( "java.util." ) ) { return null ; } if (...
Extract the generic type from the given Class object .
149,762
public boolean exists ( ) { try { InputStream inputStream = this . assetManager . open ( this . fileName ) ; if ( inputStream != null ) { return true ; } else { return false ; } } catch ( IOException e ) { return false ; } }
This implementation returns whether the underlying asset exists .
149,763
static void addHeaders ( HttpUriRequest httpRequest , HttpHeaders headers ) { for ( Map . Entry < String , List < String > > entry : headers . entrySet ( ) ) { String headerName = entry . getKey ( ) ; if ( HttpHeaders . COOKIE . equalsIgnoreCase ( headerName ) ) { String headerValue = StringUtils . collectionToDelimite...
Add the given headers to the given HTTP request .
149,764
public boolean canBypassConvert ( TypeDescriptor sourceType , TypeDescriptor targetType ) { Assert . notNull ( targetType , "The targetType to convert to cannot be null" ) ; if ( sourceType == null ) { return true ; } GenericConverter converter = getConverter ( sourceType , targetType ) ; return ( converter == NO_OP_CO...
Returns true if conversion between the sourceType and targetType can be bypassed . More precisely this method will return true if objects of sourceType can be converted to the targetType by returning the source object unchanged .
149,765
protected static int calculateShift ( int minimumValue , int maximumValue ) { int shift = 0 ; int value = 1 ; while ( value < minimumValue && value < maximumValue ) { value <<= 1 ; shift ++ ; } return shift ; }
Calculate a shift value that can be used to create a power - of - two value between the specified maximum and minimum values .
149,766
public MediaType copyQualityValue ( MediaType mediaType ) { if ( ! mediaType . parameters . containsKey ( PARAM_QUALITY_FACTOR ) ) { return this ; } Map < String , String > params = new LinkedHashMap < String , String > ( this . parameters ) ; params . put ( PARAM_QUALITY_FACTOR , mediaType . parameters . get ( PARAM_Q...
Return a replica of this instance with the quality value of the given MediaType .
149,767
public MediaType removeQualityValue ( ) { if ( ! this . parameters . containsKey ( PARAM_QUALITY_FACTOR ) ) { return this ; } Map < String , String > params = new LinkedHashMap < String , String > ( this . parameters ) ; params . remove ( PARAM_QUALITY_FACTOR ) ; return new MediaType ( this , params ) ; }
Return a replica of this instance with its quality value removed .
149,768
public String getFirst ( String headerName ) { List < String > headerValues = headers . get ( headerName ) ; return headerValues != null ? headerValues . get ( 0 ) : null ; }
Return the first header value for the given header name if any .
149,769
public void add ( String headerName , String headerValue ) { List < String > headerValues = headers . get ( headerName ) ; if ( headerValues == null ) { headerValues = new LinkedList < String > ( ) ; this . headers . put ( headerName , headerValues ) ; } headerValues . add ( headerValue ) ; }
Add the given single header value under the given name .
149,770
public void set ( String headerName , String headerValue ) { List < String > headerValues = new LinkedList < String > ( ) ; headerValues . add ( headerValue ) ; headers . put ( headerName , headerValues ) ; }
Set the given single header value under the given name .
149,771
private void setViewPagerScroller ( ) { try { Field scrollerField = ViewPager . class . getDeclaredField ( "mScroller" ) ; scrollerField . setAccessible ( true ) ; Field interpolatorField = ViewPager . class . getDeclaredField ( "sInterpolator" ) ; interpolatorField . setAccessible ( true ) ; scroller = new CustomDurat...
set ViewPager scroller to change animation duration when sliding
149,772
public void scrollOnce ( ) { PagerAdapter adapter = getAdapter ( ) ; int currentItem = getCurrentItem ( ) ; int totalCount ; if ( adapter == null || ( totalCount = adapter . getCount ( ) ) <= 1 ) { return ; } int nextItem = ( direction == LEFT ) ? -- currentItem : ++ currentItem ; if ( nextItem < 0 ) { if ( isCycle ) {...
scroll only once
149,773
public void setHomeAsUpIndicator ( Drawable indicator ) { if ( ! deviceSupportMultiPane ( ) ) { pulsante . setHomeAsUpIndicator ( indicator ) ; } else { actionBar . setHomeAsUpIndicator ( indicator ) ; } }
Set the HomeAsUpIndicator that is visible when user navigate to a fragment child
149,774
public MaterialSection getSectionByTitle ( String title ) { for ( MaterialSection section : sectionList ) { if ( section . getTitle ( ) . equals ( title ) ) { return section ; } } for ( MaterialSection section : bottomSectionList ) { if ( section . getTitle ( ) . equals ( title ) ) return section ; } return null ; }
Get a setted section knowing his title
149,775
public List < MaterialSection > getSectionList ( ) { List < MaterialSection > list = new LinkedList < > ( ) ; for ( MaterialSection section : sectionList ) list . add ( section ) ; for ( MaterialSection section : bottomSectionList ) list . add ( section ) ; return list ; }
Get the section list
149,776
public MaterialAccount getAccountAtCurrentPosition ( int position ) { if ( position < 0 || position >= accountManager . size ( ) ) throw new RuntimeException ( "Account Index Overflow" ) ; return findAccountNumber ( position ) ; }
Get the account knowing his position
149,777
public MaterialAccount getAccountByTitle ( String title ) { for ( MaterialAccount account : accountManager ) if ( currentAccount . getTitle ( ) . equals ( title ) ) return account ; return null ; }
Get the account knowing his title
149,778
@ SuppressLint ( "NewApi" ) public boolean onTouch ( View v , MotionEvent event ) { if ( touchable ) { if ( event . getAction ( ) == MotionEvent . ACTION_DOWN ) { view . setBackgroundColor ( colorPressed ) ; return true ; } if ( event . getAction ( ) == MotionEvent . ACTION_CANCEL ) { if ( isSelected ) view . setBackgr...
touch event without ripple support
149,779
public void setBackgroundColor ( int color ) { colorUnpressed = color ; if ( ! isSelected ( ) ) { if ( rippleAnimationSupport ( ) ) { ripple . setRippleBackground ( colorUnpressed ) ; } else { view . setBackgroundColor ( colorUnpressed ) ; } } }
alias of setColorUnpressed
149,780
public List < NodeInfo > getNodes ( ) { final URI uri = uriWithPath ( "./nodes/" ) ; return Arrays . asList ( this . rt . getForObject ( uri , NodeInfo [ ] . class ) ) ; }
Retrieves state and metrics information for all nodes in the cluster .
149,781
public NodeInfo getNode ( String name ) { final URI uri = uriWithPath ( "./nodes/" + encodePathSegment ( name ) ) ; return this . rt . getForObject ( uri , NodeInfo . class ) ; }
Retrieves state and metrics information for individual node .
149,782
public List < ConnectionInfo > getConnections ( ) { final URI uri = uriWithPath ( "./connections/" ) ; return Arrays . asList ( this . rt . getForObject ( uri , ConnectionInfo [ ] . class ) ) ; }
Retrieves state and metrics information for all client connections across the cluster .
149,783
public ConnectionInfo getConnection ( String name ) { final URI uri = uriWithPath ( "./connections/" + encodePathSegment ( name ) ) ; return this . rt . getForObject ( uri , ConnectionInfo . class ) ; }
Retrieves state and metrics information for individual client connection .
149,784
public List < ChannelInfo > getChannels ( ) { final URI uri = uriWithPath ( "./channels/" ) ; return Arrays . asList ( this . rt . getForObject ( uri , ChannelInfo [ ] . class ) ) ; }
Retrieves state and metrics information for all channels across the cluster .
149,785
public List < ChannelInfo > getChannels ( String connectionName ) { final URI uri = uriWithPath ( "./connections/" + encodePathSegment ( connectionName ) + "/channels/" ) ; return Arrays . asList ( this . rt . getForObject ( uri , ChannelInfo [ ] . class ) ) ; }
Retrieves state and metrics information for all channels on individual connection .
149,786
public ChannelInfo getChannel ( String name ) { final URI uri = uriWithPath ( "./channels/" + encodePathSegment ( name ) ) ; return this . rt . getForObject ( uri , ChannelInfo . class ) ; }
Retrieves state and metrics information for individual channel .
149,787
public List < BindingInfo > getQueueBindings ( String vhost , String queue ) { final URI uri = uriWithPath ( "./queues/" + encodePathSegment ( vhost ) + "/" + encodePathSegment ( queue ) + "/bindings" ) ; final BindingInfo [ ] result = this . rt . getForObject ( uri , BindingInfo [ ] . class ) ; return asListOrNull ( r...
Returns a list of bindings where provided queue is the destination .
149,788
public void declareShovel ( String vhost , ShovelInfo info ) { Map < String , Object > props = info . getDetails ( ) . getPublishProperties ( ) ; if ( props != null && props . isEmpty ( ) ) { throw new IllegalArgumentException ( "Shovel publish properties must be a non-empty map or null" ) ; } final URI uri = uriWithPa...
Declares a shovel .
149,789
public void deleteShovel ( String vhost , String shovelname ) { this . deleteIgnoring404 ( uriWithPath ( "./parameters/shovel/" + encodePathSegment ( vhost ) + "/" + encodePathSegment ( shovelname ) ) ) ; }
Deletes the specified shovel from specified virtual host .
149,790
public void setCharTranslator ( CharacterTranslator charTranslator ) { if ( charTranslator != null ) { this . charTranslator = charTranslator ; this . htmlElementTranslator = null ; this . targetTranslator = null ; } }
Sets the character translator . It will also remove any other translator set . Nothing will happen if the argument is null .
149,791
public void setHtmlElementTranslator ( HtmlElementTranslator htmlElementTranslator ) { if ( htmlElementTranslator != null ) { this . htmlElementTranslator = htmlElementTranslator ; this . charTranslator = null ; this . targetTranslator = null ; } }
Sets the HTML entity translator . It will also remove any other translator set . Nothing will happen if the argument is null .
149,792
public AT_CellContext setPadding ( int padding ) { if ( padding > - 1 ) { this . paddingTop = padding ; this . paddingBottom = padding ; this . paddingLeft = padding ; this . paddingRight = padding ; } return this ; }
Sets all padding to the same value .
149,793
public void setTargetTranslator ( TargetTranslator targetTranslator ) { if ( targetTranslator != null ) { this . targetTranslator = targetTranslator ; this . charTranslator = null ; this . htmlElementTranslator = null ; } }
Sets the target translator . It will also remove any other translator set . Nothing will happen if the argument is null .
149,794
public static int [ ] longestWord ( LinkedList < AT_Row > rows , int colNumbers ) { if ( rows == null ) { return null ; } if ( rows . size ( ) == 0 ) { return new int [ 0 ] ; } int [ ] ret = new int [ colNumbers ] ; for ( AT_Row row : rows ) { if ( row . getType ( ) == TableRowType . CONTENT ) { LinkedList < AT_Cell > ...
Returns an array with the width of the longest word per column calculated from the given table . Default padding will be added per column . Padding for individual columns will be added if defined .
149,795
public static AT_Row createRule ( TableRowType type , TableRowStyle style ) { Validate . notNull ( type ) ; Validate . validState ( type != TableRowType . UNKNOWN ) ; Validate . validState ( type != TableRowType . CONTENT ) ; Validate . notNull ( style ) ; Validate . validState ( style != TableRowStyle . UNKNOWN ) ; re...
Creates a new row representing a rule .
149,796
public static AT_Row createContentRow ( Object [ ] content , TableRowStyle style ) { Validate . notNull ( content ) ; Validate . notNull ( style ) ; Validate . validState ( style != TableRowStyle . UNKNOWN ) ; LinkedList < AT_Cell > cells = new LinkedList < AT_Cell > ( ) ; for ( Object o : content ) { cells . add ( new...
Creates a new row with content with given cell context and a normal row style .
149,797
public AT_Row setPadding ( int padding ) { if ( this . hasCells ( ) ) { for ( AT_Cell cell : this . getCells ( ) ) { cell . getContext ( ) . setPadding ( padding ) ; } } return this ; }
Sets all padding for all cells in the row to the same value .
149,798
public AT_Row setPaddingBottom ( int paddingBottom ) { if ( this . hasCells ( ) ) { for ( AT_Cell cell : this . getCells ( ) ) { cell . getContext ( ) . setPaddingBottom ( paddingBottom ) ; } } return this ; }
Sets the bottom padding for all cells in the row .
149,799
public AT_Row setPaddingBottomChar ( Character paddingBottomChar ) { if ( this . hasCells ( ) ) { for ( AT_Cell cell : this . getCells ( ) ) { cell . getContext ( ) . setPaddingBottomChar ( paddingBottomChar ) ; } } return this ; }
Sets the bottom padding character for all cells in the row .