signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ToStringOption { /** * Return a < code > ToStringOption < / code > instance with { @ link # appendTransient } option set .
* if the current instance is not { @ link # DEFAULT _ OPTION default instance } then set
* on the current instance and return the current instance . Otherwise , clone the default
... | ToStringOption op = this ; if ( this == DEFAULT_OPTION ) { op = new ToStringOption ( this . appendStatic , this . appendTransient ) ; } op . appendTransient = appendTransient ; return op ; |
public class NamePreservingRunnable { /** * Wraps { @ link Thread # setName ( String ) } to catch a possible { @ link Exception } s such as
* { @ link SecurityException } in sandbox environments , such as applets */
private void setName ( Thread thread , String name ) { } } | try { thread . setName ( name ) ; } catch ( SecurityException se ) { if ( LOGGER . isWarnEnabled ( ) ) { LOGGER . warn ( "Failed to set the thread name." , se ) ; } } |
public class DirectBufferProxy { /** * Lexicographically compare two buffers .
* @ param o1 left operand ( required )
* @ param o2 right operand ( required )
* @ return as specified by { @ link Comparable } interface */
@ SuppressWarnings ( "checkstyle:ReturnCount" ) public static int compareBuff ( final DirectBu... | requireNonNull ( o1 ) ; requireNonNull ( o2 ) ; if ( o1 . equals ( o2 ) ) { return 0 ; } final int minLength = Math . min ( o1 . capacity ( ) , o2 . capacity ( ) ) ; final int minWords = minLength / Long . BYTES ; for ( int i = 0 ; i < minWords * Long . BYTES ; i += Long . BYTES ) { final long lw = o1 . getLong ( i , B... |
public class ParallelOracleBuilders { /** * Creates a { @ link DynamicParallelOracleBuilder } using the provided supplier . Uses the further specified
* { @ link DynamicParallelOracleBuilder # withPoolPolicy ( PoolPolicy ) } and
* { @ link DynamicParallelOracleBuilder # withPoolSize ( int ) } ( or its defaults ) to... | return new DynamicParallelOracleBuilder < > ( oracleSupplier ) ; |
public class CameraConfigurationManager { /** * Reads , one time , values from the camera that are needed by the app . */
void initFromCameraParameters ( Camera camera ) { } } | Camera . Parameters parameters = camera . getParameters ( ) ; WindowManager manager = ( WindowManager ) context . getSystemService ( Context . WINDOW_SERVICE ) ; Display display = manager . getDefaultDisplay ( ) ; Point theScreenResolution = new Point ( ) ; getDisplaySize ( display , theScreenResolution ) ; screenResol... |
public class SCoveragePreCompileMojo { /** * Configures project for compilation with SCoverage instrumentation .
* @ throws MojoExecutionException if unexpected problem occurs */
@ Override public void execute ( ) throws MojoExecutionException { } } | if ( "pom" . equals ( project . getPackaging ( ) ) ) { getLog ( ) . info ( "Skipping SCoverage execution for project with packaging type 'pom'" ) ; // for aggragetor mojo - list of submodules : List < MavenProject > modules = project . getCollectedProjects ( ) ;
return ; } if ( skip ) { getLog ( ) . info ( "Skipping Sc... |
public class BouncyCastleCertProcessingFactory { /** * Creates a new proxy credential from the specified certificate chain and a private key . A set of X . 509
* extensions can be optionally included in the new proxy certificate . This function automatically creates
* a " RSA " - based key pair .
* @ see # create... | X509Certificate [ ] bcCerts = getX509CertificateObjectChain ( certs ) ; KeyPairGenerator keyGen = null ; keyGen = KeyPairGenerator . getInstance ( "RSA" , "BC" ) ; keyGen . initialize ( bits ) ; KeyPair keyPair = keyGen . genKeyPair ( ) ; X509Certificate newCert = createProxyCertificate ( bcCerts [ 0 ] , privateKey , k... |
public class StrictFormatStringValidation { /** * Helps { @ code validate ( ) } validate a format string that is a variable , but not a parameter . This
* method assumes that the format string variable has already been asserted to be final or
* effectively final . */
private static ValidationResult validateFormatSt... | if ( formatStringSymbol . getKind ( ) != ElementKind . LOCAL_VARIABLE ) { return ValidationResult . create ( null , String . format ( "Variables used as format strings that are not local variables must be compile time" + " constants.\n%s is neither a local variable nor a compile time constant." , formatStringTree ) ) ;... |
public class ConnectionType { /** * Get the connection type from the virtual connection .
* @ param vc
* @ return ConnectionType */
public static ConnectionType getVCConnectionType ( VirtualConnection vc ) { } } | if ( vc == null ) { return null ; } return ( ConnectionType ) vc . getStateMap ( ) . get ( CONNECTION_TYPE_VC_KEY ) ; |
public class TimSort { /** * Merges the two runs at stack indices i and i + 1 . Run i must be
* the penultimate or antepenultimate run on the stack . In other words ,
* i must be equal to stackSize - 2 or stackSize - 3.
* @ param i stack index of the first of the two runs to merge */
private void mergeAt ( int i ... | assert stackSize >= 2 ; assert i >= 0 ; assert i == stackSize - 2 || i == stackSize - 3 ; int base1 = runBase [ i ] ; int len1 = runLen [ i ] ; int base2 = runBase [ i + 1 ] ; int len2 = runLen [ i + 1 ] ; assert len1 > 0 && len2 > 0 ; assert base1 + len1 == base2 ; /* * Record the length of the combined runs ; if i is... |
public class PropertyChangesStatistics { /** * Show an alert containing useful information for debugging . It also
* shows how many registrations happened since last call ; that ' s useful
* to detect registration leaks . */
String getStatistics ( ) { } } | String msg = "PropertyChanges stats :\r\n" + "# registered handlers : " + nbRegisteredHandlers + "\r\n" + "# notifications : " + nbNotifications + "\r\n" + "# dispatches : " + nbDispatches + "\r\n" ; StringBuilder details = new StringBuilder ( ) ; for ( Entry < String , Integer > e : counts . entrySet ( ... |
public class GetDomainNamesResult { /** * The elements from this collection .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setItems ( java . util . Collection ) } or { @ link # withItems ( java . util . Collection ) } if you want to override the
* existi... | if ( this . items == null ) { setItems ( new java . util . ArrayList < DomainName > ( items . length ) ) ; } for ( DomainName ele : items ) { this . items . add ( ele ) ; } return this ; |
public class FileSystemConnector { /** * Utility method for obtaining the { @ link File } object that corresponds to the supplied identifier . Subclasses may override
* this method to change the format of the identifiers , but in that case should also override the { @ link # isRoot ( String ) } ,
* { @ link # isCon... | assert id . startsWith ( DELIMITER ) ; if ( id . endsWith ( DELIMITER ) ) { id = id . substring ( 0 , id . length ( ) - DELIMITER . length ( ) ) ; } if ( isContentNode ( id ) ) { id = id . substring ( 0 , id . length ( ) - JCR_CONTENT_SUFFIX_LENGTH ) ; } return new File ( directory , id ) ; |
public class TrellisUtils { /** * / * package - private because of JPMS */
static < T > Optional < T > findFirst ( final Class < T > service ) { } } | final ServiceLoader < T > loader = load ( service ) ; if ( loader == null ) return empty ( ) ; final Iterator < T > services = loader . iterator ( ) ; return services . hasNext ( ) ? of ( services . next ( ) ) : empty ( ) ; |
public class BoardingPassBuilder { /** * Adds a secondary field for the current { @ link BoardingPass } object . This
* field is optional . There can be at most 5 secondary fields per boarding
* pass .
* @ param label
* the label for the additional field . It can ' t be empty .
* @ param value
* the value f... | Field field = new Field ( label , value ) ; this . boardingPass . addSecondaryField ( field ) ; return this ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcPipeFitting ( ) { } } | if ( ifcPipeFittingEClass == null ) { ifcPipeFittingEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 419 ) ; } return ifcPipeFittingEClass ; |
public class TransferSQLText { /** * Method declaration
* @ param type
* @ param r
* @ param p
* @ throws SQLException */
private void transferRow ( TransferResultSet r ) throws Exception { } } | String sLast = "" ; int len = r . getColumnCount ( ) ; if ( WTextWrite == null ) { try { WTextWrite = new BufferedWriter ( new FileWriter ( sFileName ) ) ; } catch ( IOException e ) { throw new DataAccessPointException ( e . getMessage ( ) ) ; } } for ( int i = 0 ; i < len ; i ++ ) { int t = r . getColumnType ( i + 1 )... |
public class InterfaceService { /** * Allows to show a globally registered dialog .
* @ param dialogControllerClass class managing a single dialog . */
public void showDialog ( final Class < ? > dialogControllerClass ) { } } | if ( currentController != null ) { dialogControllers . get ( dialogControllerClass ) . show ( currentController . getStage ( ) ) ; } |
public class MessageCacheImpl { /** * Removes a message from the cache .
* @ param message The message to remove . */
public void removeMessage ( Message message ) { } } | synchronized ( messages ) { messages . removeIf ( messageRef -> Objects . equals ( messageRef . get ( ) , message ) ) ; } |
public class JsonUtil { /** * Returns a field in a Json object as a double .
* Throws IllegalArgumentException if the field value is null .
* @ param object the Json Object
* @ param field the field in the Json object to return
* @ return the Json field value as a double */
public static double getDouble ( Json... | final JsonValue value = object . get ( field ) ; throwExceptionIfNull ( value , field ) ; return value . asDouble ( ) ; |
public class DecimalFormat { /** * Check validity of using fast - path for this instance . If fast - path is valid
* for this instance , sets fast - path state as true and initializes fast - path
* utility fields as needed .
* This method is supposed to be called rarely , otherwise that will break the
* fast - ... | boolean fastPathWasOn = isFastPath ; if ( ( roundingMode == RoundingMode . HALF_EVEN ) && ( isGroupingUsed ( ) ) && ( groupingSize == 3 ) && ( secondaryGroupingSize == 0 ) && ( multiplier == 1 ) && ( ! decimalSeparatorAlwaysShown ) && ( ! useExponentialNotation ) ) { // The fast - path algorithm is semi - hardcoded aga... |
public class ClassHelper { /** * Check if the passed class is an interface or not . Please note that
* annotations are also interfaces !
* @ param aClass
* The class to check .
* @ return < code > true < / code > if the class is an interface ( or an annotation ) */
public static boolean isInterface ( @ Nullable... | return aClass != null && Modifier . isInterface ( aClass . getModifiers ( ) ) ; |
public class InternalUtilities { /** * getConstraints , This returns a grid bag constraints object that can be used for placing a
* component appropriately into a grid bag layout . */
static public GridBagConstraints getConstraints ( int gridx , int gridy ) { } } | GridBagConstraints gc = new GridBagConstraints ( ) ; gc . fill = GridBagConstraints . BOTH ; gc . gridx = gridx ; gc . gridy = gridy ; return gc ; |
public class HttpHeaders { /** * Returns the list value to use for the given parameter passed to the setter method . */
private < T > List < T > getAsList ( T passedValue ) { } } | if ( passedValue == null ) { return null ; } List < T > result = new ArrayList < T > ( ) ; result . add ( passedValue ) ; return result ; |
public class X509CRL { /** * Verifies that this CRL was signed using the
* private key that corresponds to the given public key .
* This method uses the signature verification engine
* supplied by the given provider . Note that the specified Provider object
* does not have to be registered in the provider list ... | // BEGIN Android - changed
// TODO ( user ) : was X509CRLImpl . verify ( this , key , sigProvider ) ;
// As the javadoc says , this " default implementation " was introduced as to avoid breaking
// providers that generate concrete subclasses of this class .
// The method X509Impl in the original definition calls this m... |
public class Domain { /** * Choose a value from this { @ link Domain } according to the given { @ link ValueChoiceFunction } identifier .
* @ param vcf A { @ link ValueChoiceFunction } function identifier .
* @ return A value chosen according to the given { @ link ValueChoiceFunction } .
* @ throws IllegalValueCh... | if ( ! valueChoiceFunctions . containsKey ( this . getClass ( ) ) ) throw new Error ( "No value choice function defined for domains fo type " + this . getClass ( ) . getSimpleName ( ) ) ; HashMap < String , ValueChoiceFunction > vcfs = valueChoiceFunctions . get ( this . getClass ( ) ) ; if ( vcfs == null ) throw new E... |
public class vpnglobal_authenticationnegotiatepolicy_binding { /** * Use this API to fetch filtered set of vpnglobal _ authenticationnegotiatepolicy _ binding resources .
* filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */
public static vpnglobal_authenticationnegotiatepolicy_bindi... | vpnglobal_authenticationnegotiatepolicy_binding obj = new vpnglobal_authenticationnegotiatepolicy_binding ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; vpnglobal_authenticationnegotiatepolicy_binding [ ] response = ( vpnglobal_authenticationnegotiatepolicy_binding [ ] ) obj . getfiltered ( s... |
public class ConstraintsConverter { /** * Register a converter for a specific constraint .
* @ param c the converter to register */
public void register ( ConstraintConverter < ? extends Constraint > c ) { } } | java2json . put ( c . getSupportedConstraint ( ) , c ) ; json2java . put ( c . getJSONId ( ) , c ) ; |
public class IdClassMetadata { /** * Creates and returns the MethodHandle for the constructor .
* @ return the MethodHandle for the constructor . */
private MethodHandle findConstructor ( ) { } } | try { MethodHandle mh = MethodHandles . publicLookup ( ) . findConstructor ( clazz , MethodType . methodType ( void . class , getIdType ( ) ) ) ; return mh ; } catch ( NoSuchMethodException | IllegalAccessException exp ) { String pattern = "Class %s requires a public constructor with one parameter of type %s" ; String ... |
public class JPAExEntityManager { /** * d465813 / / switch to ' bindings ' d511673 */
static boolean hasAppManagedPC ( Collection < InjectionBinding < ? > > injectionBindings , String ejbName , Set < String > persistenceRefNames ) { } } | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "hasAppManagedPC : " + ( ( injectionBindings != null ) ? ( "<" + injectionBindings . size ( ) + "> :" + injectionBindings ) : "No Injection Bindings" ) ) ; boolean rtnValue = false ; if ( i... |
public class DoubleStreamEx { /** * Returns the maximum element of this stream according to the provided key
* extractor function .
* This is a terminal operation .
* @ param keyExtractor a non - interfering , stateless function
* @ return an { @ code OptionalDouble } describing the first element of this
* st... | return collect ( PrimitiveBox :: new , ( box , d ) -> { long key = keyExtractor . applyAsLong ( d ) ; if ( ! box . b || box . l < key ) { box . b = true ; box . l = key ; box . d = d ; } } , PrimitiveBox . MAX_LONG ) . asDouble ( ) ; |
public class MapServiceContextImpl { /** * TODO : interceptors should get a wrapped object which includes the serialized version */
@ Override public Object interceptGet ( String mapName , Object value ) { } } | MapContainer mapContainer = getMapContainer ( mapName ) ; InterceptorRegistry interceptorRegistry = mapContainer . getInterceptorRegistry ( ) ; List < MapInterceptor > interceptors = interceptorRegistry . getInterceptors ( ) ; Object result = null ; if ( ! interceptors . isEmpty ( ) ) { result = toObject ( value ) ; fo... |
public class Utils { /** * Check whether value matches the pattern build with prefix , middle part
* and post - fixer .
* @ param value a value to be checked
* @ param prefix a prefix pattern
* @ param middle a middle pattern
* @ param postfix a post - fixer pattern
* @ return true if value matches pattern ... | String pattern = prefix + middle + postfix ; boolean result = value . matches ( pattern ) ; return result ; |
public class TranscoderDB { /** * / * make _ transcoder _ entry */
static Entry makeEntry ( byte [ ] source , byte [ ] destination ) { } } | CaseInsensitiveBytesHash < Entry > sHash = transcoders . get ( source ) ; if ( sHash == null ) { sHash = new CaseInsensitiveBytesHash < Entry > ( ) ; transcoders . putDirect ( source , sHash ) ; } Entry entry = sHash . get ( destination ) ; if ( entry == null ) { entry = new Entry ( source , destination ) ; sHash . put... |
public class TableColumnStyle { /** * Append the XML to the table representation
* @ param util an util
* @ param appendable the destination
* @ param count the number of columns concerned
* @ throws IOException if an I / O error occurs */
public void appendXMLToTable ( final XMLUtil util , final Appendable app... | appendable . append ( "<table:table-column" ) ; util . appendEAttribute ( appendable , "table:style-name" , this . name ) ; if ( count > 1 ) util . appendAttribute ( appendable , "table:number-columns-repeated" , count ) ; if ( this . defaultCellStyle != null ) util . appendEAttribute ( appendable , "table:default-cell... |
public class StoreConfig { /** * Gets a boolean property via a string property name .
* @ param pName - the property name
* @ param defaultValue - the default property value
* @ return a boolean property */
public boolean getBoolean ( String pName , boolean defaultValue ) { } } | String pValue = _properties . getProperty ( pName ) ; return parseBoolean ( pName , pValue , defaultValue ) ; |
public class Distance { /** * Gets the Symmetric Kullback - Leibler distance .
* This metric is valid only for real and positive P and Q .
* @ param p P vector .
* @ param q Q vector .
* @ return The Symmetric Kullback Leibler distance between p and q . */
public static double SymmetricKullbackLeibler ( double ... | double dist = 0 ; for ( int i = 0 ; i < p . length ; i ++ ) { dist += ( p [ i ] - q [ i ] ) * ( Math . log ( p [ i ] ) - Math . log ( q [ i ] ) ) ; } return dist ; |
public class WriterUtils { /** * Add a type parameter to the given executable member .
* @ param typeParameters the type parameters .
* @ param htmlTree the output .
* @ param configuration the configuration .
* @ param writer the background writer . */
public static void addTypeParameters ( Content typeParamet... | if ( ! typeParameters . isEmpty ( ) ) { htmlTree . addContent ( " " ) ; // $ NON - NLS - 1 $
htmlTree . addContent ( Utils . keyword ( Utils . getKeywords ( ) . getWithKeyword ( ) ) ) ; htmlTree . addContent ( " " ) ; // $ NON - NLS - 1 $
htmlTree . addContent ( typeParameters ) ; htmlTree . addContent ( " " ) ; // $ N... |
public class DirectoryRegistrationService { /** * Update the metadata attribute of the ProvidedServiceInstance
* The ProvidedServiceInstance is uniquely identified by serviceName and providerAddress
* @ param serviceName
* the serviceName of the ProvidedServiceInstance .
* @ param providerAddress
* The IP add... | getServiceDirectoryClient ( ) . updateInstanceMetadata ( serviceName , providerAddress , metadata , disableOwnerError ) ; |
public class ReversePurgeItemHashMap { /** * assume newSize is power of 2 */
@ SuppressWarnings ( "unchecked" ) void resize ( final int newSize ) { } } | final Object [ ] oldKeys = keys ; final long [ ] oldValues = values ; final short [ ] oldStates = states ; keys = new Object [ newSize ] ; values = new long [ newSize ] ; states = new short [ newSize ] ; loadThreshold = ( int ) ( newSize * LOAD_FACTOR ) ; lgLength = Integer . numberOfTrailingZeros ( newSize ) ; numActi... |
public class CmsMacroResolver { /** * Resolves the macros in the given input . < p >
* Calls < code > { @ link # resolveMacros ( String ) } < / code > until no more macros can
* be resolved in the input . This way " nested " macros in the input are resolved as well . < p >
* @ see org . opencms . util . I _ CmsMa... | String result = input ; if ( input != null ) { String lastResult ; do { // save result for next comparison
lastResult = result ; // resolve the macros
result = CmsMacroResolver . resolveMacros ( result , this ) ; // if nothing changes then the final result is found
} while ( ! result . equals ( lastResult ) ) ; } // re... |
public class Config { /** * Read config object stored in JSON format from < code > String < / code >
* @ param content of config
* @ return config
* @ throws IOException error */
public static Config fromJSON ( String content ) throws IOException { } } | ConfigSupport support = new ConfigSupport ( ) ; return support . fromJSON ( content , Config . class ) ; |
public class PropertyChangeSupport { /** * Remove a PropertyChangeListener from the listener list .
* This removes a PropertyChangeListener that was registered
* for all properties .
* If < code > listener < / code > was added more than once to the same event
* source , it will be notified one less time after b... | if ( listener == null ) { return ; } if ( listener instanceof PropertyChangeListenerProxy ) { PropertyChangeListenerProxy proxy = ( PropertyChangeListenerProxy ) listener ; // Call two argument remove method .
removePropertyChangeListener ( proxy . getPropertyName ( ) , proxy . getListener ( ) ) ; } else { this . map .... |
public class HmacSignatureBuilder { /** * 判断期望摘要是否与已构建的摘要相等 .
* @ param expectedSignatureHex
* 传入的期望摘要16进制编码表示的字符串
* @ param builderMode
* 采用的构建模式
* @ return < code > true < / code > - 期望摘要与已构建的摘要相等 ; < code > false < / code > -
* 期望摘要与已构建的摘要不相等
* @ author zhd
* @ since 1.0.0 */
public boolean isHashEqu... | try { final byte [ ] signature = build ( builderMode ) ; return MessageDigest . isEqual ( signature , DatatypeConverter . parseHexBinary ( expectedSignatureHex ) ) ; } catch ( Throwable e ) { System . err . println ( e . getMessage ( ) ) ; return false ; } |
public class PactDslRootValue { /** * Value that must be an integer */
public static PactDslRootValue integerType ( ) { } } | PactDslRootValue value = new PactDslRootValue ( ) ; value . generators . addGenerator ( Category . BODY , "" , new RandomIntGenerator ( 0 , Integer . MAX_VALUE ) ) ; value . setValue ( 100 ) ; value . setMatcher ( new NumberTypeMatcher ( NumberTypeMatcher . NumberType . INTEGER ) ) ; return value ; |
public class MinimalJmxServer { /** * Try to register standard MBean type in the JMX server
* @ param beanClass the class name of the MBean */
public final boolean registerMBean ( final Class < ? > clazz ) { } } | if ( this . mbs != null && clazz != null ) { try { final String fqnName = clazz . getCanonicalName ( ) ; final String domain = fqnName . substring ( 0 , fqnName . lastIndexOf ( '.' ) ) ; final String type = fqnName . substring ( fqnName . lastIndexOf ( '.' ) + 1 ) ; final ObjectName objectName = new ObjectName ( String... |
public class GosuStringUtil { /** * < p > Overlays part of a String with another String . < / p >
* < p > A < code > null < / code > string input returns < code > null < / code > .
* A negative index is treated as zero .
* An index greater than the string length is treated as the string length .
* The start ind... | if ( str == null ) { return null ; } if ( overlay == null ) { overlay = EMPTY ; } int len = str . length ( ) ; if ( start < 0 ) { start = 0 ; } if ( start > len ) { start = len ; } if ( end < 0 ) { end = 0 ; } if ( end > len ) { end = len ; } if ( start > end ) { int temp = start ; start = end ; end = temp ; } return n... |
public class JsonReader { /** * 跳过属性的值 */
@ Override public final void skipValue ( ) { } } | final char ch = nextGoodChar ( ) ; switch ( ch ) { case '"' : case '\'' : backChar ( ch ) ; readString ( ) ; break ; case '{' : while ( hasNext ( ) ) { this . readSmallString ( ) ; // 读掉field
this . readBlank ( ) ; this . skipValue ( ) ; } break ; case '[' : while ( hasNext ( ) ) { this . skipValue ( ) ; } break ; defa... |
public class GenericUtils { /** * Create a new object of type < code > T < / code > , which is cloned from < code > value < / code > .
* The equivalent class copy constructor is invoked .
* @ param value
* @ param < T >
* @ return
* @ throws MIDDException */
public static < T > T newInstance ( final T value )... | if ( value == null ) { return null ; } else { return newInstance ( value , value . getClass ( ) ) ; } |
public class P3DatabaseReader { /** * Configure the mapping between a database column and a field .
* @ param container column to field map
* @ param name column name
* @ param type field type */
private static void defineField ( Map < String , FieldType > container , String name , FieldType type ) { } } | defineField ( container , name , type , null ) ; |
public class JmxData { /** * Get data from JMX using object name query expression . */
static List < JmxData > query ( ObjectName query ) throws Exception { } } | return query ( ManagementFactory . getPlatformMBeanServer ( ) , query ) ; |
public class CompileUtils { /** * Compiles Java code and returns compiled class back . */
public static Class compileClass ( String name , String code , List < Class > classPath ) throws Exception { } } | JavaCompiler compiler = ToolProvider . getSystemJavaCompiler ( ) ; DiagnosticCollector < JavaFileObject > diagnostics = new DiagnosticCollector < JavaFileObject > ( ) ; MemoryJavaFileManager fileManager = new MemoryJavaFileManager ( compiler . getStandardFileManager ( null , null , null ) ) ; List < JavaFileObject > ja... |
public class MyActivity { /** * Callback once we are done with the authorization of this app
* @ param intent */
@ Override public void onNewIntent ( Intent intent ) { } } | super . onNewIntent ( intent ) ; // Verify OAuth callback
Uri uri = intent . getData ( ) ; if ( uri != null && uri . getScheme ( ) . equals ( OAUTH_CALLBACK_SCHEME ) ) { String verifier = uri . getQueryParameter ( OAuth . OAUTH_VERIFIER ) ; new UpworkRetrieveAccessTokenTask ( ) . execute ( verifier ) ; } |
public class GaplessSoundOutputStreamImpl { /** * This method will only create a new line if
* a ) an AudioFormat is set
* and
* b ) no line is open
* c ) or the already open Line is not matching the audio format needed
* After creating or reusing the line , status " open " and " running " are ensured
* @ s... | try { if ( audioFormat != null && ( sourceLine == null || ( sourceLine != null && ! sourceLine . getFormat ( ) . matches ( audioFormat ) ) ) ) { super . openSourceLine ( ) ; } else if ( sourceLine != null ) { if ( ! sourceLine . isOpen ( ) ) sourceLine . open ( ) ; if ( ! sourceLine . isRunning ( ) ) sourceLine . start... |
public class PropertyList { /** * Returns the first property of specified name .
* @ param aName name of property to return
* @ return a property or null if no matching property found */
public final < R > R getProperty ( final String aName ) { } } | for ( final T p : this ) { if ( p . getName ( ) . equalsIgnoreCase ( aName ) ) { return ( R ) p ; } } return null ; |
public class Matrix4x3d { /** * Set the value of the matrix element at column 0 and row 2.
* @ param m02
* the new value
* @ return this */
public Matrix4x3d m02 ( double m02 ) { } } | this . m02 = m02 ; properties &= ~ PROPERTY_ORTHONORMAL ; if ( m02 != 0.0 ) properties &= ~ ( PROPERTY_IDENTITY | PROPERTY_TRANSLATION ) ; return this ; |
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public IfcAnalysisModelTypeEnum createIfcAnalysisModelTypeEnumFromString ( EDataType eDataType , String initialValue ) { } } | IfcAnalysisModelTypeEnum result = IfcAnalysisModelTypeEnum . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class DurableInputHandler { /** * This method is a NOP for durable handlers .
* @ param msg ignored
* @ param transaction ignored
* @ param producerSession ignored
* @ param sourceCellule ignored
* @ param targetCellule ignored */
public void handleMessage ( MessageItem msg , TransactionCommon transact... | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "handleMessage" , new Object [ ] { msg , transaction , sourceMEUuid } ) ; SIErrorException e = new SIErrorException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0001" , new Object [ ] { "com.ibm.ws.sib.proces... |
public class MutateRowsAttemptCallable { /** * Create a synthetic { @ link ApiException } for an individual entry . When the entire RPC fails , it
* implies that all entries failed as well . This helper is used to make that behavior explicit .
* The generated exception will have the overall error as its cause . */
... | if ( overallRequestError instanceof ApiException ) { ApiException requestApiException = ( ApiException ) overallRequestError ; return ApiExceptionFactory . createException ( "Didn't receive a result for this mutation entry" , overallRequestError , requestApiException . getStatusCode ( ) , requestApiException . isRetrya... |
public class ShareableSupportedWorkspaceDataManager { /** * { @ inheritDoc } */
public List < PropertyData > getReferencesData ( String identifier , boolean skipVersionStorage ) throws RepositoryException { } } | return persistentManager . getReferencesData ( identifier , skipVersionStorage ) ; |
public class ListStepsResult { /** * The filtered list of steps for the cluster .
* @ return The filtered list of steps for the cluster . */
public java . util . List < StepSummary > getSteps ( ) { } } | if ( steps == null ) { steps = new com . amazonaws . internal . SdkInternalList < StepSummary > ( ) ; } return steps ; |
public class ResourceController { /** * Checks if an activity that requires the given resource list
* can run immediately .
* This method is really only useful as a hint , since
* another activity might acquire resources before the caller
* gets to call { @ link # execute ( Runnable , ResourceActivity ) } . */
... | try { return _withLock ( new Callable < Boolean > ( ) { @ Override public Boolean call ( ) { return ! inUse . isCollidingWith ( resources ) ; } } ) ; } catch ( Exception e ) { throw new IllegalStateException ( "Inner callable does not throw exception" ) ; } |
public class HeartbeatHandler { /** * called periodically to check that the heartbeat has been received
* @ return { @ code true } if we have received a heartbeat recently */
private boolean hasReceivedHeartbeat ( ) { } } | long currentTimeMillis = System . currentTimeMillis ( ) ; boolean result = lastTimeMessageReceived + heartbeatTimeoutMs >= currentTimeMillis ; if ( ! result ) Jvm . warn ( ) . on ( getClass ( ) , Integer . toHexString ( hashCode ( ) ) + " missed heartbeat, lastTimeMessageReceived=" + lastTimeMessageReceived + ", curren... |
public class DefaultGrailsPluginManager { /** * This method will attempt to load that plug - ins not loaded in the first pass */
private void loadDelayedPlugins ( ) { } } | while ( ! delayedLoadPlugins . isEmpty ( ) ) { GrailsPlugin plugin = delayedLoadPlugins . remove ( 0 ) ; if ( areDependenciesResolved ( plugin ) ) { if ( ! hasValidPluginsToLoadBefore ( plugin ) ) { registerPlugin ( plugin ) ; } else { delayedLoadPlugins . add ( plugin ) ; } } else { // ok , it still hasn ' t resolved ... |
public class SystemUtil { /** * Retrieves a System property , or returns some default value if :
* < ul >
* < li > the property isn ' t found < / li >
* < li > the property name is null or empty < / li >
* < li > if a security manager exists and its checkPropertyAccess method doesn ' t allow access to the speci... | try { return System . getProperty ( name , defaultValue ) ; } catch ( SecurityException | NullPointerException | IllegalArgumentException ignore ) { // suppress exception
} return defaultValue ; |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public IPOOvlyOrent createIPOOvlyOrentFromString ( EDataType eDataType , String initialValue ) { } } | IPOOvlyOrent result = IPOOvlyOrent . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class JsonReader { /** * Read the Json from the passed File .
* @ param aFile
* The file containing the Json to be parsed . May not be
* < code > null < / code > .
* @ param aFallbackCharset
* The charset to be used in case no BOM is present . May not be
* < code > null < / code > .
* @ param aCust... | return readFromStream ( new FileSystemResource ( aFile ) , aFallbackCharset , aCustomExceptionHandler ) ; |
public class DefaultValues { /** * Returns the specified value if it is specified by a user . */
public static Optional < String > getSpecifiedValue ( @ Nullable String value ) { } } | return isSpecified ( value ) ? Optional . ofNullable ( value ) : Optional . empty ( ) ; |
public class AwsCodeCommitCredentialProvider { /** * This provider can handle uris like
* https : / / git - codecommit . $ AWS _ REGION . amazonaws . com / v1 / repos / $ REPO .
* @ param uri uri to parse
* @ return { @ code true } if the URI can be handled */
public static boolean canHandle ( String uri ) { } } | if ( ! hasText ( uri ) ) { return false ; } try { URL url = new URL ( uri ) ; URI u = new URI ( url . getProtocol ( ) , url . getUserInfo ( ) , url . getHost ( ) , url . getPort ( ) , url . getPath ( ) , url . getQuery ( ) , url . getRef ( ) ) ; if ( u . getScheme ( ) . equals ( "https" ) ) { String host = u . getHost ... |
public class DSUtil { /** * Construct a < code > Function < / code > based on a map . The
* resulting function will throw an exception if invoked on an
* element that is unassigned in < code > map < / code > . */
public static < K , V > Function < K , V > map2fun ( final Map < K , V > map ) { } } | return new Function < K , V > ( ) { public V f ( K key ) { V value = map . get ( key ) ; if ( value == null ) { throw new Error ( "No value for " + key ) ; } return value ; } } ; |
public class Stream { /** * Returns a stream consisting of the results of replacing each element of
* this stream with the contents of a mapped stream produced by applying
* the provided mapping function to each element .
* < p > This is an intermediate operation .
* @ param mapper the mapper function used to a... | return new DoubleStream ( params , new ObjFlatMapToDouble < T > ( iterator , mapper ) ) ; |
public class LoadBalancerService { /** * { @ inheritDoc } */
@ Override public Stream < LoadBalancerMetadata > findLazy ( LoadBalancerFilter filter ) { } } | checkNotNull ( filter , "Filter must be not a null" ) ; Stream < DataCenterMetadata > dataCenters = dataCenterService . findLazy ( filter . getDataCenterFilter ( ) ) ; return dataCenters . flatMap ( datacenter -> loadBalancerClient . getLoadBalancers ( datacenter . getId ( ) ) . stream ( ) ) . filter ( filter . getPred... |
public class TokenList { /** * Inserts the LokenList immediately following the ' before ' token */
public void insertAfter ( Token before , TokenList list ) { } } | Token after = before . next ; before . next = list . first ; list . first . previous = before ; if ( after == null ) { last = list . last ; } else { after . previous = list . last ; list . last . next = after ; } size += list . size ; |
public class QueryParameters { /** * getters */
public Map < String , List < ? extends Object > > getUnionParameters ( ) { } } | if ( unionParameters == null ) { unionParameters = new HashMap < String , List < ? extends Object > > ( ) ; } return unionParameters ; |
public class TileTextKpiSkin { /** * * * * * * Initialization * * * * * */
private void initGraphics ( ) { } } | // Set initial size
if ( Double . compare ( gauge . getPrefWidth ( ) , 0.0 ) <= 0 || Double . compare ( gauge . getPrefHeight ( ) , 0.0 ) <= 0 || Double . compare ( gauge . getWidth ( ) , 0.0 ) <= 0 || Double . compare ( gauge . getHeight ( ) , 0.0 ) <= 0 ) { if ( gauge . getPrefWidth ( ) > 0 && gauge . getPrefHeight (... |
public class Dialog { /** * Set the background drawable of positive action button .
* @ param id The resourceId of drawable .
* @ return The Dialog for chaining methods . */
public Dialog positiveActionBackground ( int id ) { } } | return positiveActionBackground ( id == 0 ? null : getContext ( ) . getResources ( ) . getDrawable ( id ) ) ; |
public class AbstractChecksumMojo { /** * { @ inheritDoc } */
@ Override public void execute ( ) throws MojoExecutionException , MojoFailureException { } } | // Prepare an execution .
Execution execution = ( failOnError ) ? new FailOnErrorExecution ( ) : new NeverFailExecution ( getLog ( ) ) ; execution . setAlgorithms ( algorithms ) ; execution . setFiles ( getFilesToProcess ( ) ) ; execution . setFailIfNoFiles ( isFailIfNoFiles ( ) ) ; execution . setFailIfNoAlgorithms ( ... |
public class Publisher { /** * Schedules the publishing of a message . The publishing of the message may occur immediately or
* be delayed based on the publisher batching options .
* < p > Example of publishing a message .
* < pre > { @ code
* String message = " my _ message " ;
* ByteString data = ByteString... | if ( shutdown . get ( ) ) { throw new IllegalStateException ( "Cannot publish on a shut-down publisher." ) ; } final OutstandingPublish outstandingPublish = new OutstandingPublish ( messageTransform . apply ( message ) ) ; List < OutstandingBatch > batchesToSend ; messagesBatchLock . lock ( ) ; try { batchesToSend = me... |
public class RequestLoggingFilter { protected String handleClientError ( HttpServletRequest request , HttpServletResponse response , RequestClientErrorException cause ) throws IOException { } } | final boolean beforeHandlingCommitted = response . isCommitted ( ) ; // basically false
processClientErrorCallback ( request , response , cause ) ; final String title ; if ( response . isCommitted ( ) ) { title = response . getStatus ( ) + " (thrown as " + cause . getTitle ( ) + ")" ; if ( beforeHandlingCommitted ) { /... |
public class HtmlTree { /** * Generates a NOSCRIPT tag with some content .
* @ param body content of the noscript tag
* @ return an HtmlTree object for the NOSCRIPT tag */
public static HtmlTree NOSCRIPT ( Content body ) { } } | HtmlTree htmltree = new HtmlTree ( HtmlTag . NOSCRIPT , nullCheck ( body ) ) ; return htmltree ; |
public class CmsResourceUtil { /** * Sets the cms context . < p >
* @ param cms the cms context to set */
public void setCms ( CmsObject cms ) { } } | m_cms = cms ; m_request = cms . getRequestContext ( ) ; m_referenceProject = null ; m_projectResources = null ; m_messages = null ; |
public class EJBMDOrchestrator { /** * This method calculates the bean pool limits of this bean type . There is one
* bean pool for each of the application ' s bean types .
* This method supplies default min / max pool sizes if none
* are specified via system property values .
* The two system properties examin... | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "processBeanPoolLimits" ) ; } boolean checkAppConfigCustom = bmd . isCheckConfig ( ) ; // F743-33178
// The following default values are documented in the info center
// changing them may... |
public class CmsContentEditor { /** * Previews the native event to enable keyboard short cuts . < p >
* @ param event the event */
void previewNativeEvent ( NativePreviewEvent event ) { } } | Event nativeEvent = Event . as ( event . getNativeEvent ( ) ) ; if ( event . getTypeInt ( ) == Event . ONKEYDOWN ) { int keyCode = nativeEvent . getKeyCode ( ) ; if ( nativeEvent . getCtrlKey ( ) || nativeEvent . getMetaKey ( ) ) { // look for short cuts
if ( nativeEvent . getShiftKey ( ) ) { if ( keyCode == KeyCodes .... |
public class ToTextStream { /** * Report an XML comment anywhere in the document .
* This callback will be used for comments inside or outside the
* document element , including comments in the external DTD
* subset ( if read ) .
* @ param ch An array holding the characters in the comment .
* @ param start Th... | flushPending ( ) ; if ( m_tracer != null ) super . fireCommentEvent ( ch , start , length ) ; |
public class CircularQueue_I32 { /** * Adds a new element to the queue . If the queue isn ' t large enough to store this value then its internal data
* array will grow
* @ param value Value which is to be added */
public void add ( int value ) { } } | // see if it needs to grow the queue
if ( size >= data . length ) { int a [ ] = new int [ nextDataSize ( ) ] ; System . arraycopy ( data , start , a , 0 , data . length - start ) ; System . arraycopy ( data , 0 , a , data . length - start , start ) ; start = 0 ; data = a ; } data [ ( start + size ) % data . length ] = ... |
public class CloudDirectoryUtils { /** * Gets attribute key value by name .
* @ param attributesResult the attributes result
* @ param attributeName the attribute name
* @ return the attribute key value by name */
public static AttributeKeyAndValue getAttributeKeyValueByName ( final ListObjectAttributesResult att... | return attributesResult . getAttributes ( ) . stream ( ) . filter ( a -> a . getKey ( ) . getName ( ) . equalsIgnoreCase ( attributeName ) ) . findFirst ( ) . orElse ( null ) ; |
public class IntentUtils { /** * Open a browser window to the URL specified .
* @ param url Target url */
public static Intent openLink ( String url ) { } } | // if protocol isn ' t defined use http by default
if ( ! TextUtils . isEmpty ( url ) && ! url . contains ( "://" ) ) { url = "http://" + url ; } Intent intent = new Intent ( ) ; intent . setAction ( Intent . ACTION_VIEW ) ; intent . setData ( Uri . parse ( url ) ) ; return intent ; |
public class BoxAPIResponse { /** * Returns the response error stream , handling the case when it contains gzipped data .
* @ return gzip decoded ( if needed ) error stream or null */
private InputStream getErrorStream ( ) { } } | InputStream errorStream = this . connection . getErrorStream ( ) ; if ( errorStream != null ) { final String contentEncoding = this . connection . getContentEncoding ( ) ; if ( contentEncoding != null && contentEncoding . equalsIgnoreCase ( "gzip" ) ) { try { errorStream = new GZIPInputStream ( errorStream ) ; } catch ... |
public class ChangedFile { /** * Return the name of the file relative to the source folder .
* @ return the relative name */
public String getRelativeName ( ) { } } | File folder = this . sourceFolder . getAbsoluteFile ( ) ; File file = this . file . getAbsoluteFile ( ) ; String folderName = StringUtils . cleanPath ( folder . getPath ( ) ) ; String fileName = StringUtils . cleanPath ( file . getPath ( ) ) ; Assert . state ( fileName . startsWith ( folderName ) , ( ) -> "The file " +... |
public class RestClientUtil { /** * 创建或者更新索引文档
* @ param indexName
* @ param indexType
* @ param params
* @ return
* @ throws ElasticSearchException */
public String addMapDocument ( String indexName , String indexType , Map params , ClientOptions clientOptions ) throws ElasticSearchException { } } | Object docId = null ; Object parentId = null ; Object routing = null ; String refreshOption = null ; if ( clientOptions != null ) { refreshOption = clientOptions . getRefreshOption ( ) ; docId = clientOptions . getIdField ( ) != null ? params . get ( clientOptions . getIdField ( ) ) : null ; parentId = clientOptions . ... |
public class CommerceAvailabilityEstimateLocalServiceBaseImpl { /** * Returns the commerce availability estimate matching the UUID and group .
* @ param uuid the commerce availability estimate ' s UUID
* @ param groupId the primary key of the group
* @ return the matching commerce availability estimate , or < cod... | return commerceAvailabilityEstimatePersistence . fetchByUUID_G ( uuid , groupId ) ; |
public class PanelUserDAO { /** * Creates new panel user
* @ param panel panel
* @ param user user
* @ param role user ' s role in panel
* @ param joinType join type
* @ param stamp panel stamp
* @ param creator creator user
* @ return new panelist */
public PanelUser create ( Panel panel , User user , Pa... | Date now = new Date ( ) ; PanelUser panelUser = new PanelUser ( ) ; panelUser . setPanel ( panel ) ; panelUser . setUser ( user ) ; panelUser . setRole ( role ) ; panelUser . setJoinType ( joinType ) ; panelUser . setStamp ( stamp ) ; panelUser . setCreated ( now ) ; panelUser . setCreator ( creator ) ; panelUser . set... |
public class ProbeManagerImpl { /** * Add the specified listener to the collection of listeners associated
* with the specified probe .
* @ param probe the probe that fires for the listener
* @ param listener the listener that ' s driven by the probe */
void addListenerByProbe ( ProbeImpl probe , ProbeListener li... | Set < ProbeListener > listeners = listenersByProbe . get ( probe ) ; if ( listeners == null ) { listeners = new CopyOnWriteArraySet < ProbeListener > ( ) ; listenersByProbe . putIfAbsent ( probe , listeners ) ; listeners = listenersByProbe . get ( probe ) ; } listeners . add ( listener ) ; |
public class Authorization { /** * Approves a pending Issuing < code > Authorization < / code > object . */
public Authorization approve ( Map < String , Object > params ) throws StripeException { } } | return approve ( params , ( RequestOptions ) null ) ; |
public class Hex { /** * Create a String from a char array with zero - copy ( if available ) , using reflection to access a package - protected constructor of String . */
public static String wrapCharArray ( char [ ] c ) { } } | if ( c == null ) return null ; String s = null ; if ( stringConstructor != null ) { try { s = stringConstructor . newInstance ( 0 , c . length , c ) ; } catch ( Exception e ) { // Swallowing as we ' ll just use a copying constructor
} } return s == null ? new String ( c ) : s ; |
public class ListConfigurationSetsResult { /** * An object that contains a list of configuration sets for your account in the current region .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setConfigurationSets ( java . util . Collection ) } or { @ link # wi... | if ( this . configurationSets == null ) { setConfigurationSets ( new java . util . ArrayList < String > ( configurationSets . length ) ) ; } for ( String ele : configurationSets ) { this . configurationSets . add ( ele ) ; } return this ; |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public FullyQualifiedNameFQNType createFullyQualifiedNameFQNTypeFromString ( EDataType eDataType , String initialValue ) { } } | FullyQualifiedNameFQNType result = FullyQualifiedNameFQNType . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class BundledComponentRepository { /** * documentation inherited */
public CharacterComponent getComponent ( int componentId ) throws NoSuchComponentException { } } | CharacterComponent component = _components . get ( componentId ) ; if ( component == null ) { throw new NoSuchComponentException ( componentId ) ; } return component ; |
public class BlockReconstructor { /** * Returns a DistributedFileSystem hosting the path supplied . */
protected DistributedFileSystem getDFS ( Path p ) throws IOException { } } | FileSystem fs = p . getFileSystem ( getConf ( ) ) ; DistributedFileSystem dfs = null ; if ( fs instanceof DistributedFileSystem ) { dfs = ( DistributedFileSystem ) fs ; } else if ( fs instanceof FilterFileSystem ) { FilterFileSystem ffs = ( FilterFileSystem ) fs ; if ( ffs . getRawFileSystem ( ) instanceof DistributedF... |
public class XAttributeMapConverter { /** * ( non - Javadoc )
* @ see
* com . thoughtworks . xstream . converters . Converter # unmarshal ( com . thoughtworks
* . xstream . io . HierarchicalStreamReader ,
* com . thoughtworks . xstream . converters . UnmarshallingContext ) */
public Object unmarshal ( Hierarchi... | XAttributeMap map = null ; // restore correct type of attribute map , i . e . , check for buffered
// implementation , and correctly restore lazy implementation if
// this had been used for serialization .
boolean lazy = reader . getAttribute ( "lazy" ) . equals ( "true" ) ; boolean buffered = reader . getAttribute ( "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.