idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
38,600 | private static < T > Extension < T > parseBinderExtensionElement ( Element element ) { @ SuppressWarnings ( "unchecked" ) Class < T > providerClass = ( Class < T > ) lookupClass ( element . getAttribute ( "class" ) ) ; Class < ? > implementationClass = lookupClass ( element . getAttribute ( "implementationClass" ) ) ; ... | Parse the extension element | 364 | 5 |
38,601 | private static Class < ? > lookupClass ( String elementName ) { Class < ? > clazz = null ; try { clazz = ClassLoaderUtils . getClassLoader ( ) . loadClass ( elementName ) ; } catch ( ClassNotFoundException e ) { return null ; } return clazz ; } | Helper method that given a class - name will create the appropriate Class instance | 65 | 14 |
38,602 | private < T > Class < ? extends Annotation > matchAnnotationToScope ( Annotation [ ] annotations ) { for ( Annotation next : annotations ) { Class < ? extends Annotation > nextType = next . annotationType ( ) ; if ( nextType . getAnnotation ( BindingScope . class ) != null ) { return nextType ; } } return DefaultBindin... | Helper method for matching and returning a scope annotation | 82 | 9 |
38,603 | protected String constructMessage ( String message , Throwable cause ) { if ( cause != null ) { StringBuilder strBuilder = new StringBuilder ( ) ; if ( message != null ) { strBuilder . append ( message ) . append ( ": " ) ; } strBuilder . append ( "Wrapped exception is {" ) . append ( cause ) ; strBuilder . append ( "}... | Constructs an exception String with the given message and incorporating the causing exception | 98 | 14 |
38,604 | public Throwable getRootCause ( ) { Throwable rootCause = null ; Throwable nextCause = getCause ( ) ; while ( nextCause != null && ! nextCause . equals ( rootCause ) ) { rootCause = nextCause ; nextCause = nextCause . getCause ( ) ; } return rootCause ; } | Retrieves the ultimate root cause for this exception or null | 67 | 12 |
38,605 | public < E extends Exception > E findWrapped ( Class < E > exceptionType ) { if ( exceptionType == null ) { return null ; } Throwable cause = getCause ( ) ; while ( true ) { if ( cause == null ) { return null ; } if ( exceptionType . isInstance ( cause ) ) { @ SuppressWarnings ( "unchecked" ) E matchedCause = ( E ) cau... | Returns the next parent exception of the given type or null | 185 | 11 |
38,606 | public void beforeNullSafeOperation ( SharedSessionContractImplementor session ) { ConfigurationHelper . setCurrentSessionFactory ( session . getFactory ( ) ) ; if ( this instanceof IntegratorConfiguredType ) { ( ( IntegratorConfiguredType ) this ) . applyConfiguration ( session . getFactory ( ) ) ; } } | Included to allow session state to be applied to the user type | 68 | 13 |
38,607 | private void initJdkBindings ( ) { registerBinding ( AtomicBoolean . class , String . class , new AtomicBooleanStringBinding ( ) ) ; registerBinding ( AtomicInteger . class , String . class , new AtomicIntegerStringBinding ( ) ) ; registerBinding ( AtomicLong . class , String . class , new AtomicLongStringBinding ( ) )... | Initialises standard bindings for Java built in types | 652 | 9 |
38,608 | protected < X > void registerConfigurations ( Enumeration < URL > bindingsConfiguration ) { List < BindingConfiguration > configs = new ArrayList < BindingConfiguration > ( ) ; for ( URL nextLocation : IterableEnumeration . wrapEnumeration ( bindingsConfiguration ) ) { // Filter built in bindings - these are already re... | Registers a set of configurations for the given list of URLs . This is typically used to process all the various bindings . xml files discovered in jars on the classpath . It is given protected scope to allow subclasses to register additional configurations | 482 | 47 |
38,609 | protected void registerBindingConfigurationEntries ( Iterable < BindingConfigurationEntry > bindings ) { for ( BindingConfigurationEntry nextBinding : bindings ) { try { registerBindingConfigurationEntry ( nextBinding ) ; } catch ( IllegalStateException e ) { // Ignore this - it can happen when introspecting class mapp... | Registers a list of binding configuration entries . A binding configuration entry described in a section of a bindings . xml file and describes the use of a particular method for databinding . | 70 | 36 |
38,610 | public void registerAnnotatedClasses ( Class < ? > ... classesToInspect ) { for ( Class < ? > nextClass : classesToInspect ) { Class < ? > loopClass = nextClass ; while ( ( loopClass != Object . class ) && ( ! inspectedClasses . contains ( loopClass ) ) ) { attachForAnnotations ( loopClass ) ; loopClass = loopClass . g... | Inspect each of the supplied classes processing any of the annotated methods found | 94 | 15 |
38,611 | protected < I , T extends I > void registerExtendedBinder ( Class < I > iface , T provider ) { extendedBinders . put ( iface , provider ) ; } | Register a custom typesafe binder implementation which can be retrieved later | 39 | 13 |
38,612 | @ SuppressWarnings ( "unchecked" ) protected < I > I getExtendedBinder ( Class < I > cls ) { return ( I ) extendedBinders . get ( cls ) ; } | Retrieves an extended binder | 46 | 7 |
38,613 | public static boolean isJdkImmutable ( Class < ? > type ) { if ( Class . class == type ) { return true ; } if ( String . class == type ) { return true ; } if ( BigInteger . class == type ) { return true ; } if ( BigDecimal . class == type ) { return true ; } if ( URL . class == type ) { return true ; } if ( UUID . clas... | Indicate if the class is a known non - primitive JDK immutable type | 128 | 15 |
38,614 | public static boolean isWrapper ( Class < ? > type ) { if ( Boolean . class == type ) { return true ; } if ( Byte . class == type ) { return true ; } if ( Character . class == type ) { return true ; } if ( Short . class == type ) { return true ; } if ( Integer . class == type ) { return true ; } if ( Long . class == ty... | Indicate if the class is a known primitive wrapper type | 122 | 11 |
38,615 | public static Field [ ] collectInstanceFields ( Class < ? > c , Class < ? > limitExclusive ) { return collectFields ( c , 0 , Modifier . STATIC , limitExclusive ) ; } | Produces an array with all the instance fields of the specified class | 46 | 13 |
38,616 | protected final Class < T > getEntityClass ( ) { @ SuppressWarnings ( "unchecked" ) final Class < T > result = ( Class < T > ) TypeHelper . getTypeArguments ( JpaSearchRepository . class , this . getClass ( ) ) . get ( 0 ) ; return result ; } | Returns the class for the entity type associated with this repository . | 70 | 12 |
38,617 | protected final Class < ID > getIdClass ( ) { @ SuppressWarnings ( "unchecked" ) final Class < ID > result = ( Class < ID > ) TypeHelper . getTypeArguments ( JpaSearchRepository . class , this . getClass ( ) ) . get ( 1 ) ; return result ; } | Returns the class for the ID field for the entity type associated with this repository . | 70 | 16 |
38,618 | protected T getSingleResult ( Query q ) { try { @ SuppressWarnings ( "unchecked" ) T retVal = ( T ) q . getSingleResult ( ) ; return retVal ; } catch ( NoResultException e ) { return null ; } } | Executes a query that returns a single record . In the case of no result rather than throwing an exception null is returned . | 57 | 25 |
38,619 | public static Class < ? > classForName ( String name ) throws ClassNotFoundException { ClassLoader cl = getClassLoader ( ) ; try { if ( cl != null ) { return cl . loadClass ( name ) ; } } catch ( ClassNotFoundException e ) { // Ignore and try using Class.forName() } return Class . forName ( name ) ; } | Attempts to instantiate the named class using the context ClassLoader for the current thread or Class . forName if this does not work | 79 | 26 |
38,620 | public static Class < ? > classForName ( String name , ClassLoader ... classLoaders ) throws ClassNotFoundException { ClassLoader [ ] cls = getClassLoaders ( classLoaders ) ; for ( ClassLoader cl : cls ) { try { if ( cl != null ) { return cl . loadClass ( name ) ; } } catch ( ClassNotFoundException e ) { // Ignore } } ... | Attempts to instantiate the named class using each of the specified ClassLoaders in turn or Class . forName if these do not work | 104 | 27 |
38,621 | protected < T > T performCloneForCloneableMethod ( T object , CloneDriver context ) { Class < ? > clazz = object . getClass ( ) ; final T result ; try { MethodHandle handle = context . getCloneMethod ( clazz ) ; result = ( T ) handle . invoke ( object ) ; } catch ( Throwable e ) { throw new IllegalStateException ( "Cou... | Helper method for performing cloning for objects of classes implementing java . lang . Cloneable | 111 | 16 |
38,622 | protected < T > void handleCloneField ( T obj , T copy , CloneDriver driver , FieldModel < T > f , IdentityHashMap < Object , Object > referencesToReuse , long stackDepth ) { final Class < ? > clazz = f . getFieldClass ( ) ; if ( clazz . isPrimitive ( ) ) { handleClonePrimitiveField ( obj , copy , driver , f , referenc... | Clone a Field | 196 | 4 |
38,623 | @ SuppressWarnings ( "unchecked" ) public static final < C > ClassModel < C > get ( ClassAccess < C > classAccess ) { Class < ? > clazz = classAccess . getType ( ) ; String classModelKey = ( classAccess . getClass ( ) . getName ( ) + ":" + clazz . getName ( ) ) ; ClassModel < C > classModel = ( ClassModel < C > ) class... | Returns a class model for the given ClassAccess instance . If a ClassModel already exists it will be reused . | 197 | 22 |
38,624 | private void initializeBuiltInImplementors ( ) { builtInImplementors . put ( ArrayList . class , new ArrayListImplementor ( ) ) ; builtInImplementors . put ( ConcurrentHashMap . class , new ConcurrentHashMapImplementor ( ) ) ; builtInImplementors . put ( GregorianCalendar . class , new GregorianCalendarImplementor ( ) ... | Initialise a set of built in CloneImplementors for commonly used JDK types | 198 | 17 |
38,625 | public void setImplementors ( Map < Class < ? > , CloneImplementor > implementors ) { // this.implementors = implementors; this . allImplementors = new HashMap < Class < ? > , CloneImplementor > ( ) ; allImplementors . putAll ( builtInImplementors ) ; allImplementors . putAll ( implementors ) ; } | Sets CloneImplementors to be used . | 85 | 10 |
38,626 | public static String removeWhitespace ( String string ) { if ( string == null || string . length ( ) == 0 ) { return string ; } else { int codePoints = string . codePointCount ( 0 , string . length ( ) ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < codePoints ; i ++ ) { int offset = string . offse... | Removes any whitespace from a String correctly handling surrogate characters | 172 | 12 |
38,627 | public static final AccessClassLoader get ( Class < ? > typeToBeExtended ) { ClassLoader loader = typeToBeExtended . getClassLoader ( ) ; return get ( loader == null ? ClassLoader . getSystemClassLoader ( ) : loader ) ; } | Creates a new instance using a suitable ClassLoader for the specified class | 56 | 14 |
38,628 | public synchronized static final AccessClassLoader get ( ClassLoader parent ) { AccessClassLoader loader = ( AccessClassLoader ) ASM_CLASS_LOADERS . get ( parent ) ; if ( loader == null ) { loader = new AccessClassLoader ( parent ) ; ASM_CLASS_LOADERS . put ( parent , loader ) ; } return loader ; } | Creates an AccessClassLoader for the given parent | 74 | 10 |
38,629 | public void registerClass ( String name , byte [ ] bytes ) { if ( registeredClasses . containsKey ( name ) ) { throw new IllegalStateException ( "Attempted to register a class that has been registered already: " + name ) ; } registeredClasses . put ( name , bytes ) ; } | Registers a class by its name | 64 | 7 |
38,630 | public boolean isPatterned ( ) { final boolean result ; if ( pattern . indexOf ( ' ' ) != - 1 || pattern . indexOf ( ' ' ) != - 1 ) { result = true ; } else { result = false ; } return result ; } | Returns true if the given path resolves a pattern as opposed to a literal path | 55 | 15 |
38,631 | public static < C > InvokeDynamicClassAccess < C > get ( Class < C > clazz ) { @ SuppressWarnings ( "unchecked" ) InvokeDynamicClassAccess < C > access = ( InvokeDynamicClassAccess < C > ) CLASS_ACCESSES . get ( clazz ) ; if ( access != null ) { return access ; } Class < ? > enclosingType = clazz . getEnclosingClass ( ... | Get a new instance that can access the given Class . If the ClassAccess for this class has not been obtained before then the specific InvokeDynamicClassAccess is created by generating a specialised subclass of this class and returning it . | 714 | 46 |
38,632 | public static < C > PortableClassAccess < C > get ( Class < C > clazz ) { @ SuppressWarnings ( "unchecked" ) PortableClassAccess < C > access = ( PortableClassAccess < C > ) CLASS_ACCESSES . get ( clazz ) ; if ( access != null ) { return access ; } access = new PortableClassAccess < C > ( clazz ) ; CLASS_ACCESSES . put... | Get a new instance that can access the given Class . If the ClassAccess for this class has not been obtained before then the specific PortableClassAccess is created by generating a specialised subclass of this class and returning it . | 107 | 44 |
38,633 | @ SuppressWarnings ( "deprecation" ) // No good alternative in the Hibernate API yet protected ID extractId ( T entity ) { final Class < ? > entityClass = TypeHelper . getTypeArguments ( JpaBaseRepository . class , this . getClass ( ) ) . get ( 0 ) ; final SessionFactory sf = ( SessionFactory ) ( getEntityManager ( ) .... | Determines the ID for the entity | 175 | 8 |
38,634 | public final < T > T allocateInstance ( Class < T > clazz ) throws IllegalStateException { try { @ SuppressWarnings ( "unchecked" ) final T result = ( T ) THE_UNSAFE . allocateInstance ( clazz ) ; return result ; } catch ( InstantiationException e ) { throw new IllegalStateException ( "Cannot allocate instance: " + e .... | Construct and allocate on the heap an instant of the given class without calling the class constructor | 93 | 17 |
38,635 | public final < T > T shallowCopy ( T obj ) { long size = shallowSizeOf ( obj ) ; long address = THE_UNSAFE . allocateMemory ( size ) ; long start = toAddress ( obj ) ; THE_UNSAFE . copyMemory ( start , address , size ) ; @ SuppressWarnings ( "unchecked" ) final T result = ( T ) fromAddress ( address ) ; return result ;... | Performs a shallow copy of the given object - a new instance is allocated with the same contents . Any object references inside the copy will be the same as the original object . | 92 | 35 |
38,636 | public final Object fromAddress ( long address ) { Object [ ] array = new Object [ ] { null } ; long baseOffset = THE_UNSAFE . arrayBaseOffset ( Object [ ] . class ) ; THE_UNSAFE . putLong ( array , baseOffset , address ) ; return array [ 0 ] ; } | Returns the object located at the given memory address | 68 | 9 |
38,637 | public final void copyPrimitiveField ( Object source , Object copy , Field field ) { copyPrimitiveAtOffset ( source , copy , field . getType ( ) , getObjectFieldOffset ( field ) ) ; } | Copy the value from the given field from the source into the target . The field specified must contain a primitive | 45 | 21 |
38,638 | public final void copyPrimitiveAtOffset ( Object source , Object copy , Class < ? > type , long offset ) { if ( java . lang . Boolean . TYPE == type ) { boolean origFieldValue = THE_UNSAFE . getBoolean ( source , offset ) ; THE_UNSAFE . putBoolean ( copy , offset , origFieldValue ) ; } else if ( java . lang . Byte . TY... | Copies the primitive of the specified type from the given field offset in the source object to the same location in the copy | 443 | 24 |
38,639 | public final void deepCopyObjectAtOffset ( Object source , Object copy , Class < ? > fieldClass , long offset ) { deepCopyObjectAtOffset ( source , copy , fieldClass , offset , new IdentityHashMap < Object , Object > ( 100 ) ) ; } | Copies the object of the specified type from the given field offset in the source object to the same location in the copy visiting the object during the copy so that its fields are also copied | 56 | 37 |
38,640 | public final void deepCopyArrayField ( Object obj , Object copy , Field field , IdentityHashMap < Object , Object > referencesToReuse ) { deepCopyArrayAtOffset ( obj , copy , field . getType ( ) , getObjectFieldOffset ( field ) , referencesToReuse ) ; } | Copies the array of the specified type from the given field in the source object to the same field in the copy visiting the array during the copy so that its contents are also copied | 63 | 36 |
38,641 | public final void putObject ( Object parent , long offset , Object value ) { THE_UNSAFE . putObject ( parent , offset , value ) ; } | Puts the object s reference at the given offset of the supplied parent object | 33 | 15 |
38,642 | public static Class < ? > getClass ( ClassLoader classLoader , String className ) { try { final Class < ? > clazz ; if ( PRIMITIVE_MAPPING . containsKey ( className ) ) { String qualifiedName = "[" + PRIMITIVE_MAPPING . get ( className ) ; clazz = Class . forName ( qualifiedName , true , classLoader ) . getComponentTyp... | Attempt to load the class matching the given qualified name | 248 | 10 |
38,643 | public static String determineQualifiedName ( String className ) { String readableClassName = StringUtils . removeWhitespace ( className ) ; if ( readableClassName == null ) { throw new IllegalArgumentException ( "readableClassName must not be null." ) ; } else if ( readableClassName . endsWith ( "[]" ) ) { StringBuild... | Given a readable class name determine the JVM Qualified Name | 221 | 12 |
38,644 | public static String determineReadableClassName ( String qualifiedName ) { String readableClassName = StringUtils . removeWhitespace ( qualifiedName ) ; if ( readableClassName == null ) { throw new IllegalArgumentException ( "qualifiedName must not be null." ) ; } else if ( readableClassName . startsWith ( "[" ) ) { St... | Given a JVM Qualified Name produce a readable classname | 345 | 12 |
38,645 | protected List < Class < ? extends Annotation > > determineQualifiers ( Annotation bindingAnnotation , Annotation ... allAnnotations ) { List < Class < ? extends Annotation > > result = new ArrayList < Class < ? extends Annotation > > ( ) ; // The binding annotation itself is marked with @BindingScope Class < ? extends... | Returns the qualifiers for this method setting the Default qualifier if none are found Qualifiers can be either explicitly applied to the method or implicit on account of being found in the annotation itself ( for example | 303 | 38 |
38,646 | static void validateValueUniquenessInScope ( String qualifiedName , List < TypeElement > nestedElements ) { Set < String > names = new LinkedHashSet <> ( ) ; for ( TypeElement nestedElement : nestedElements ) { if ( nestedElement instanceof EnumElement ) { EnumElement enumElement = ( EnumElement ) nestedElement ; for (... | Though not mentioned in the spec enum names use C ++ scoping rules meaning that enum constants are siblings of their declaring element not children of it . | 143 | 29 |
38,647 | static boolean isValidTag ( int value ) { return ( value >= MIN_TAG_VALUE && value < RESERVED_TAG_VALUE_START ) || ( value > RESERVED_TAG_VALUE_END && value <= MAX_TAG_VALUE ) ; } | True if the supplied value is in the valid tag range and not reserved . | 59 | 15 |
38,648 | public static OptionElement findByName ( List < OptionElement > options , String name ) { checkNotNull ( options , "options" ) ; checkNotNull ( name , "name" ) ; OptionElement found = null ; for ( OptionElement option : options ) { if ( option . name ( ) . equals ( name ) ) { if ( found != null ) { throw new IllegalSta... | Return the option with the specified name from the supplied list or null . | 105 | 14 |
38,649 | private OptionKindAndValue readKindAndValue ( ) { char peeked = peekChar ( ) ; switch ( peeked ) { case ' ' : return OptionKindAndValue . of ( OptionElement . Kind . MAP , readMap ( ' ' , ' ' , ' ' ) ) ; case ' ' : return OptionKindAndValue . of ( OptionElement . Kind . LIST , readList ( ) ) ; case ' ' : return OptionK... | Reads a value that can be a map list string number boolean or enum . | 248 | 16 |
38,650 | private void addToList ( List < Object > list , Object value ) { if ( value instanceof List ) { list . addAll ( ( List ) value ) ; } else { list . add ( value ) ; } } | Adds an object or objects to a List . | 47 | 9 |
38,651 | private DataType readDataType ( ) { String name = readWord ( ) ; switch ( name ) { case "map" : if ( readChar ( ) != ' ' ) throw unexpected ( "expected '<'" ) ; DataType keyType = readDataType ( ) ; if ( readChar ( ) != ' ' ) throw unexpected ( "expected ','" ) ; DataType valueType = readDataType ( ) ; if ( readChar ( ... | Reads a scalar map or type name . | 368 | 10 |
38,652 | private int readInt ( ) { String tag = readWord ( ) ; try { int radix = 10 ; if ( tag . startsWith ( "0x" ) || tag . startsWith ( "0X" ) ) { tag = tag . substring ( "0x" . length ( ) ) ; radix = 16 ; } return Integer . valueOf ( tag , radix ) ; } catch ( Exception e ) { throw unexpected ( "expected an integer but was "... | Reads an integer and returns it . | 106 | 8 |
38,653 | @ Override public JmxMetricReporter init ( ConfigurationProperties configurationProperties , MetricRegistry metricRegistry ) { if ( configurationProperties . isJmxEnabled ( ) ) { jmxReporter = JmxReporter . forRegistry ( metricRegistry ) . inDomain ( MetricRegistry . name ( getClass ( ) , configurationProperties . getU... | The JMX Reporter is activated only if the jmxEnabled property is set . If the jmxAutoStart property is enabled the JMX Reporter will start automatically . | 117 | 33 |
38,654 | @ Override public Slf4jMetricReporter init ( ConfigurationProperties configurationProperties , MetricRegistry metricRegistry ) { metricLogReporterMillis = configurationProperties . getMetricLogReporterMillis ( ) ; if ( metricLogReporterMillis > 0 ) { this . slf4jReporter = Slf4jReporter . forRegistry ( metricRegistry )... | Create a Log Reporter and activate it if the metricLogReporterMillis property is greater than zero . | 105 | 21 |
38,655 | public void close ( ) { long endNanos = System . nanoTime ( ) ; long durationNanos = endNanos - startNanos ; connectionPoolCallback . releaseConnection ( durationNanos ) ; } | Calculates the connection lease nanos and propagates it to the connection pool callback . | 44 | 18 |
38,656 | public static < T > T lookup ( String name ) { InitialContext initialContext = initialContext ( ) ; try { @ SuppressWarnings ( "unchecked" ) T object = ( T ) initialContext . lookup ( name ) ; if ( object == null ) { throw new NameNotFoundException ( name + " was found but is null" ) ; } return object ; } catch ( NameN... | Lookup object in JNDI | 150 | 7 |
38,657 | public ConnectionDecoratorFactory resolve ( ) { int loadingIndex = Integer . MIN_VALUE ; ConnectionDecoratorFactory connectionDecoratorFactory = null ; Iterator < ConnectionDecoratorFactoryService > connectionDecoratorFactoryServiceIterator = serviceLoader . iterator ( ) ; while ( connectionDecoratorFactoryServiceItera... | Resolve ConnectionDecoratorFactory from the Service Provider Interface configuration | 261 | 13 |
38,658 | public Connection newInstance ( Connection target , ConnectionPoolCallback connectionPoolCallback ) { return proxyConnection ( target , new ConnectionCallback ( connectionPoolCallback ) ) ; } | Creates a ConnectionProxy for the specified target and attaching the following callback . | 33 | 15 |
38,659 | public static ClassLoader getClassLoader ( ) { ClassLoader classLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; return ( classLoader != null ) ? classLoader : ClassLoaderUtils . class . getClassLoader ( ) ; } | Load the available ClassLoader | 54 | 5 |
38,660 | @ SuppressWarnings ( "unchecked" ) public static < T > Class < T > loadClass ( String className ) throws ClassNotFoundException { return ( Class < T > ) getClassLoader ( ) . loadClass ( className ) ; } | Load the Class denoted by the given string representation | 55 | 10 |
38,661 | @ SuppressWarnings ( "unchecked" ) public static boolean findClass ( String className ) { try { return getClassLoader ( ) . loadClass ( className ) != null ; } catch ( ClassNotFoundException e ) { return false ; } catch ( NoClassDefFoundError e ) { return false ; } } | Find if Class denoted by the given string representation is loadable | 70 | 13 |
38,662 | public MetricsFactory resolve ( ) { for ( MetricsFactoryService metricsFactoryService : serviceLoader ) { MetricsFactory metricsFactory = metricsFactoryService . load ( ) ; if ( metricsFactory != null ) { return metricsFactory ; } } throw new IllegalStateException ( "No MetricsFactory could be loaded!" ) ; } | Resolve MetricsFactory from the Service Provider Interface configuration | 68 | 11 |
38,663 | private < T extends DataSource > T applyDataSourceProperties ( T dataSource ) { for ( Map . Entry < Object , Object > entry : properties . entrySet ( ) ) { String key = entry . getKey ( ) . toString ( ) ; String value = entry . getValue ( ) . toString ( ) ; String propertyKey = PropertyKey . DATA_SOURCE_PROPERTY . getK... | Apply DataSource specific properties | 145 | 5 |
38,664 | private < T > T instantiateClass ( PropertyKey propertyKey ) { T object = null ; String property = properties . getProperty ( propertyKey . getKey ( ) ) ; if ( property != null ) { try { Class < T > clazz = ClassLoaderUtils . loadClass ( property ) ; LOGGER . debug ( "Instantiate {}" , clazz ) ; object = clazz . newIns... | Instantiate class associated to the given property key | 220 | 9 |
38,665 | private Integer integerProperty ( PropertyKey propertyKey ) { Integer value = null ; String property = properties . getProperty ( propertyKey . getKey ( ) ) ; if ( property != null ) { value = Integer . valueOf ( property ) ; } return value ; } | Get Integer property value | 55 | 4 |
38,666 | private Long longProperty ( PropertyKey propertyKey ) { Long value = null ; String property = properties . getProperty ( propertyKey . getKey ( ) ) ; if ( property != null ) { value = Long . valueOf ( property ) ; } return value ; } | Get Long property value | 55 | 4 |
38,667 | private Boolean booleanProperty ( PropertyKey propertyKey ) { Boolean value = null ; String property = properties . getProperty ( propertyKey . getKey ( ) ) ; if ( property != null ) { value = Boolean . valueOf ( property ) ; } return value ; } | Get Boolean property value | 55 | 4 |
38,668 | @ SuppressWarnings ( "unchecked" ) private < T > T jndiLookup ( PropertyKey propertyKey ) { String property = properties . getProperty ( propertyKey . getKey ( ) ) ; if ( property != null ) { return isJndiLazyLookup ( ) ? ( T ) LazyJndiResolver . newInstance ( property , DataSource . class ) : ( T ) JndiUtils . lookup ... | Lookup object from JNDI | 106 | 7 |
38,669 | private Connection getConnection ( ConnectionRequestContext context ) throws SQLException { concurrentConnectionRequestCountHistogram . update ( concurrentConnectionRequestCount . incrementAndGet ( ) ) ; long startNanos = System . nanoTime ( ) ; try { Connection connection = null ; if ( ! connectionAcquiringStrategies ... | Try to obtain a connection by going through all available strategies | 401 | 11 |
38,670 | protected boolean incrementPoolSize ( int expectingMaxSize ) { Integer maxSize = null ; long currentOverflowPoolSize ; try { lock . lockInterruptibly ( ) ; int currentMaxSize = poolAdapter . getMaxPoolSize ( ) ; boolean incrementMaxPoolSize = currentMaxSize < maxOverflowPoolSize ; if ( currentMaxSize > expectingMaxSize... | Attempt to increment the pool size . If the maxSize changes it skips the incrementing process . | 254 | 20 |
38,671 | public static < T > T getFieldValue ( Object target , String fieldName ) { try { Field field = target . getClass ( ) . getDeclaredField ( fieldName ) ; field . setAccessible ( true ) ; @ SuppressWarnings ( "unchecked" ) T returnValue = ( T ) field . get ( target ) ; return returnValue ; } catch ( NoSuchFieldException e... | Get target object field value | 119 | 5 |
38,672 | public static void setFieldValue ( Object target , String fieldName , Object value ) { try { Field field = target . getClass ( ) . getDeclaredField ( fieldName ) ; field . setAccessible ( true ) ; field . set ( target , value ) ; } catch ( NoSuchFieldException e ) { throw handleException ( fieldName , e ) ; } catch ( I... | Set target object field value | 98 | 5 |
38,673 | public static Method getMethod ( Object target , String methodName , Class ... parameterTypes ) { try { return target . getClass ( ) . getMethod ( methodName , parameterTypes ) ; } catch ( NoSuchMethodException e ) { throw handleException ( methodName , e ) ; } } | Get target method | 61 | 3 |
38,674 | public static boolean hasMethod ( Class < ? > targetClass , String methodName , Class ... parameterTypes ) { try { targetClass . getMethod ( methodName , parameterTypes ) ; return true ; } catch ( NoSuchMethodException e ) { return false ; } } | Check if target class has the given method | 56 | 8 |
38,675 | public static Method getSetter ( Object target , String property , Class < ? > parameterType ) { String setterMethodName = SETTER_PREFIX + property . substring ( 0 , 1 ) . toUpperCase ( ) + property . substring ( 1 ) ; return getMethod ( target , setterMethodName , parameterType ) ; } | Get setter method | 75 | 4 |
38,676 | public static < T > T invoke ( Object target , Method method , Object ... parameters ) { try { @ SuppressWarnings ( "unchecked" ) T returnValue = ( T ) method . invoke ( target , parameters ) ; return returnValue ; } catch ( InvocationTargetException e ) { throw handleException ( method . getName ( ) , e ) ; } catch ( ... | Invoke target method | 102 | 4 |
38,677 | public static void invokeSetter ( Object target , String property , Object parameter ) { Method setter = getSetter ( target , property , parameter . getClass ( ) ) ; try { setter . invoke ( target , parameter ) ; } catch ( IllegalAccessException e ) { throw handleException ( setter . getName ( ) , e ) ; } catch ( Invoc... | Invoke setter method with the given parameter | 100 | 9 |
38,678 | @ Override public Object invoke ( Object proxy , Method method , Object [ ] args ) throws Throwable { if ( target == null ) { target = JndiUtils . lookup ( name ) ; } return method . invoke ( target , args ) ; } | Resolves the JNDI object upon invoking any method on the associated Proxy | 54 | 15 |
38,679 | @ SuppressWarnings ( "unchecked" ) public static < T > T newInstance ( String name , Class < ? > objectType ) { return ( T ) Proxy . newProxyInstance ( ClassLoaderUtils . getClassLoader ( ) , new Class [ ] { objectType } , new LazyJndiResolver ( name ) ) ; } | Creates a new Proxy instance | 76 | 6 |
38,680 | public static URI create ( Path pathToVault , String ... pathComponentsInsideVault ) { try { return new URI ( URI_SCHEME , pathToVault . toUri ( ) . toString ( ) , "/" + String . join ( "/" , pathComponentsInsideVault ) , null , null ) ; } catch ( URISyntaxException e ) { throw new IllegalArgumentException ( "Can not c... | Constructs a CryptoFileSystem URI by using the given absolute path to a vault and constructing a path inside the vault from components . | 106 | 26 |
38,681 | public static boolean containsVault ( Path pathToVault , String masterkeyFilename ) { Path masterKeyPath = pathToVault . resolve ( masterkeyFilename ) ; Path dataDirPath = pathToVault . resolve ( Constants . DATA_DIR_NAME ) ; return Files . isReadable ( masterKeyPath ) && Files . isDirectory ( dataDirPath ) ; } | Checks if the folder represented by the given path exists and contains a valid vault structure . | 81 | 18 |
38,682 | public TwoPhaseMove prepareMove ( Path src , Path dst ) throws FileAlreadyExistsException { return new TwoPhaseMove ( src , dst ) ; } | Prepares to update any open file references during a move operation . MUST be invoked using a try - with - resource statement and committed after the physical file move succeeded . | 32 | 33 |
38,683 | public synchronized FileChannel newFileChannel ( EffectiveOpenOptions options ) throws IOException { Path path = currentFilePath . get ( ) ; if ( options . truncateExisting ( ) ) { chunkCache . invalidateAll ( ) ; } FileChannel ciphertextFileChannel = null ; CleartextFileChannel cleartextFileChannel = null ; try { ciph... | Creates a new file channel with the given open options . | 314 | 12 |
38,684 | public Path resolveConflictsIfNecessary ( Path ciphertextPath , String dirId ) throws IOException { String ciphertextFileName = ciphertextPath . getFileName ( ) . toString ( ) ; String basename = StringUtils . removeEnd ( ciphertextFileName , LONG_NAME_FILE_EXT ) ; Matcher m = CIPHERTEXT_FILENAME_PATTERN . matcher ( ba... | Checks if the name of the file represented by the given ciphertextPath is a valid ciphertext name without any additional chars . If any unexpected chars are found on the name but it still contains an authentic ciphertext it is considered a conflicting file . Conflicting files will be given a new name . The caller must ... | 166 | 86 |
38,685 | private Path resolveConflict ( Path conflictingPath , String ciphertextFileName , String dirId ) throws IOException { String conflictingFileName = conflictingPath . getFileName ( ) . toString ( ) ; Preconditions . checkArgument ( conflictingFileName . contains ( ciphertextFileName ) , "%s does not contain %s" , conflic... | Resolves a conflict . | 320 | 5 |
38,686 | private Path renameConflictingFile ( Path canonicalPath , Path conflictingPath , String ciphertext , String dirId , String dirPrefix ) throws IOException { try { String cleartext = cryptor . fileNameCryptor ( ) . decryptFilename ( ciphertext , dirId . getBytes ( StandardCharsets . UTF_8 ) ) ; Path alternativePath = can... | Resolves a conflict by renaming the conflicting file . | 345 | 11 |
38,687 | private boolean resolveDirectoryConflictTrivially ( Path canonicalPath , Path conflictingPath ) throws IOException { if ( ! Files . exists ( canonicalPath ) ) { Files . move ( conflictingPath , canonicalPath , StandardCopyOption . ATOMIC_MOVE ) ; return true ; } else if ( hasSameDirFileContent ( conflictingPath , canon... | Tries to resolve a conflicting directory file without renaming the file . If successful only the file with the canonical path will exist afterwards . | 138 | 27 |
38,688 | public boolean needsMigration ( Path pathToVault , String masterkeyFilename ) throws IOException { Path masterKeyPath = pathToVault . resolve ( masterkeyFilename ) ; byte [ ] keyFileContents = Files . readAllBytes ( masterKeyPath ) ; KeyFile keyFile = KeyFile . parse ( keyFileContents ) ; return keyFile . getVersion ( ... | Inspects the vault and checks if it is supported by this library . | 89 | 15 |
38,689 | public void migrate ( Path pathToVault , String masterkeyFilename , CharSequence passphrase ) throws NoApplicableMigratorException , InvalidPassphraseException , IOException { Path masterKeyPath = pathToVault . resolve ( masterkeyFilename ) ; byte [ ] keyFileContents = Files . readAllBytes ( masterKeyPath ) ; KeyFile k... | Performs the actual migration . This task may take a while and this method will block . | 205 | 18 |
38,690 | public com . google . api . ads . adwords . axis . v201809 . cm . Image getCollapsedImage ( ) { return collapsedImage ; } | Gets the collapsedImage value for this ShowcaseAd . | 33 | 12 |
38,691 | public com . google . api . ads . adwords . axis . v201809 . cm . Image getExpandedImage ( ) { return expandedImage ; } | Gets the expandedImage value for this ShowcaseAd . | 33 | 12 |
38,692 | public static org . apache . axis . encoding . Serializer getSerializer ( java . lang . String mechType , java . lang . Class _javaType , javax . xml . namespace . QName _xmlType ) { return new org . apache . axis . encoding . ser . BeanSerializer ( _javaType , _xmlType , typeDesc ) ; } | Get Custom Serializer | 79 | 4 |
38,693 | public static org . apache . axis . encoding . Deserializer getDeserializer ( java . lang . String mechType , java . lang . Class _javaType , javax . xml . namespace . QName _xmlType ) { return new org . apache . axis . encoding . ser . BeanDeserializer ( _javaType , _xmlType , typeDesc ) ; } | Get Custom Deserializer | 82 | 5 |
38,694 | public void setPremiumFeature ( com . google . api . ads . admanager . axis . v201902 . PremiumFeature premiumFeature ) { this . premiumFeature = premiumFeature ; } | Sets the premiumFeature value for this PremiumRateValue . | 38 | 12 |
38,695 | public com . google . api . ads . admanager . axis . v201902 . RateType getRateType ( ) { return rateType ; } | Gets the rateType value for this PremiumRateValue . | 31 | 12 |
38,696 | public void setRateType ( com . google . api . ads . admanager . axis . v201902 . RateType rateType ) { this . rateType = rateType ; } | Sets the rateType value for this PremiumRateValue . | 38 | 12 |
38,697 | public void setAdjustmentType ( com . google . api . ads . admanager . axis . v201902 . PremiumAdjustmentType adjustmentType ) { this . adjustmentType = adjustmentType ; } | Sets the adjustmentType value for this PremiumRateValue . | 41 | 12 |
38,698 | public com . google . api . ads . adwords . axis . v201809 . cm . Criterion getCriterion ( ) { return criterion ; } | Gets the criterion value for this AdGroupBidModifier . | 32 | 14 |
38,699 | public com . google . api . ads . adwords . axis . v201809 . cm . BidModifierSource getBidModifierSource ( ) { return bidModifierSource ; } | Gets the bidModifierSource value for this AdGroupBidModifier . | 40 | 17 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.