signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class RelationalBinding { /** * Creates a ' NOT _ EQUAL ' binding .
* @ param property
* the property .
* @ param value
* the value to which the property should be related .
* @ return
* a ' NOT _ EQUAL ' binding . */
public static RelationalBinding notEqualBinding ( final String property , final Object value ) { } } | return ( new RelationalBinding ( property , Relation . NOT_EQUAL , value ) ) ; |
public class FeatureUtilities { /** * Find the name of an attribute , case insensitive .
* @ param featureType the feature type to check .
* @ param field the case insensitive field name .
* @ return the real name of the field , or < code > null < / code > , if none found . */
public static String findAttributeName ( SimpleFeatureType featureType , String field ) { } } | List < AttributeDescriptor > attributeDescriptors = featureType . getAttributeDescriptors ( ) ; for ( AttributeDescriptor attributeDescriptor : attributeDescriptors ) { String name = attributeDescriptor . getLocalName ( ) ; if ( name . toLowerCase ( ) . equals ( field . toLowerCase ( ) ) ) { return name ; } } return null ; |
public class PathNormalizer { /** * This method can calculate the relative path between two pathes on a file
* system . < br / >
* < pre >
* PathUtils . getRelativeFilePath ( null , null ) = " "
* PathUtils . getRelativeFilePath ( null , " / usr / local / java / bin " ) = " "
* PathUtils . getRelativeFilePath ( " / usr / local " , null ) = " "
* PathUtils . getRelativeFilePath ( " / usr / local " , " / usr / local / java / bin " ) = " java / bin "
* PathUtils . getRelativeFilePath ( " / usr / local " , " / usr / local / java / bin / " ) = " java / bin "
* PathUtils . getRelativeFilePath ( " / usr / local / java / bin " , " / usr / local / " ) = " . . / . . "
* PathUtils . getRelativeFilePath ( " / usr / local / " , " / usr / local / java / bin / java . sh " ) = " java / bin / java . sh "
* PathUtils . getRelativeFilePath ( " / usr / local / java / bin / java . sh " , " / usr / local / " ) = " . . / . . / . . "
* PathUtils . getRelativeFilePath ( " / usr / local / " , " / bin " ) = " . . / . . / bin "
* PathUtils . getRelativeFilePath ( " / bin " , " / usr / local / " ) = " . . / usr / local "
* < / pre >
* Note : On Windows based system , the < code > / < / code > character should be
* replaced by < code > \ < / code > character .
* @ param oldPath
* @ param newPath
* @ return a relative file path from < code > oldPath < / code > . */
public static final String getRelativeFilePath ( final String oldPath , final String newPath ) { } } | if ( StringUtils . isEmpty ( oldPath ) || StringUtils . isEmpty ( newPath ) ) { return "" ; } // normalise the path delimiters
String fromPath = new File ( oldPath ) . getPath ( ) ; String toPath = new File ( newPath ) . getPath ( ) ; // strip any leading slashes if its a windows path
if ( toPath . matches ( "^\\[a-zA-Z]:" ) ) { toPath = toPath . substring ( 1 ) ; } if ( fromPath . matches ( "^\\[a-zA-Z]:" ) ) { fromPath = fromPath . substring ( 1 ) ; } // lowercase windows drive letters .
if ( fromPath . startsWith ( ":" , 1 ) ) { fromPath = Character . toLowerCase ( fromPath . charAt ( 0 ) ) + fromPath . substring ( 1 ) ; } if ( toPath . startsWith ( ":" , 1 ) ) { toPath = Character . toLowerCase ( toPath . charAt ( 0 ) ) + toPath . substring ( 1 ) ; } // check for the presence of windows drives . No relative way of
// traversing from one to the other .
if ( ( toPath . startsWith ( ":" , 1 ) && fromPath . startsWith ( ":" , 1 ) ) && ( ! toPath . substring ( 0 , 1 ) . equals ( fromPath . substring ( 0 , 1 ) ) ) ) { // they both have drive path element but they dont match , no
// relative path
return null ; } if ( ( toPath . startsWith ( ":" , 1 ) && ! fromPath . startsWith ( ":" , 1 ) ) || ( ! toPath . startsWith ( ":" , 1 ) && fromPath . startsWith ( ":" , 1 ) ) ) { // one has a drive path element and the other doesnt , no relative
// path .
return null ; } String resultPath = buildRelativePath ( toPath , fromPath , File . separatorChar ) ; if ( newPath . endsWith ( File . separator ) && ! resultPath . endsWith ( File . separator ) ) { return resultPath + File . separator ; } return resultPath ; |
public class RowIndexSearcher { /** * { @ inheritDoc } */
@ Override public void validate ( IndexExpression indexExpression ) throws InvalidRequestException { } } | try { String json = UTF8Type . instance . compose ( indexExpression . value ) ; Search . fromJson ( json ) . validate ( schema ) ; } catch ( Exception e ) { throw new InvalidRequestException ( e . getMessage ( ) ) ; } |
public class syslog_sslvpn { /** * < pre >
* Performs generic data validation for the operation to be performed
* < / pre > */
protected void validate ( String operationType ) throws Exception { } } | super . validate ( operationType ) ; MPSLong exporter_id_validator = new MPSLong ( ) ; exporter_id_validator . validate ( operationType , exporter_id , "\"exporter_id\"" ) ; MPSLong priority_validator = new MPSLong ( ) ; priority_validator . validate ( operationType , priority , "\"priority\"" ) ; MPSLong timestamp_validator = new MPSLong ( ) ; timestamp_validator . validate ( operationType , timestamp , "\"timestamp\"" ) ; MPSString hostname_validator = new MPSString ( ) ; hostname_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; hostname_validator . validate ( operationType , hostname , "\"hostname\"" ) ; MPSString process_name_validator = new MPSString ( ) ; process_name_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; process_name_validator . validate ( operationType , process_name , "\"process_name\"" ) ; MPSString module_validator = new MPSString ( ) ; module_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; module_validator . validate ( operationType , module , "\"module\"" ) ; MPSString type_validator = new MPSString ( ) ; type_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; type_validator . validate ( operationType , type , "\"type\"" ) ; MPSString syslog_msg_validator = new MPSString ( ) ; syslog_msg_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 2000 ) ; syslog_msg_validator . validate ( operationType , syslog_msg , "\"syslog_msg\"" ) ; MPSLong sequence_no_validator = new MPSLong ( ) ; sequence_no_validator . validate ( operationType , sequence_no , "\"sequence_no\"" ) ; MPSLong datarecord_rx_time_validator = new MPSLong ( ) ; datarecord_rx_time_validator . validate ( operationType , datarecord_rx_time , "\"datarecord_rx_time\"" ) ; MPSBoolean decoded_validator = new MPSBoolean ( ) ; decoded_validator . validate ( operationType , decoded , "\"decoded\"" ) ; MPSString group_name_validator = new MPSString ( ) ; group_name_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; group_name_validator . validate ( operationType , group_name , "\"group_name\"" ) ; MPSString sessionId_validator = new MPSString ( ) ; sessionId_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; sessionId_validator . validate ( operationType , sessionId , "\"sessionId\"" ) ; MPSString username_validator = new MPSString ( ) ; username_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; username_validator . validate ( operationType , username , "\"username\"" ) ; MPSString clientip_validator = new MPSString ( ) ; clientip_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; clientip_validator . validate ( operationType , clientip , "\"clientip\"" ) ; MPSString vserverip_validator = new MPSString ( ) ; vserverip_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; vserverip_validator . validate ( operationType , vserverip , "\"vserverip\"" ) ; MPSString vserverport_validator = new MPSString ( ) ; vserverport_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; vserverport_validator . validate ( operationType , vserverport , "\"vserverport\"" ) ; MPSString nat_ip_validator = new MPSString ( ) ; nat_ip_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; nat_ip_validator . validate ( operationType , nat_ip , "\"nat_ip\"" ) ; MPSString sourceip_validator = new MPSString ( ) ; sourceip_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; sourceip_validator . validate ( operationType , sourceip , "\"sourceip\"" ) ; MPSString sourceport_validator = new MPSString ( ) ; sourceport_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; sourceport_validator . validate ( operationType , sourceport , "\"sourceport\"" ) ; MPSString destinationip_validator = new MPSString ( ) ; destinationip_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; destinationip_validator . validate ( operationType , destinationip , "\"destinationip\"" ) ; MPSString destinationport_validator = new MPSString ( ) ; destinationport_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; destinationport_validator . validate ( operationType , destinationport , "\"destinationport\"" ) ; MPSString starttime_validator = new MPSString ( ) ; starttime_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; starttime_validator . validate ( operationType , starttime , "\"starttime\"" ) ; MPSString endtime_validator = new MPSString ( ) ; endtime_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; endtime_validator . validate ( operationType , endtime , "\"endtime\"" ) ; MPSString duration_validator = new MPSString ( ) ; duration_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; duration_validator . validate ( operationType , duration , "\"duration\"" ) ; MPSString totalBytesSend_validator = new MPSString ( ) ; totalBytesSend_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; totalBytesSend_validator . validate ( operationType , totalBytesSend , "\"totalBytesSend\"" ) ; MPSString totalBytesRecv_validator = new MPSString ( ) ; totalBytesRecv_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; totalBytesRecv_validator . validate ( operationType , totalBytesRecv , "\"totalBytesRecv\"" ) ; MPSString totalCompressedBytesSend_validator = new MPSString ( ) ; totalCompressedBytesSend_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; totalCompressedBytesSend_validator . validate ( operationType , totalCompressedBytesSend , "\"totalCompressedBytesSend\"" ) ; MPSString totalCompressedBytesRecv_validator = new MPSString ( ) ; totalCompressedBytesRecv_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; totalCompressedBytesRecv_validator . validate ( operationType , totalCompressedBytesRecv , "\"totalCompressedBytesRecv\"" ) ; MPSString compressionRatioSend_validator = new MPSString ( ) ; compressionRatioSend_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; compressionRatioSend_validator . validate ( operationType , compressionRatioSend , "\"compressionRatioSend\"" ) ; MPSString compressionRatioRecv_validator = new MPSString ( ) ; compressionRatioRecv_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; compressionRatioRecv_validator . validate ( operationType , compressionRatioRecv , "\"compressionRatioRecv\"" ) ; MPSString domainname_validator = new MPSString ( ) ; domainname_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; domainname_validator . validate ( operationType , domainname , "\"domainname\"" ) ; MPSString applicationName_validator = new MPSString ( ) ; applicationName_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; applicationName_validator . validate ( operationType , applicationName , "\"applicationName\"" ) ; MPSString browserType_validator = new MPSString ( ) ; browserType_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; browserType_validator . validate ( operationType , browserType , "\"browserType\"" ) ; MPSString clientType_validator = new MPSString ( ) ; clientType_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; clientType_validator . validate ( operationType , clientType , "\"clientType\"" ) ; MPSString logoutMethod_validator = new MPSString ( ) ; logoutMethod_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; logoutMethod_validator . validate ( operationType , logoutMethod , "\"logoutMethod\"" ) ; MPSString vpnaccess_validator = new MPSString ( ) ; vpnaccess_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; vpnaccess_validator . validate ( operationType , vpnaccess , "\"vpnaccess\"" ) ; MPSString deniedURL_validator = new MPSString ( ) ; deniedURL_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; deniedURL_validator . validate ( operationType , deniedURL , "\"deniedURL\"" ) ; MPSString deniedByPolicy_validator = new MPSString ( ) ; deniedByPolicy_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; deniedByPolicy_validator . validate ( operationType , deniedByPolicy , "\"deniedByPolicy\"" ) ; MPSString remote_host_validator = new MPSString ( ) ; remote_host_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; remote_host_validator . validate ( operationType , remote_host , "\"remote_host\"" ) ; MPSString xdatalen_validator = new MPSString ( ) ; xdatalen_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; xdatalen_validator . validate ( operationType , xdatalen , "\"xdatalen\"" ) ; MPSString xdata_validator = new MPSString ( ) ; xdata_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; xdata_validator . validate ( operationType , xdata , "\"xdata\"" ) ; MPSString last_contact_validator = new MPSString ( ) ; last_contact_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; last_contact_validator . validate ( operationType , last_contact , "\"last_contact\"" ) ; MPSString httpResourceName_validator = new MPSString ( ) ; httpResourceName_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; httpResourceName_validator . validate ( operationType , httpResourceName , "\"httpResourceName\"" ) ; MPSString licenselmt_validator = new MPSString ( ) ; licenselmt_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; licenselmt_validator . validate ( operationType , licenselmt , "\"licenselmt\"" ) ; MPSString connectionId_validator = new MPSString ( ) ; connectionId_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; connectionId_validator . validate ( operationType , connectionId , "\"connectionId\"" ) ; MPSString clisecexp_validator = new MPSString ( ) ; clisecexp_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; clisecexp_validator . validate ( operationType , clisecexp , "\"clisecexp\"" ) ; MPSString eval_value_validator = new MPSString ( ) ; eval_value_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; eval_value_validator . validate ( operationType , eval_value , "\"eval_value\"" ) ; MPSString httpResourcesAccessed_validator = new MPSString ( ) ; httpResourcesAccessed_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; httpResourcesAccessed_validator . validate ( operationType , httpResourcesAccessed , "\"httpResourcesAccessed\"" ) ; MPSString nonhttpServicesAccessed_validator = new MPSString ( ) ; nonhttpServicesAccessed_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; nonhttpServicesAccessed_validator . validate ( operationType , nonhttpServicesAccessed , "\"nonhttpServicesAccessed\"" ) ; MPSString totalTCPconnections_validator = new MPSString ( ) ; totalTCPconnections_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; totalTCPconnections_validator . validate ( operationType , totalTCPconnections , "\"totalTCPconnections\"" ) ; MPSString totalUDPflows_validator = new MPSString ( ) ; totalUDPflows_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; totalUDPflows_validator . validate ( operationType , totalUDPflows , "\"totalUDPflows\"" ) ; MPSString totalPoliciesAllowed_validator = new MPSString ( ) ; totalPoliciesAllowed_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; totalPoliciesAllowed_validator . validate ( operationType , totalPoliciesAllowed , "\"totalPoliciesAllowed\"" ) ; MPSString totalPoliciesDenied_validator = new MPSString ( ) ; totalPoliciesDenied_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; totalPoliciesDenied_validator . validate ( operationType , totalPoliciesDenied , "\"totalPoliciesDenied\"" ) ; MPSString id_validator = new MPSString ( ) ; id_validator . setConstraintIsReq ( MPSConstants . DELETE_CONSTRAINT , true ) ; id_validator . setConstraintIsReq ( MPSConstants . MODIFY_CONSTRAINT , true ) ; id_validator . validate ( operationType , id , "\"id\"" ) ; |
public class PropertyUtil { /** * This method returns the named property , first checking the system properties
* and if not found , checking the environment .
* @ param name The name
* @ return The property , or null if not found */
public static String getProperty ( String name ) { } } | return System . getProperty ( name , System . getenv ( name ) ) ; |
public class TitlePaneMaximizeButtonPainter { /** * Paint the foreground maximized button enabled state .
* @ param g the Graphics2D context to paint with .
* @ param c the component .
* @ param width the width of the component .
* @ param height the height of the component . */
private void paintMaximizeEnabled ( Graphics2D g , JComponent c , int width , int height ) { } } | maximizePainter . paintEnabled ( g , c , width , height ) ; |
public class BaseHashMap { /** * generic method for adding or removing keys */
protected Object addOrRemove ( long longKey , long longValue , Object objectKey , Object objectValue , boolean remove ) { } } | int hash = ( int ) longKey ; if ( isObjectKey ) { if ( objectKey == null ) { return null ; } hash = objectKey . hashCode ( ) ; } int index = hashIndex . getHashIndex ( hash ) ; int lookup = hashIndex . hashTable [ index ] ; int lastLookup = - 1 ; Object returnValue = null ; for ( ; lookup >= 0 ; lastLookup = lookup , lookup = hashIndex . getNextLookup ( lookup ) ) { if ( isObjectKey ) { // A VoltDB extension to prevent an intermittent NPE on catalogUpdate ?
if ( objectKey . equals ( objectKeyTable [ lookup ] ) ) { /* disabled 1 line . . .
if ( objectKeyTable [ lookup ] . equals ( objectKey ) ) {
. . . disabled 1 line */
// End of VoltDB extension
break ; } } else if ( isIntKey ) { if ( longKey == intKeyTable [ lookup ] ) { break ; } } else if ( isLongKey ) { if ( longKey == longKeyTable [ lookup ] ) { break ; } } } if ( lookup >= 0 ) { if ( remove ) { if ( isObjectKey ) { objectKeyTable [ lookup ] = null ; } else { if ( longKey == 0 ) { hasZeroKey = false ; zeroKeyIndex = - 1 ; } if ( isIntKey ) { intKeyTable [ lookup ] = 0 ; } else { longKeyTable [ lookup ] = 0 ; } } if ( isObjectValue ) { returnValue = objectValueTable [ lookup ] ; objectValueTable [ lookup ] = null ; } else if ( isIntValue ) { intValueTable [ lookup ] = 0 ; } else if ( isLongValue ) { longValueTable [ lookup ] = 0 ; } hashIndex . unlinkNode ( index , lastLookup , lookup ) ; if ( accessTable != null ) { accessTable [ lookup ] = 0 ; } if ( minimizeOnEmpty && hashIndex . elementCount == 0 ) { rehash ( initialCapacity ) ; } return returnValue ; } if ( isObjectValue ) { returnValue = objectValueTable [ lookup ] ; objectValueTable [ lookup ] = objectValue ; } else if ( isIntValue ) { intValueTable [ lookup ] = ( int ) longValue ; } else if ( isLongValue ) { longValueTable [ lookup ] = longValue ; } if ( accessTable != null ) { accessTable [ lookup ] = accessCount ++ ; } return returnValue ; } // not found
if ( remove ) { return null ; } if ( hashIndex . elementCount >= threshold ) { // should throw maybe , if reset returns false ?
if ( reset ( ) ) { return addOrRemove ( longKey , longValue , objectKey , objectValue , remove ) ; } else { return null ; } } lookup = hashIndex . linkNode ( index , lastLookup ) ; // type dependent block
if ( isObjectKey ) { objectKeyTable [ lookup ] = objectKey ; } else if ( isIntKey ) { intKeyTable [ lookup ] = ( int ) longKey ; if ( longKey == 0 ) { hasZeroKey = true ; zeroKeyIndex = lookup ; } } else if ( isLongKey ) { longKeyTable [ lookup ] = longKey ; if ( longKey == 0 ) { hasZeroKey = true ; zeroKeyIndex = lookup ; } } if ( isObjectValue ) { objectValueTable [ lookup ] = objectValue ; } else if ( isIntValue ) { intValueTable [ lookup ] = ( int ) longValue ; } else if ( isLongValue ) { longValueTable [ lookup ] = longValue ; } if ( accessTable != null ) { accessTable [ lookup ] = accessCount ++ ; } return returnValue ; |
public class SubmitContainerStateChangeRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( SubmitContainerStateChangeRequest submitContainerStateChangeRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( submitContainerStateChangeRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( submitContainerStateChangeRequest . getCluster ( ) , CLUSTER_BINDING ) ; protocolMarshaller . marshall ( submitContainerStateChangeRequest . getTask ( ) , TASK_BINDING ) ; protocolMarshaller . marshall ( submitContainerStateChangeRequest . getContainerName ( ) , CONTAINERNAME_BINDING ) ; protocolMarshaller . marshall ( submitContainerStateChangeRequest . getStatus ( ) , STATUS_BINDING ) ; protocolMarshaller . marshall ( submitContainerStateChangeRequest . getExitCode ( ) , EXITCODE_BINDING ) ; protocolMarshaller . marshall ( submitContainerStateChangeRequest . getReason ( ) , REASON_BINDING ) ; protocolMarshaller . marshall ( submitContainerStateChangeRequest . getNetworkBindings ( ) , NETWORKBINDINGS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ClassUtils { /** * Expanded version of { @ link # isJavaLangType ( Class ) } that includes common Java types like { @ link URI } .
* @ param name The name of the type
* @ return True if is a Java basic type */
public static boolean isJavaBasicType ( @ Nullable String name ) { } } | if ( StringUtils . isEmpty ( name ) ) { return false ; } return isJavaLangType ( name ) || BASIC_TYPE_MAP . containsKey ( name ) ; |
public class UserCoreDao { /** * Query for rows
* @ param where
* where clause
* @ param whereArgs
* where arguments
* @ return result */
public TResult query ( String where , String [ ] whereArgs ) { } } | TResult result = userDb . query ( getTableName ( ) , table . getColumnNames ( ) , where , whereArgs , null , null , null ) ; prepareResult ( result ) ; return result ; |
public class ContainerBase { /** * ( non - Javadoc )
* @ see org . jboss . shrinkwrap . api . container . LibraryContainer # addLibraries ( java . lang . String [ ] ) */
@ Override public T addAsLibraries ( String ... resourceNames ) throws IllegalArgumentException { } } | Validate . notNull ( resourceNames , "ResourceNames must be specified" ) ; for ( String resourceName : resourceNames ) { addAsLibrary ( resourceName ) ; } return covarientReturn ( ) ; |
public class EnvironmentInformation { /** * Gets the version of the JVM in the form " VM _ Name - Vendor - Spec / Version " .
* @ return The JVM version . */
public static String getJvmVersion ( ) { } } | try { final RuntimeMXBean bean = ManagementFactory . getRuntimeMXBean ( ) ; return bean . getVmName ( ) + " - " + bean . getVmVendor ( ) + " - " + bean . getSpecVersion ( ) + '/' + bean . getVmVersion ( ) ; } catch ( Throwable t ) { return UNKNOWN ; } |
public class ModelsImpl { /** * Gets information about the application version models .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param listModelsOptionalParameter the object representing the optional parameters to be set before calling this API
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the List & lt ; ModelInfoResponse & gt ; object */
public Observable < ServiceResponse < List < ModelInfoResponse > > > listModelsWithServiceResponseAsync ( UUID appId , String versionId , ListModelsOptionalParameter listModelsOptionalParameter ) { } } | if ( this . client . endpoint ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.endpoint() is required and cannot be null." ) ; } if ( appId == null ) { throw new IllegalArgumentException ( "Parameter appId is required and cannot be null." ) ; } if ( versionId == null ) { throw new IllegalArgumentException ( "Parameter versionId is required and cannot be null." ) ; } final Integer skip = listModelsOptionalParameter != null ? listModelsOptionalParameter . skip ( ) : null ; final Integer take = listModelsOptionalParameter != null ? listModelsOptionalParameter . take ( ) : null ; return listModelsWithServiceResponseAsync ( appId , versionId , skip , take ) ; |
public class Crossing { /** * Returns how many times rectangle stripe cross shape or the are intersect */
public static int intersectShape ( IShape s , float x , float y , float w , float h ) { } } | if ( ! s . bounds ( ) . intersects ( x , y , w , h ) ) { return 0 ; } return intersectPath ( s . pathIterator ( null ) , x , y , w , h ) ; |
public class SimpleSessionManager { /** * Initialize this component . < br >
* This is basically called by DI setting file . */
@ PostConstruct public synchronized void initialize ( ) { } } | final FwWebDirection direction = assistWebDirection ( ) ; final SessionResourceProvider provider = direction . assistSessionResourceProvider ( ) ; sessionSharedStorage = prepareSessionSharedStorage ( provider ) ; httpSessionArranger = prepareHttpSessionArranger ( provider ) ; showBootLogging ( ) ; |
public class JsonWriter { /** * Write a string field to the JSON file .
* @ param fieldName field name
* @ param value field value */
private void writeStringField ( String fieldName , Object value ) throws IOException { } } | String val = value . toString ( ) ; if ( ! val . isEmpty ( ) ) { m_writer . writeNameValuePair ( fieldName , val ) ; } |
public class PortInfoMarshaller { /** * Marshall the given parameter object . */
public void marshall ( PortInfo portInfo , ProtocolMarshaller protocolMarshaller ) { } } | if ( portInfo == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( portInfo . getFromPort ( ) , FROMPORT_BINDING ) ; protocolMarshaller . marshall ( portInfo . getToPort ( ) , TOPORT_BINDING ) ; protocolMarshaller . marshall ( portInfo . getProtocol ( ) , PROTOCOL_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MultiVertexGeometryImpl { /** * Checked vs . Jan 11 , 2011 */
@ Override public void setXY ( int index , Point2D pt ) { } } | if ( index < 0 || index >= m_pointCount ) // TODO exception
throw new IndexOutOfBoundsException ( ) ; _verifyAllStreams ( ) ; // AttributeStreamOfDbl v = ( AttributeStreamOfDbl )
// m _ vertexAttributes [ 0 ] ;
AttributeStreamOfDbl v = ( AttributeStreamOfDbl ) m_vertexAttributes [ 0 ] ; v . write ( index * 2 , pt ) ; notifyModified ( DirtyFlags . DirtyCoordinates ) ; |
public class Graphs { /** * Returns the subgraph of { @ code graph } induced by { @ code nodes } . This subgraph is a new graph
* that contains all of the nodes in { @ code nodes } , and all of the { @ link Graph # edges ( ) edges }
* ( and associated edge values ) from { @ code graph } for which both nodes are contained by { @ code
* nodes } .
* @ throws IllegalArgumentException if any element in { @ code nodes } is not a node in the graph */
public static < N , V > MutableValueGraph < N , V > inducedSubgraph ( ValueGraph < N , V > graph , Iterable < ? extends N > nodes ) { } } | MutableValueGraph < N , V > subgraph = ValueGraphBuilder . from ( graph ) . build ( ) ; for ( N node : nodes ) { subgraph . addNode ( node ) ; } for ( N node : subgraph . nodes ( ) ) { for ( N successorNode : graph . successors ( node ) ) { if ( subgraph . nodes ( ) . contains ( successorNode ) ) { subgraph . putEdgeValue ( node , successorNode , graph . edgeValue ( node , successorNode ) ) ; } } } return subgraph ; |
public class Metrics { /** * Measures the distribution of samples .
* @ param name The base metric name
* @ param tags Sequence of dimensions for breaking down the name .
* @ return A new or existing distribution summary . */
public static DistributionSummary summary ( String name , Iterable < Tag > tags ) { } } | return globalRegistry . summary ( name , tags ) ; |
public class CfgParseChart { /** * Get the inside unnormalized probabilities over productions at a particular
* span in the tree . */
public Factor getInsideEntries ( int spanStart , int spanEnd ) { } } | Tensor entries = new DenseTensor ( parentVar . getVariableNumsArray ( ) , parentVar . getVariableSizes ( ) , insideChart [ spanStart ] [ spanEnd ] ) ; return new TableFactor ( parentVar , entries ) ; |
public class ConfigurationImpl { /** * Retrieves the values as a array of String , the format is : key = [ myval1 , myval2 ] .
* @ return an array containing the values of that key or empty if not found . */
@ Override public String [ ] getStringArray ( final String key ) { } } | List < String > list = getList ( key ) ; return list . toArray ( new String [ list . size ( ) ] ) ; |
public class CypherProcedures { /** * store in graph properties , load at startup
* allow to register proper params as procedure - params
* allow to register proper return columns
* allow to register mode */
@ Procedure ( value = "apoc.custom.asProcedure" , mode = Mode . WRITE ) @ Description ( "apoc.custom.asProcedure(name, statement, mode, outputs, inputs, description) - register a custom cypher procedure" ) public void asProcedure ( @ Name ( "name" ) String name , @ Name ( "statement" ) String statement , @ Name ( value = "mode" , defaultValue = "read" ) String mode , @ Name ( value = "outputs" , defaultValue = "null" ) List < List < String > > outputs , @ Name ( value = "inputs" , defaultValue = "null" ) List < List < String > > inputs , @ Name ( value = "description" , defaultValue = "null" ) String description ) throws ProcedureException { } } | debug ( name , "before" , ktx ) ; CustomStatementRegistry registry = new CustomStatementRegistry ( api , log ) ; if ( ! registry . registerProcedure ( name , statement , mode , outputs , inputs , description ) ) { throw new IllegalStateException ( "Error registering procedure " + name + ", see log." ) ; } CustomProcedureStorage . storeProcedure ( api , name , statement , mode , outputs , inputs , description ) ; debug ( name , "after" , ktx ) ; |
public class DOMUtils { /** * Serialise the provided source to the provided destination , pretty - printing with the default indent settings
* @ param input the source
* @ param output the destination */
public static void pretty ( final Source input , final StreamResult output ) { } } | try { // Configure transformer
Transformer transformer = TransformerFactory . newInstance ( ) . newTransformer ( ) ; transformer . setOutputProperty ( OutputKeys . ENCODING , "utf-8" ) ; transformer . setOutputProperty ( OutputKeys . OMIT_XML_DECLARATION , "no" ) ; transformer . setOutputProperty ( OutputKeys . INDENT , "yes" ) ; transformer . setOutputProperty ( "{http://xml.apache.org/xslt}indent-amount" , Integer . toString ( DEFAULT_INDENT ) ) ; transformer . transform ( input , output ) ; } catch ( Throwable t ) { throw new RuntimeException ( "Error during pretty-print operation" , t ) ; } |
public class HalResource { /** * Get link .
* @ param rel Relation name
* @ return Link */
public Optional < Link > getLinkByRel ( final String rel ) { } } | return Optional . ofNullable ( representation . getLinkByRel ( rel ) ) ; |
public class AuthGUI { /** * Derive API Error Class from AAF Response ( future ) */
public Error getError ( AuthzTrans trans , Future < ? > fp ) { } } | // try {
String text = fp . body ( ) ; Error err = new Error ( ) ; err . setMessageId ( Integer . toString ( fp . code ( ) ) ) ; if ( text == null || text . length ( ) == 0 ) { err . setText ( "**No Message**" ) ; } else { err . setText ( fp . body ( ) ) ; } return err ; // } catch ( APIException e ) {
// Error err = new Error ( ) ;
// err . setMessageId ( Integer . toString ( fp . code ( ) ) ) ;
// err . setText ( " Could not obtain response from AAF Message : " + e . getMessage ( ) ) ;
// return err ; |
public class DialogResponse { /** * Returns list of response objects created from a string of vertical bar delimited captions .
* @ param < T > The type of response object .
* @ param responses Response list .
* @ param exclusions Exclusion list ( may be null ) .
* @ param dflt Default response ( may be null ) .
* @ return List of response objects corresponding to response list . */
public static < T > List < DialogResponse < T > > toResponseList ( T [ ] responses , T [ ] exclusions , T dflt ) { } } | List < DialogResponse < T > > list = new ArrayList < > ( ) ; boolean forceDefault = dflt == null && responses . length == 1 ; for ( T response : responses ) { DialogResponse < T > rsp = new DialogResponse < > ( response , response . toString ( ) , exclusions != null && ArrayUtils . contains ( exclusions , response ) , forceDefault || response . equals ( dflt ) ) ; list . add ( rsp ) ; } return list ; |
public class UnifiedPromoteBuildAction { /** * Load the related repositories , plugins and a promotion config associated to the buildId .
* Called from the UI .
* @ param buildId - The unique build id .
* @ return LoadBuildsResponse e . g . list of repositories , plugins and a promotion config . */
@ JavaScriptMethod @ SuppressWarnings ( { } } | "UnusedDeclaration" } ) public LoadBuildsResponse loadBuild ( String buildId ) { LoadBuildsResponse response = new LoadBuildsResponse ( ) ; // When we load a new build we need also to reset the promotion plugin .
// The null plugin is related to ' None ' plugin .
setPromotionPlugin ( null ) ; try { this . currentPromotionCandidate = promotionCandidates . get ( buildId ) ; if ( this . currentPromotionCandidate == null ) { throw new IllegalArgumentException ( "Can't find build by ID: " + buildId ) ; } List < String > repositoryKeys = getRepositoryKeys ( ) ; List < UserPluginInfo > plugins = getPromotionsUserPluginInfo ( ) ; PromotionConfig promotionConfig = getPromotionConfig ( ) ; String defaultTargetRepository = getDefaultPromotionTargetRepository ( ) ; if ( StringUtils . isNotBlank ( defaultTargetRepository ) && repositoryKeys . contains ( defaultTargetRepository ) ) { promotionConfig . setTargetRepo ( defaultTargetRepository ) ; } response . addRepositories ( repositoryKeys ) ; response . setPlugins ( plugins ) ; response . setPromotionConfig ( promotionConfig ) ; response . setSuccess ( true ) ; } catch ( Exception e ) { response . setResponseMessage ( e . getMessage ( ) ) ; } return response ; |
public class AccessibilityNodeInfoUtils { /** * Determines if the generating class of an
* { @ link AccessibilityNodeInfoCompat } matches any of the given
* { @ link Class } es by type .
* @ param node A sealed { @ link AccessibilityNodeInfoCompat } dispatched by
* the accessibility framework .
* @ return { @ code true } if the { @ link AccessibilityNodeInfoCompat } object
* matches the { @ link Class } by type or inherited type ,
* { @ code false } otherwise .
* @ param referenceClasses A variable - length list of { @ link Class } objects
* to match by type or inherited type . */
public static boolean nodeMatchesAnyClassByType ( Context context , AccessibilityNodeInfoCompat node , Class < ? > ... referenceClasses ) { } } | for ( Class < ? > referenceClass : referenceClasses ) { if ( nodeMatchesClassByType ( context , node , referenceClass ) ) { return true ; } } return false ; |
public class ICUHumanize { /** * Smartly formats the given number as a monetary amount .
* For en _ GB :
* < table border = " 0 " cellspacing = " 0 " cellpadding = " 3 " width = " 100 % " >
* < tr >
* < th class = " colFirst " > Input < / th >
* < th class = " colLast " > Output < / th >
* < / tr >
* < tr >
* < td > 34 < / td >
* < td > " £ 34 " < / td >
* < / tr >
* < tr >
* < td > 1000 < / td >
* < td > " £ 1,000 " < / td >
* < / tr >
* < tr >
* < td > 12.5 < / td >
* < td > " £ 12.50 " < / td >
* < / tr >
* < / table >
* @ param value
* Number to be formatted
* @ return String representing the monetary amount */
public static String formatCurrency ( final Number value ) { } } | DecimalFormat decf = context . get ( ) . getCurrencyFormat ( ) ; return stripZeros ( decf , decf . format ( value ) ) ; |
public class Messages { /** * Gets the requested localized message .
* The current Request and Response are used to help determine the messages
* resource to use .
* < ol >
* < li > Exact locale match , return the registered locale message
* < li > Language match , but not a locale match , return the registered
* language message
* < li > Return the default resource message
* < / ol >
* The message can be formatted with optional arguments using the
* { @ link java . text . MessageFormat } syntax .
* If the key does not exist in the messages resource , then the key name is
* returned .
* @ param key
* @ param routeContext
* @ param args
* @ return the message or the key if the key does not exist */
public String get ( String key , RouteContext routeContext , Object ... args ) { } } | String language = languages . getLanguageOrDefault ( routeContext ) ; return get ( key , language , args ) ; |
public class DbSqlSession { /** * select / / / / / */
public List < ? > selectList ( String statement , Object parameter ) { } } | statement = dbSqlSessionFactory . mapStatement ( statement ) ; List < Object > resultList = sqlSession . selectList ( statement , parameter ) ; for ( Object object : resultList ) { fireEntityLoaded ( object ) ; } return resultList ; |
public class HijriAdjustment { /** * also called by Hijri calendar systems */
static HijriAdjustment from ( String variant ) { } } | int index = variant . indexOf ( ':' ) ; if ( index == - 1 ) { return new HijriAdjustment ( variant , 0 ) ; } else { try { int adjustment = Integer . parseInt ( variant . substring ( index + 1 ) ) ; return new HijriAdjustment ( variant . substring ( 0 , index ) , adjustment ) ; } catch ( NumberFormatException nfe ) { throw new ChronoException ( "Invalid day adjustment: " + variant ) ; } } |
public class GoogleMapShapeConverter { /** * Convert a list of { @ link PolygonOptions } to a { @ link MultiPolygon }
* @ param multiPolygonOptions multi polygon options
* @ param hasZ has z flag
* @ param hasM has m flag
* @ return multi polygon */
public MultiPolygon toMultiPolygonFromOptions ( MultiPolygonOptions multiPolygonOptions , boolean hasZ , boolean hasM ) { } } | MultiPolygon multiPolygon = new MultiPolygon ( hasZ , hasM ) ; for ( PolygonOptions mapPolygon : multiPolygonOptions . getPolygonOptions ( ) ) { Polygon polygon = toPolygon ( mapPolygon ) ; multiPolygon . addPolygon ( polygon ) ; } return multiPolygon ; |
public class ParetoFront { /** * Return a pareto - front collector . The natural order of the elements is
* used as pareto - dominance order .
* @ param < C > the element type
* @ return a new pareto - front collector */
public static < C extends Comparable < ? super C > > Collector < C , ? , ParetoFront < C > > toParetoFront ( ) { } } | return toParetoFront ( Comparator . naturalOrder ( ) ) ; |
public class Team { /** * Create an oTask / Activity record within a team
* @ param company Company ID
* @ paramteam Team ID
* @ param params Parameters
* @ throwsJSONException If error occurred
* @ return { @ link JSONObject } */
public JSONObject addActivity ( String company , String team , HashMap < String , String > params ) throws JSONException { } } | return oClient . post ( "/otask/v1/tasks/companies/" + company + "/teams/" + team + "/tasks" , params ) ; |
public class DescribeInstanceInformationRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeInstanceInformationRequest describeInstanceInformationRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeInstanceInformationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeInstanceInformationRequest . getInstanceInformationFilterList ( ) , INSTANCEINFORMATIONFILTERLIST_BINDING ) ; protocolMarshaller . marshall ( describeInstanceInformationRequest . getFilters ( ) , FILTERS_BINDING ) ; protocolMarshaller . marshall ( describeInstanceInformationRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; protocolMarshaller . marshall ( describeInstanceInformationRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Blade { /** * Add a post route to routes
* @ param path your route path
* @ param handler route implement
* @ return return blade instance
* @ see # post ( String , RouteHandler ) */
@ Deprecated public Blade post ( @ NonNull String path , @ NonNull RouteHandler0 handler ) { } } | this . routeMatcher . addRoute ( path , handler , HttpMethod . POST ) ; return this ; |
public class QuickLauncher { /** * Stops a node ( which is running in a different VM ) by setting its status to
* { @ link Status # SHUTDOWN _ PENDING } . Waits for the node to actually shut down
* and returns the exit status ( 0 is for success else failure ) . */
private int stop ( final String [ ] args ) throws IOException { } } | setWorkingDir ( args ) ; final Path statusFile = getStatusPath ( ) ; int exitStatus = 1 ; // determine the current state of the node
readStatus ( false , statusFile ) ; if ( this . status != null ) { // upon reading the status file , request the Cache Server to shutdown
// if it has not already . . .
if ( this . status . state != Status . SHUTDOWN ) { // copy server PID and not use own PID ; see bug # 39707
this . status = Status . create ( this . baseName , Status . SHUTDOWN_PENDING , this . status . pid , statusFile ) ; this . status . write ( ) ; } // poll the Cache Server for a response to our shutdown request
// ( passes through if the Cache Server has already shutdown )
pollCacheServerForShutdown ( statusFile ) ; // after polling , determine the status of the Cache Server one last time
// and determine how to exit . . .
if ( this . status . state == Status . SHUTDOWN ) { System . out . println ( MessageFormat . format ( LAUNCHER_STOPPED , this . baseName , getHostNameAndDir ( ) ) ) ; Status . delete ( statusFile ) ; exitStatus = 0 ; } else { System . out . println ( MessageFormat . format ( LAUNCHER_TIMEOUT_WAITING_FOR_SHUTDOWN , this . baseName , this . hostName , this . status ) ) ; } } else if ( Files . exists ( statusFile ) ) { throw new IllegalStateException ( MessageFormat . format ( LAUNCHER_NO_AVAILABLE_STATUS , this . statusName ) ) ; } else { System . out . println ( MessageFormat . format ( LAUNCHER_NO_STATUS_FILE , this . workingDir , this . hostName ) ) ; } return exitStatus ; |
public class ClusteredRedisDLockFactory { /** * { @ inheritDoc } */
@ Override protected ClusteredRedisDLock createLockInternal ( String name , Properties lockProps ) { } } | ClusteredRedisDLock lock = new ClusteredRedisDLock ( name ) ; lock . setLockProperties ( lockProps ) ; lock . setRedisHostsAndPorts ( getRedisHostsAndPorts ( ) ) . setRedisPassword ( getRedisPassword ( ) ) ; lock . setJedisConnector ( getJedisConnector ( ) ) ; return lock ; |
public class Link { /** * Create a new styled link to a given url
* @ param text the text content
* @ param ts the style
* @ param url the file
* @ return the link */
public static Link create ( final String text , final TextStyle ts , final URL url ) { } } | return new Link ( text , ts , url . toString ( ) ) ; |
public class GrailsHibernateTemplate { /** * Apply the flush mode that ' s been specified for this accessor to the given Session .
* @ param session the current Hibernate Session
* @ param existingTransaction if executing within an existing transaction
* @ return the previous flush mode to restore after the operation , or < code > null < / code > if none
* @ see # setFlushMode
* @ see org . hibernate . Session # setFlushMode */
protected FlushMode applyFlushMode ( Session session , boolean existingTransaction ) { } } | if ( isApplyFlushModeOnlyToNonExistingTransactions ( ) && existingTransaction ) { return null ; } if ( getFlushMode ( ) == FLUSH_NEVER ) { if ( existingTransaction ) { FlushMode previousFlushMode = session . getHibernateFlushMode ( ) ; if ( ! previousFlushMode . lessThan ( FlushMode . COMMIT ) ) { session . setHibernateFlushMode ( FlushMode . MANUAL ) ; return previousFlushMode ; } } else { session . setHibernateFlushMode ( FlushMode . MANUAL ) ; } } else if ( getFlushMode ( ) == FLUSH_EAGER ) { if ( existingTransaction ) { FlushMode previousFlushMode = session . getHibernateFlushMode ( ) ; if ( ! previousFlushMode . equals ( FlushMode . AUTO ) ) { session . setHibernateFlushMode ( FlushMode . AUTO ) ; return previousFlushMode ; } } else { // rely on default FlushMode . AUTO
} } else if ( getFlushMode ( ) == FLUSH_COMMIT ) { if ( existingTransaction ) { FlushMode previousFlushMode = session . getHibernateFlushMode ( ) ; if ( previousFlushMode . equals ( FlushMode . AUTO ) || previousFlushMode . equals ( FlushMode . ALWAYS ) ) { session . setHibernateFlushMode ( FlushMode . COMMIT ) ; return previousFlushMode ; } } else { session . setHibernateFlushMode ( FlushMode . COMMIT ) ; } } else if ( getFlushMode ( ) == FLUSH_ALWAYS ) { if ( existingTransaction ) { FlushMode previousFlushMode = session . getHibernateFlushMode ( ) ; if ( ! previousFlushMode . equals ( FlushMode . ALWAYS ) ) { session . setHibernateFlushMode ( FlushMode . ALWAYS ) ; return previousFlushMode ; } } else { session . setHibernateFlushMode ( FlushMode . ALWAYS ) ; } } return null ; |
public class ChatLogic { /** * Adjust the chat type based on the mode of the chat message . */
public int adjustTypeByMode ( int mode , int type ) { } } | switch ( mode ) { case ChatCodes . DEFAULT_MODE : return type | SPEAK ; case ChatCodes . EMOTE_MODE : return type | EMOTE ; case ChatCodes . THINK_MODE : return type | THINK ; case ChatCodes . SHOUT_MODE : return type | SHOUT ; case ChatCodes . BROADCAST_MODE : return BROADCAST ; // broadcast always looks like broadcast
default : return type ; } |
public class GuildManager { /** * Resets the fields specified by the provided bit - flag pattern .
* You can specify a combination by using a bitwise OR concat of the flag constants .
* < br > Example : { @ code manager . reset ( GuildManager . NAME | GuildManager . ICON ) ; }
* < p > < b > Flag Constants : < / b >
* < ul >
* < li > { @ link # NAME } < / li >
* < li > { @ link # ICON } < / li >
* < li > { @ link # REGION } < / li >
* < li > { @ link # SPLASH } < / li >
* < li > { @ link # AFK _ CHANNEL } < / li >
* < li > { @ link # AFK _ TIMEOUT } < / li >
* < li > { @ link # SYSTEM _ CHANNEL } < / li >
* < li > { @ link # MFA _ LEVEL } < / li >
* < li > { @ link # NOTIFICATION _ LEVEL } < / li >
* < li > { @ link # EXPLICIT _ CONTENT _ LEVEL } < / li >
* < li > { @ link # VERIFICATION _ LEVEL } < / li >
* < / ul >
* @ param fields
* Integer value containing the flags to reset .
* @ return GuildManager for chaining convenience */
@ Override @ CheckReturnValue public GuildManager reset ( long fields ) { } } | super . reset ( fields ) ; if ( ( fields & NAME ) == NAME ) this . name = null ; if ( ( fields & REGION ) == REGION ) this . region = null ; if ( ( fields & ICON ) == ICON ) this . icon = null ; if ( ( fields & SPLASH ) == SPLASH ) this . splash = null ; if ( ( fields & AFK_CHANNEL ) == AFK_CHANNEL ) this . afkChannel = null ; if ( ( fields & SYSTEM_CHANNEL ) == SYSTEM_CHANNEL ) this . systemChannel = null ; return this ; |
public class CollectionUtils { /** * Writes the string value of the specified items to appendable ,
* wrapping an eventual IOException into a RuntimeException
* @ param appendable to append values to
* @ param items items to dump */
public static void dump ( Appendable appendable , Iterable < ? > items ) { } } | try { for ( Object item : items ) { appendable . append ( String . valueOf ( item ) ) ; appendable . append ( "\n" ) ; } } catch ( IOException e ) { throw new RuntimeException ( "An error occured while appending" , e ) ; } |
public class BotmReflectionUtil { /** * Get the accessible method that means as follows :
* < pre >
* o target class ' s methods = all
* o superclass ' s methods = public or protected
* < / pre >
* @ param clazz The type of class that defines the method . ( NotNull )
* @ param methodName The name of method . ( NotNull )
* @ param argTypes The type of argument . ( NotNull )
* @ return The instance of method . ( NullAllowed : if null , not found ) */
public static Method getAccessibleMethod ( Class < ? > clazz , String methodName , Class < ? > [ ] argTypes ) { } } | assertObjectNotNull ( "clazz" , clazz ) ; assertStringNotNullAndNotTrimmedEmpty ( "methodName" , methodName ) ; return findMethod ( clazz , methodName , argTypes , VisibilityType . ACCESSIBLE , false ) ; |
public class LabAccountsInner { /** * Create a lab in a lab account .
* @ param resourceGroupName The name of the resource group .
* @ param labAccountName The name of the lab Account .
* @ param createLabProperties Properties for creating a managed lab and a default environment setting
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceResponse } object if successful . */
public Observable < ServiceResponse < Void > > createLabWithServiceResponseAsync ( String resourceGroupName , String labAccountName , CreateLabProperties createLabProperties ) { } } | if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( labAccountName == null ) { throw new IllegalArgumentException ( "Parameter labAccountName is required and cannot be null." ) ; } if ( createLabProperties == null ) { throw new IllegalArgumentException ( "Parameter createLabProperties is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } Validator . validate ( createLabProperties ) ; return service . createLab ( this . client . subscriptionId ( ) , resourceGroupName , labAccountName , createLabProperties , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Void > > > ( ) { @ Override public Observable < ServiceResponse < Void > > call ( Response < ResponseBody > response ) { try { ServiceResponse < Void > clientResponse = createLabDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class Blob { /** * { @ inheritDoc }
* @ see # setBytes ( long , bytes [ ] , offset , int ) */
public int setBytes ( final long pos , byte [ ] bytes ) throws SQLException { } } | if ( bytes == null ) { throw new IllegalArgumentException ( "No byte to be set" ) ; } // end of if
return setBytes ( pos , bytes , 0 , bytes . length ) ; |
public class OverlyConcreteParameter { /** * implements the visitor to look to see if this method is constrained by a
* superclass or interface .
* @ param obj the currently parsed method */
@ Override public void visitMethod ( Method obj ) { } } | methodSignatureIsConstrained = false ; String methodName = obj . getName ( ) ; if ( ! Values . CONSTRUCTOR . equals ( methodName ) && ! Values . STATIC_INITIALIZER . equals ( methodName ) ) { String methodSig = obj . getSignature ( ) ; methodSignatureIsConstrained = methodIsSpecial ( methodName , methodSig ) || methodHasSyntheticTwin ( methodName , methodSig ) ; if ( ! methodSignatureIsConstrained ) { for ( AnnotationEntry entry : obj . getAnnotationEntries ( ) ) { if ( CONVERSION_ANNOTATIONS . contains ( entry . getAnnotationType ( ) ) ) { methodSignatureIsConstrained = true ; break ; } } } if ( ! methodSignatureIsConstrained ) { String parms = methodSig . split ( "\\(|\\)" ) [ 1 ] ; if ( parms . indexOf ( Values . SIG_QUALIFIED_CLASS_SUFFIX_CHAR ) >= 0 ) { outer : for ( JavaClass constrainCls : constrainingClasses ) { Method [ ] methods = constrainCls . getMethods ( ) ; for ( Method m : methods ) { if ( methodName . equals ( m . getName ( ) ) && methodSig . equals ( m . getSignature ( ) ) ) { methodSignatureIsConstrained = true ; break outer ; } } } } } } |
public class KeyVaultClientBaseImpl { /** * Deletes the specified certificate issuer .
* The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from the vault . This operation requires the certificates / manageissuers / deleteissuers permission .
* @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net .
* @ param issuerName The name of the issuer .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the IssuerBundle object */
public Observable < IssuerBundle > deleteCertificateIssuerAsync ( String vaultBaseUrl , String issuerName ) { } } | return deleteCertificateIssuerWithServiceResponseAsync ( vaultBaseUrl , issuerName ) . map ( new Func1 < ServiceResponse < IssuerBundle > , IssuerBundle > ( ) { @ Override public IssuerBundle call ( ServiceResponse < IssuerBundle > response ) { return response . body ( ) ; } } ) ; |
public class NomadScheduler { /** * Get the command that will be used to retrieve the topology JAR */
static String getFetchCommand ( Config localConfig , Config clusterConfig , Config runtime ) { } } | return String . format ( "%s -u %s -f . -m local -p %s -d %s" , Context . downloaderBinary ( clusterConfig ) , Runtime . topologyPackageUri ( runtime ) . toString ( ) , Context . heronConf ( localConfig ) , Context . heronHome ( clusterConfig ) ) ; |
public class MaterialDatePicker { /** * Set the maximum date limit . */
public void setDateMax ( Date dateMax ) { } } | this . dateMax = dateMax ; if ( isAttached ( ) && dateMax != null ) { getPicker ( ) . set ( "max" , JsDate . create ( ( double ) dateMax . getTime ( ) ) ) ; } |
public class Dispatcher { /** * Gets the original page path corresponding to the original request before any forward / include .
* Assumes all forward / include done with ao taglib .
* If no original page available , uses the servlet path from the provided request .
* @ see # getOriginalPage ( javax . servlet . ServletRequest ) */
public static String getOriginalPagePath ( HttpServletRequest request ) { } } | String original = getOriginalPage ( request ) ; return ( original != null ) ? original : request . getServletPath ( ) ; |
public class N { /** * Returns a set backed by the specified map .
* @ param map the backing map
* @ return the set backed by the map
* @ see Collections # newSetFromMap ( Map ) */
public static < E > Set < E > newSetFromMap ( final Map < E , Boolean > map ) { } } | return Collections . newSetFromMap ( map ) ; |
public class Agent { /** * Entry point for the agent . */
public static void premain ( String arg , Instrumentation instrumentation ) throws Exception { } } | // Setup logging
Config config = loadConfig ( arg ) ; LOGGER . debug ( "loaded configuration: {}" , config . root ( ) . render ( ) ) ; createDependencyProperties ( config ) ; // Setup Registry
AtlasRegistry registry = new AtlasRegistry ( Clock . SYSTEM , new AgentAtlasConfig ( config ) ) ; // Add to global registry for http stats and GC logger
Spectator . globalRegistry ( ) . add ( registry ) ; // Enable GC logger
GcLogger gcLogger = new GcLogger ( ) ; if ( config . getBoolean ( "collection.gc" ) ) { gcLogger . start ( null ) ; } // Enable JVM data collection
if ( config . getBoolean ( "collection.jvm" ) ) { Jmx . registerStandardMXBeans ( registry ) ; } // Enable JMX query collection
if ( config . getBoolean ( "collection.jmx" ) ) { for ( Config cfg : config . getConfigList ( "jmx.mappings" ) ) { Jmx . registerMappingsFromConfig ( registry , cfg ) ; } } // Start collection for the registry
registry . start ( ) ; // Shutdown registry
Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( registry :: stop , "spectator-agent-shutdown" ) ) ; |
public class CPDefinitionUtil { /** * Returns the last cp definition in the ordered set where uuid = & # 63 ; .
* @ param uuid the uuid
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching cp definition , or < code > null < / code > if a matching cp definition could not be found */
public static CPDefinition fetchByUuid_Last ( String uuid , OrderByComparator < CPDefinition > orderByComparator ) { } } | return getPersistence ( ) . fetchByUuid_Last ( uuid , orderByComparator ) ; |
public class TrConfigurator { /** * Package protected : retrieve the delegate ( possibly creating first . . ) .
* < ul >
* < li > If Tr has not yet been configured , the disabled delegate will be
* returned
* < li > If a delegate has been set , that instance will be returned .
* < li > Otherwise , the default delegate will be created , if necessary , and
* returned
* < / ul >
* @ return active delegate */
static TrService getDelegate ( ) { } } | TrService result = delegate . get ( ) ; if ( result != null ) { return result ; } LogProviderConfig config = loggingConfig . get ( ) . get ( ) ; if ( config != null ) { final TrService tr = config . getTrDelegate ( ) ; if ( tr != null ) { Callable < TrService > initializer = new Callable < TrService > ( ) { @ Override public TrService call ( ) throws Exception { return tr ; } } ; delegate = StaticValue . mutateStaticValue ( delegate , initializer ) ; delegate . get ( ) . init ( config ) ; return delegate . get ( ) ; } } return DisabledDelegateSingleton . instance ; |
public class ExecutablePredicates { /** * Checks if a candidate executable is equivalent to the specified reference executable .
* @ param reference the executable to check equivalency against .
* @ return the predicate . */
public static < T extends Executable > Predicate < T > executableIsEquivalentTo ( T reference ) { } } | Predicate < T > predicate = candidate -> candidate != null && candidate . getName ( ) . equals ( reference . getName ( ) ) && executableHasSameParameterTypesAs ( reference ) . test ( candidate ) ; if ( reference instanceof Method ) { predicate . and ( candidate -> candidate instanceof Method && ( ( Method ) candidate ) . getReturnType ( ) . equals ( ( ( Method ) reference ) . getReturnType ( ) ) ) ; } return predicate ; |
public class DataSiftAccount { /** * Fetch a token using it ' s service ID and it ' s Identity ' s ID
* @ param identity the ID of the identity to query
* @ param service the service of the token to fetch
* @ return The identity for the ID provided */
public FutureData < Token > getToken ( String identity , String service ) { } } | FutureData < Token > future = new FutureData < > ( ) ; URI uri = newParams ( ) . put ( "id" , identity ) . forURL ( config . newAPIEndpointURI ( IDENTITY + "/" + identity + "/token/" + service ) ) ; Request request = config . http ( ) . GET ( uri , new PageReader ( newRequestCallback ( future , new Token ( ) , config ) ) ) ; performRequest ( future , request ) ; return future ; |
public class TrieBuilder { /** * Finds the same index block as the otherBlock
* @ param index array
* @ param indexLength size of index
* @ param otherBlock
* @ return same index block */
protected static final int findSameIndexBlock ( int index [ ] , int indexLength , int otherBlock ) { } } | for ( int block = BMP_INDEX_LENGTH_ ; block < indexLength ; block += SURROGATE_BLOCK_COUNT_ ) { if ( equal_int ( index , block , otherBlock , SURROGATE_BLOCK_COUNT_ ) ) { return block ; } } return indexLength ; |
public class BitmapUtil { /** * Returns the width and height of a specific image resource .
* @ param context
* The context , which should be used , as an instance of the class { @ link Context } . The
* context may not be null
* @ param resourceId
* The resource id of the image resource , whose width and height should be returned , as
* an { @ link Integer } value . The resource id must correspond to a valid drawable
* resource
* @ return A pair , which contains the width and height of the given image resource , as an
* instance of the class Pair
* @ throws IOException
* The exception , which is thrown , if an error occurs while decoding the image resource */
public static Pair < Integer , Integer > getImageDimensions ( @ NonNull final Context context , @ DrawableRes final int resourceId ) throws IOException { } } | Condition . INSTANCE . ensureNotNull ( context , "The context may not be null" ) ; BitmapFactory . Options options = new BitmapFactory . Options ( ) ; options . inJustDecodeBounds = true ; BitmapFactory . decodeResource ( context . getResources ( ) , resourceId , options ) ; int width = options . outWidth ; int height = options . outHeight ; if ( width == - 1 || height == - 1 ) { throw new IOException ( "Failed to decode image resource with id " + resourceId ) ; } return Pair . create ( width , height ) ; |
public class AbstractVirtualHostBuilder { /** * Configures SSL or TLS of this { @ link VirtualHost } with the specified { @ link SslContext } . */
public B tls ( SslContext sslContext ) { } } | this . sslContext = VirtualHost . validateSslContext ( requireNonNull ( sslContext , "sslContext" ) ) ; return self ( ) ; |
public class SectionHeader { /** * Returns a list of all characteristics of that section .
* @ return list of all characteristics */
public List < SectionCharacteristic > getCharacteristics ( ) { } } | long value = get ( SectionHeaderKey . CHARACTERISTICS ) ; List < SectionCharacteristic > list = SectionCharacteristic . getAllFor ( value ) ; assert list != null ; return list ; |
public class DatastoreUtils { /** * Increments the version property of the given entity by one .
* @ param nativeEntity
* the target entity
* @ param versionMetadata
* the metadata of the version property
* @ return a new entity ( copy of the given ) , but with the incremented version . */
static Entity incrementVersion ( Entity nativeEntity , PropertyMetadata versionMetadata ) { } } | String versionPropertyName = versionMetadata . getMappedName ( ) ; long version = nativeEntity . getLong ( versionPropertyName ) ; return Entity . newBuilder ( nativeEntity ) . set ( versionPropertyName , ++ version ) . build ( ) ; |
public class JsiiEngine { /** * Dequeues and processes pending jsii callbacks until there are no more callbacks to process . */
public void processAllPendingCallbacks ( ) { } } | while ( true ) { List < Callback > callbacks = this . getClient ( ) . pendingCallbacks ( ) ; if ( callbacks . size ( ) == 0 ) { break ; } callbacks . forEach ( this :: processCallback ) ; } |
public class ThreadContext { /** * Access the inbound connection info object for this context .
* @ return Map < String , Object > - null if not set */
public Map < String , Object > getInboundConnectionInfo ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "getInboundConnectionInfo" ) ; return this . inboundConnectionInfo ; |
public class AudioLanguageSelectionMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AudioLanguageSelection audioLanguageSelection , ProtocolMarshaller protocolMarshaller ) { } } | if ( audioLanguageSelection == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( audioLanguageSelection . getLanguageCode ( ) , LANGUAGECODE_BINDING ) ; protocolMarshaller . marshall ( audioLanguageSelection . getLanguageSelectionPolicy ( ) , LANGUAGESELECTIONPOLICY_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Evaluator { /** * Attribute .
* @ param _ alias the alias
* @ return the attribute
* @ throws EFapsException the e faps exception */
public Attribute attribute ( final String _alias ) throws EFapsException { } } | initialize ( true ) ; Attribute ret = null ; final Optional < Select > selectOpt = this . selection . getSelects ( ) . stream ( ) . filter ( select -> _alias . equals ( select . getAlias ( ) ) ) . findFirst ( ) ; if ( selectOpt . isPresent ( ) ) { ret = attribute ( selectOpt . get ( ) ) ; } return ret ; |
public class ImmutableFSJobCatalog { /** * Fetch all the job files under the jobConfDirPath
* @ return A collection of JobSpec */
@ Override public synchronized List < JobSpec > getJobs ( ) { } } | return Lists . transform ( Lists . newArrayList ( loader . loadPullFilesRecursively ( loader . getRootDirectory ( ) , this . sysConfig , shouldLoadGlobalConf ( ) ) ) , this . converter ) ; |
public class PropertyMap { /** * Returns the default value if the given key isn ' t in this PropertyMap or
* it isn ' t a valid integer .
* @ param key Key of property to read
* @ param def Default value */
public Integer getInteger ( String key , Integer def ) { } } | String value = getString ( key ) ; if ( value == null ) { return def ; } else { try { return Integer . valueOf ( value ) ; } catch ( NumberFormatException e ) { } return def ; } |
public class CmsEditModuleForm { /** * Adds a new module resource row . < p >
* @ param moduleResource the initial value for the module resource */
void addModuleResource ( String moduleResource ) { } } | CmsModuleResourceSelectField resField = createModuleResourceField ( moduleResource ) ; if ( resField != null ) { m_moduleResourcesGroup . addRow ( resField ) ; } |
public class ExceptionTableSensitiveMethodVisitor { /** * Visits a field instruction .
* @ param opcode The visited opcode .
* @ param owner The field ' s owner .
* @ param name The field ' s name .
* @ param descriptor The field ' s descriptor . */
protected void onVisitFieldInsn ( int opcode , String owner , String name , String descriptor ) { } } | super . visitFieldInsn ( opcode , owner , name , descriptor ) ; |
public class MapReadResult { /** * Adds other MapReadResult by combining pois and ways . Optionally , deduplication can
* be requested ( much more expensive ) .
* @ param other the MapReadResult to add to this .
* @ param deduplicate true if check for duplicates is required . */
public void add ( MapReadResult other , boolean deduplicate ) { } } | if ( deduplicate ) { for ( PointOfInterest poi : other . pointOfInterests ) { if ( ! this . pointOfInterests . contains ( poi ) ) { this . pointOfInterests . add ( poi ) ; } } for ( Way way : other . ways ) { if ( ! this . ways . contains ( way ) ) { this . ways . add ( way ) ; } } } else { this . pointOfInterests . addAll ( other . pointOfInterests ) ; this . ways . addAll ( other . ways ) ; } |
public class ScriptableObject { /** * This is a version of putProperty for Symbol keys . */
public static void putProperty ( Scriptable obj , Symbol key , Object value ) { } } | Scriptable base = getBase ( obj , key ) ; if ( base == null ) base = obj ; ensureSymbolScriptable ( base ) . put ( key , obj , value ) ; |
public class JsonEscape { /** * Perform a ( configurable ) JSON < strong > escape < / strong > operation on a < tt > char [ ] < / tt > input .
* This method will perform an escape operation according to the specified
* { @ link JsonEscapeType } and
* { @ link JsonEscapeLevel } argument values .
* All other < tt > char [ ] < / tt > - based < tt > escapeJson * ( . . . ) < / tt > methods call this one with preconfigured
* < tt > type < / tt > and < tt > level < / tt > values .
* This method is < strong > thread - safe < / strong > .
* @ param text the < tt > char [ ] < / tt > to be escaped .
* @ param offset the position in < tt > text < / tt > at which the escape operation should start .
* @ param len the number of characters in < tt > text < / tt > that should be escaped .
* @ param writer the < tt > java . io . Writer < / tt > to which the escaped result will be written . Nothing will
* be written at all to this writer if input is < tt > null < / tt > .
* @ param type the type of escape operation to be performed , see
* { @ link JsonEscapeType } .
* @ param level the escape level to be applied , see { @ link JsonEscapeLevel } .
* @ throws IOException if an input / output exception occurs */
public static void escapeJson ( final char [ ] text , final int offset , final int len , final Writer writer , final JsonEscapeType type , final JsonEscapeLevel level ) throws IOException { } } | if ( writer == null ) { throw new IllegalArgumentException ( "Argument 'writer' cannot be null" ) ; } if ( type == null ) { throw new IllegalArgumentException ( "The 'type' argument cannot be null" ) ; } if ( level == null ) { throw new IllegalArgumentException ( "The 'level' argument cannot be null" ) ; } final int textLen = ( text == null ? 0 : text . length ) ; if ( offset < 0 || offset > textLen ) { throw new IllegalArgumentException ( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen ) ; } if ( len < 0 || ( offset + len ) > textLen ) { throw new IllegalArgumentException ( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen ) ; } JsonEscapeUtil . escape ( text , offset , len , writer , type , level ) ; |
public class SystemPropertyChangeEnvironmentFacet { /** * { @ inheritDoc } */
@ Override public void setup ( ) { } } | if ( type == ChangeType . REMOVE ) { System . clearProperty ( key ) ; } else { System . setProperty ( key , newValue ) ; } if ( log . isDebugEnabled ( ) ) { log . debug ( "Setup " + toString ( ) ) ; } |
public class ClassDescSupport { /** * インポート名を追加します 。
* @ param classDesc クラス記述
* @ param importedClassName インポートされるクラスの名前 */
public void addImportName ( ClassDesc classDesc , String importedClassName ) { } } | String packageName = ClassUtil . getPackageName ( importedClassName ) ; if ( isImportTargetPackage ( classDesc , packageName ) ) { classDesc . addImportName ( importedClassName ) ; } |
public class PojoDescriptorBuilderImpl { /** * Introspects the { @ link Field } s of the given { @ link Class } and adds them to the given { @ link PojoDescriptorImpl } .
* @ param < P > is the generic type of { @ code pojoClass } .
* @ param pojoClass is the { @ link Class } for the { @ link PojoDescriptorImpl # getPojoType ( ) pojo type } .
* @ param descriptor is the { @ link PojoDescriptorImpl } where to add { @ link PojoPropertyAccessor } s for detected
* properties .
* @ param nonPublicAccessibleObjects is the { @ link List } where to add non - public { @ link AccessibleObject } s . */
private < P > void introspectFields ( Class < P > pojoClass , PojoDescriptorImpl < P > descriptor , List < AccessibleObject > nonPublicAccessibleObjects ) { } } | if ( getFieldIntrospector ( ) != null ) { Iterator < Field > fieldIterator = getFieldIntrospector ( ) . findFields ( pojoClass ) ; while ( fieldIterator . hasNext ( ) ) { Field field = fieldIterator . next ( ) ; boolean fieldUsed = false ; for ( PojoPropertyAccessorBuilder < ? > builder : getAccessorBuilders ( ) ) { PojoPropertyAccessor accessor = builder . create ( field , descriptor , getDependencies ( ) ) ; if ( accessor != null ) { boolean registered = registerAccessor ( descriptor , accessor ) ; if ( registered ) { fieldUsed = true ; } } } if ( fieldUsed && ! isPublicAccessible ( field ) ) { // reflective access that violates visibility
nonPublicAccessibleObjects . add ( field ) ; } PojoPropertyDescriptorImpl propertyDescriptor = descriptor . getPropertyDescriptor ( field . getName ( ) ) ; if ( propertyDescriptor != null ) { // should actually never be null here . . .
propertyDescriptor . setField ( field ) ; } } } |
public class DataIO { /** * Create a r / o data tablemodel
* @ param src
* @ return a table model to the CSTable */
public static TableModel createTableModel ( final CSTable src ) { } } | final List < String [ ] > rows = new ArrayList < String [ ] > ( ) ; for ( String [ ] row : src . rows ( ) ) { rows . add ( row ) ; } return new TableModel ( ) { @ Override public int getColumnCount ( ) { return src . getColumnCount ( ) ; } @ Override public String getColumnName ( int column ) { return src . getColumnName ( column ) ; } @ Override public int getRowCount ( ) { return rows . size ( ) ; } @ Override public Class < ? > getColumnClass ( int columnIndex ) { return String . class ; } @ Override public boolean isCellEditable ( int rowIndex , int columnIndex ) { return false ; } @ Override public Object getValueAt ( int rowIndex , int columnIndex ) { return rows . get ( rowIndex ) [ columnIndex ] ; } @ Override public void setValueAt ( Object aValue , int rowIndex , int columnIndex ) { // rows . get ( rowIndex ) [ columnIndex ] = ( String ) aValue ;
} @ Override public void addTableModelListener ( TableModelListener l ) { } @ Override public void removeTableModelListener ( TableModelListener l ) { } } ; |
public class ColVals { /** * < p > Get column with Float val . < / p >
* @ param pNm column name
* @ return Float column val
* @ throws ExceptionWithCode if field not found */
public final Float getFloat ( final String pNm ) throws ExceptionWithCode { } } | if ( this . floats != null && this . floats . keySet ( ) . contains ( pNm ) ) { return this . floats . get ( pNm ) ; } throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "There is no field - " + pNm ) ; |
public class JScoreComponent { /** * Writes the currently set tune score to a PNG file .
* @ param file The PNG output file .
* @ throws IOException Thrown if the given file cannot be accessed . */
public void writeScoreTo ( File file ) throws IOException { } } | FileOutputStream fos = new FileOutputStream ( file ) ; try { writeScoreTo ( fos ) ; } finally { fos . close ( ) ; } |
public class IconicsDrawable { /** * Set rounded corner from res
* @ return The current IconicsDrawable for chaining . */
@ NonNull public IconicsDrawable roundedCornersRxRes ( @ DimenRes int sizeResId ) { } } | return roundedCornersRxPx ( mContext . getResources ( ) . getDimensionPixelSize ( sizeResId ) ) ; |
public class ScriptContext { /** * Registers a reporter .
* @ param reporter
* the reporter */
@ Cmd public Reporter registerReporter ( final Reporter reporter ) { } } | injector . injectMembers ( reporter ) ; reporters . add ( reporter ) ; return reporter ; |
public class RestRequest { /** * Executes the request blocking .
* @ return The result of the request .
* @ throws Exception If something went wrong while executing the request . */
public RestRequestResult executeBlocking ( ) throws Exception { } } | Request . Builder requestBuilder = new Request . Builder ( ) ; HttpUrl . Builder httpUrlBuilder = endpoint . getOkHttpUrl ( urlParameters ) . newBuilder ( ) ; queryParameters . forEach ( httpUrlBuilder :: addQueryParameter ) ; requestBuilder . url ( httpUrlBuilder . build ( ) ) ; RequestBody requestBody ; if ( multipartBody != null ) { requestBody = multipartBody ; } else if ( body != null ) { requestBody = RequestBody . create ( MediaType . parse ( "application/json" ) , body ) ; } else { requestBody = RequestBody . create ( null , new byte [ 0 ] ) ; } switch ( method ) { case GET : requestBuilder . get ( ) ; break ; case POST : requestBuilder . post ( requestBody ) ; break ; case PUT : requestBuilder . put ( requestBody ) ; break ; case DELETE : requestBuilder . delete ( requestBody ) ; break ; case PATCH : requestBuilder . patch ( requestBody ) ; break ; default : throw new IllegalArgumentException ( "Unsupported http method!" ) ; } if ( includeAuthorizationHeader ) { requestBuilder . addHeader ( "authorization" , api . getPrefixedToken ( ) ) ; } headers . forEach ( requestBuilder :: addHeader ) ; logger . debug ( "Trying to send {} request to {}{}" , method :: name , ( ) -> endpoint . getFullUrl ( urlParameters ) , ( ) -> body != null ? " with body " + body : "" ) ; try ( Response response = getApi ( ) . getHttpClient ( ) . newCall ( requestBuilder . build ( ) ) . execute ( ) ) { RestRequestResult result = new RestRequestResult ( this , response ) ; logger . debug ( "Sent {} request to {} and received status code {} with{} body{}" , method :: name , ( ) -> endpoint . getFullUrl ( urlParameters ) , response :: code , ( ) -> result . getBody ( ) . map ( b -> "" ) . orElse ( " empty" ) , ( ) -> result . getStringBody ( ) . map ( s -> " " + s ) . orElse ( "" ) ) ; if ( response . code ( ) >= 300 || response . code ( ) < 200 ) { RestRequestInformation requestInformation = asRestRequestInformation ( ) ; RestRequestResponseInformation responseInformation = new RestRequestResponseInformationImpl ( requestInformation , result ) ; Optional < RestRequestHttpResponseCode > responseCode = RestRequestHttpResponseCode . fromCode ( response . code ( ) ) ; // Check if the response body contained a know error code
if ( ! result . getJsonBody ( ) . isNull ( ) && result . getJsonBody ( ) . has ( "code" ) ) { int code = result . getJsonBody ( ) . get ( "code" ) . asInt ( ) ; String message = result . getJsonBody ( ) . has ( "message" ) ? result . getJsonBody ( ) . get ( "message" ) . asText ( ) : null ; Optional < ? extends DiscordException > discordException = RestRequestResultErrorCode . fromCode ( code , responseCode . orElse ( null ) ) . flatMap ( restRequestResultCode -> restRequestResultCode . getDiscordException ( origin , ( message == null ) ? restRequestResultCode . getMeaning ( ) : message , requestInformation , responseInformation ) ) ; // There ' s an exception for this specific response code
if ( discordException . isPresent ( ) ) { throw discordException . get ( ) ; } } switch ( response . code ( ) ) { case 429 : // A 429 will be handled in the RatelimitManager class
return result ; default : // There are specific exceptions for specific response codes ( e . g . NotFoundException for 404)
Optional < ? extends DiscordException > discordException = responseCode . flatMap ( restRequestHttpResponseCode -> restRequestHttpResponseCode . getDiscordException ( origin , "Received a " + response . code ( ) + " response from Discord with" + ( result . getBody ( ) . isPresent ( ) ? "" : " empty" ) + " body" + result . getStringBody ( ) . map ( s -> " " + s ) . orElse ( "" ) + "!" , requestInformation , responseInformation ) ) ; if ( discordException . isPresent ( ) ) { throw discordException . get ( ) ; } else { // No specific exception was defined for the response code , so throw a " normal "
throw new DiscordException ( origin , "Received a " + response . code ( ) + " response from Discord with" + ( result . getBody ( ) . isPresent ( ) ? "" : " empty" ) + " body" + result . getStringBody ( ) . map ( s -> " " + s ) . orElse ( "" ) + "!" , requestInformation , responseInformation ) ; } } } return result ; } |
public class CollectionUtils { /** * < p > Attempts to convert a collection to the given iterabable type < / p > .
* @ param iterableType The iterable type
* @ param collection The collection
* @ param < T > The collection generic type
* @ return An { @ link Optional } of the converted type */
public static < T > Optional < Iterable < T > > convertCollection ( Class < ? extends Iterable < T > > iterableType , Collection < T > collection ) { } } | if ( iterableType . isInstance ( collection ) ) { return Optional . of ( collection ) ; } if ( iterableType . equals ( Set . class ) ) { return Optional . of ( new HashSet < > ( collection ) ) ; } if ( iterableType . equals ( Queue . class ) ) { return Optional . of ( new LinkedList < > ( collection ) ) ; } if ( iterableType . equals ( List . class ) ) { return Optional . of ( new ArrayList < > ( collection ) ) ; } if ( ! iterableType . isInterface ( ) ) { try { Constructor < ? extends Iterable < T > > constructor = iterableType . getConstructor ( Collection . class ) ; return Optional . of ( constructor . newInstance ( collection ) ) ; } catch ( Throwable e ) { return Optional . empty ( ) ; } } return Optional . empty ( ) ; |
public class Arc { /** * Draws this arc .
* @ param context the { @ link Context2D } used to draw this arc . */
@ Override protected boolean prepare ( final Context2D context , final Attributes attr , final double alpha ) { } } | final double r = attr . getRadius ( ) ; if ( r > 0 ) { context . beginPath ( ) ; context . arc ( 0 , 0 , r , attr . getStartAngle ( ) , attr . getEndAngle ( ) , attr . isCounterClockwise ( ) ) ; return true ; } return false ; |
public class TableInfo { /** * Adds the to indexed column list .
* @ param indexInfo
* the index info */
public void addToIndexedColumnList ( IndexInfo indexInfo ) { } } | ColumnInfo columnInfo = new ColumnInfo ( ) ; columnInfo . setColumnName ( indexInfo . getColumnName ( ) ) ; if ( getEmbeddedColumnMetadatas ( ) . isEmpty ( ) || ! getEmbeddedColumnMetadatas ( ) . get ( 0 ) . getColumns ( ) . contains ( columnInfo ) ) { if ( ! columnToBeIndexed . contains ( indexInfo ) ) { columnToBeIndexed . add ( indexInfo ) ; } } |
public class ExpectedValueCheckingTransaction { /** * Check all locks attempted by earlier
* { @ link KeyColumnValueStore # acquireLock ( StaticBuffer , StaticBuffer , StaticBuffer , StoreTransaction ) }
* calls using this transaction .
* @ throws com . thinkaurelius . titan . diskstorage . BackendException */
void checkAllLocks ( ) throws BackendException { } } | StoreTransaction lt = getConsistentTx ( ) ; for ( ExpectedValueCheckingStore store : expectedValuesByStore . keySet ( ) ) { Locker locker = store . getLocker ( ) ; // Ignore locks on stores without a locker
if ( null == locker ) continue ; locker . checkLocks ( lt ) ; } |
public class JodaConvertStringBinding { /** * / * @ Override */
public S convertFromString ( Class < ? extends S > boundClass , String inputString ) { } } | return converter . convertFromString ( boundClass , inputString ) ; |
public class MethodNodeUtils { /** * For a method node potentially representing a property , returns the name of the property .
* @ param mNode a MethodNode
* @ return the property name without the get / set / is prefix if a property or null */
public static String getPropertyName ( MethodNode mNode ) { } } | String name = mNode . getName ( ) ; if ( name . startsWith ( "set" ) || name . startsWith ( "get" ) || name . startsWith ( "is" ) ) { String pname = decapitalize ( name . substring ( name . startsWith ( "is" ) ? 2 : 3 ) ) ; if ( ! pname . isEmpty ( ) ) { if ( name . startsWith ( "set" ) ) { if ( mNode . getParameters ( ) . length == 1 ) { return pname ; } } else if ( mNode . getParameters ( ) . length == 0 && ! ClassHelper . VOID_TYPE . equals ( mNode . getReturnType ( ) ) ) { if ( name . startsWith ( "get" ) || ClassHelper . boolean_TYPE . equals ( mNode . getReturnType ( ) ) ) { return pname ; } } } } return null ; |
public class IfcMoveImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) public EList < String > getPunchList ( ) { } } | return ( EList < String > ) eGet ( Ifc2x3tc1Package . Literals . IFC_MOVE__PUNCH_LIST , true ) ; |
public class SequentialEvent { /** * Gets the listener classes to which dispatching should be prevented while
* this event is being dispatched .
* @ return The listener classes marked to prevent .
* @ see # preventCascade ( Class ) */
public Set < Class < ? > > getPrevented ( ) { } } | if ( this . prevent == null ) { return Collections . emptySet ( ) ; } return Collections . unmodifiableSet ( this . prevent ) ; |
public class AbsFilesScanner { /** * / * map */
public Map < String , T > map ( File [ ] files , int start , int count ) { } } | final Map < String , T > results = new LinkedHashMap < > ( ) ; scan ( files , start , count , new Function < File , Void > ( ) { @ Override public Void apply ( File file ) { Tuple2 < String , T > mapping = file2map ( file ) ; results . put ( mapping . get0 ( ) , mapping . get1 ( ) ) ; return null ; } } ) ; return results ; |
public class CorcInputFormat { /** * Sets which fields are to be read from the ORC file */
static void setReadColumns ( Configuration conf , StructTypeInfo actualStructTypeInfo ) { } } | StructTypeInfo readStructTypeInfo = getTypeInfo ( conf ) ; LOG . info ( "Read StructTypeInfo: {}" , readStructTypeInfo ) ; List < Integer > ids = new ArrayList < > ( ) ; List < String > names = new ArrayList < > ( ) ; List < String > readNames = readStructTypeInfo . getAllStructFieldNames ( ) ; List < String > actualNames = actualStructTypeInfo . getAllStructFieldNames ( ) ; for ( int i = 0 ; i < actualNames . size ( ) ; i ++ ) { String actualName = actualNames . get ( i ) ; if ( readNames . contains ( actualName ) ) { // make sure they are the same type
TypeInfo actualTypeInfo = actualStructTypeInfo . getStructFieldTypeInfo ( actualName ) ; TypeInfo readTypeInfo = readStructTypeInfo . getStructFieldTypeInfo ( actualName ) ; if ( ! actualTypeInfo . equals ( readTypeInfo ) ) { throw new IllegalStateException ( "readTypeInfo [" + readTypeInfo + "] does not match actualTypeInfo [" + actualTypeInfo + "]" ) ; } // mark the column as to - be - read
ids . add ( i ) ; names . add ( actualName ) ; } } if ( ids . size ( ) == 0 ) { throw new IllegalStateException ( "None of the selected columns were found in the ORC file." ) ; } LOG . info ( "Set column projection on columns: {} ({})" , ids , names ) ; ColumnProjectionUtils . appendReadColumns ( conf , ids , names ) ; |
public class HandoffResultsListener { /** * If I am the node which accepted this handoff , finish the job .
* If I ' m the node that requested to hand off this work unit to
* another node , shut it down after < config > seconds . */
private void apply ( String workUnit ) { } } | if ( ! cluster . isInitialized ( ) ) { return ; } if ( iRequestedHandoff ( workUnit ) ) { String str = cluster . getHandoffResult ( workUnit ) ; LOG . info ( "Handoff of {} to {} completed. Shutting down {} in {} seconds." , workUnit , ( str == null ) ? "(None)" : str , workUnit , clusterConfig . handoffShutdownDelay ) ; ZKUtils . delete ( cluster . zk , String . format ( "/%s/handoff-requests/%s" , cluster . name , workUnit ) ) ; cluster . schedule ( shutdownAfterHandoff ( workUnit ) , clusterConfig . handoffShutdownDelay , TimeUnit . SECONDS ) ; } |
public class RequireOS { /** * ( non - Javadoc )
* @ see org . apache . maven . enforcer . rule . api . EnforcerRule # getCacheId ( ) */
public String getCacheId ( ) { } } | // return the hashcodes of all the parameters
StringBuffer b = new StringBuffer ( ) ; if ( StringUtils . isNotEmpty ( version ) ) { b . append ( version . hashCode ( ) ) ; } if ( StringUtils . isNotEmpty ( name ) ) { b . append ( name . hashCode ( ) ) ; } if ( StringUtils . isNotEmpty ( arch ) ) { b . append ( arch . hashCode ( ) ) ; } if ( StringUtils . isNotEmpty ( family ) ) { b . append ( family . hashCode ( ) ) ; } return b . toString ( ) ; |
public class JobRecord { /** * Constructs and returns a Data Store Entity that represents this model
* object */
@ Override public Entity toEntity ( ) { } } | Entity entity = toProtoEntity ( ) ; entity . setProperty ( JOB_INSTANCE_PROPERTY , jobInstanceKey ) ; entity . setProperty ( FINALIZE_BARRIER_PROPERTY , finalizeBarrierKey ) ; entity . setProperty ( RUN_BARRIER_PROPERTY , runBarrierKey ) ; entity . setProperty ( OUTPUT_SLOT_PROPERTY , outputSlotKey ) ; entity . setProperty ( STATE_PROPERTY , state . toString ( ) ) ; if ( null != exceptionHandlingAncestorKey ) { entity . setProperty ( EXCEPTION_HANDLING_ANCESTOR_KEY_PROPERTY , exceptionHandlingAncestorKey ) ; } if ( exceptionHandlerSpecified ) { entity . setProperty ( EXCEPTION_HANDLER_SPECIFIED_PROPERTY , Boolean . TRUE ) ; } if ( null != exceptionHandlerJobKey ) { entity . setProperty ( EXCEPTION_HANDLER_JOB_KEY_PROPERTY , exceptionHandlerJobKey ) ; } if ( null != exceptionKey ) { entity . setProperty ( EXCEPTION_KEY_PROPERTY , exceptionKey ) ; } if ( null != exceptionHandlerJobGraphGuid ) { entity . setUnindexedProperty ( EXCEPTION_HANDLER_JOB_GRAPH_GUID_PROPERTY , new Text ( exceptionHandlerJobGraphGuid ) ) ; } entity . setUnindexedProperty ( CALL_EXCEPTION_HANDLER_PROPERTY , callExceptionHandler ) ; entity . setUnindexedProperty ( IGNORE_EXCEPTION_PROPERTY , ignoreException ) ; if ( childGraphGuid != null ) { entity . setUnindexedProperty ( CHILD_GRAPH_GUID_PROPERTY , new Text ( childGraphGuid ) ) ; } entity . setProperty ( START_TIME_PROPERTY , startTime ) ; entity . setUnindexedProperty ( END_TIME_PROPERTY , endTime ) ; entity . setProperty ( CHILD_KEYS_PROPERTY , childKeys ) ; entity . setUnindexedProperty ( ATTEMPT_NUM_PROPERTY , attemptNumber ) ; entity . setUnindexedProperty ( MAX_ATTEMPTS_PROPERTY , maxAttempts ) ; entity . setUnindexedProperty ( BACKOFF_SECONDS_PROPERTY , backoffSeconds ) ; entity . setUnindexedProperty ( BACKOFF_FACTOR_PROPERTY , backoffFactor ) ; entity . setUnindexedProperty ( ON_BACKEND_PROPERTY , queueSettings . getOnBackend ( ) ) ; entity . setUnindexedProperty ( ON_MODULE_PROPERTY , queueSettings . getOnModule ( ) ) ; entity . setUnindexedProperty ( MODULE_VERSION_PROPERTY , queueSettings . getModuleVersion ( ) ) ; entity . setUnindexedProperty ( ON_QUEUE_PROPERTY , queueSettings . getOnQueue ( ) ) ; entity . setUnindexedProperty ( STATUS_CONSOLE_URL , statusConsoleUrl ) ; if ( rootJobDisplayName != null ) { entity . setProperty ( ROOT_JOB_DISPLAY_NAME , rootJobDisplayName ) ; } return entity ; |
public class Sig { /** * sigtail - segment mit werten aus den lokalen variablen füllen */
private void fillSigTail ( SEG sighead , SEG sigtail ) { } } | String sigtailName = sigtail . getPath ( ) ; sigtail . propagateValue ( sigtailName + ".seccheckref" , sighead . getValueOfDE ( sighead . getPath ( ) + ".seccheckref" ) , SyntaxElement . DONT_TRY_TO_CREATE , SyntaxElement . DONT_ALLOW_OVERWRITE ) ; |
public class EasyXls { /** * 导出list对象到excel
* @ param config 配置
* @ param list 导出的list
* @ param filePath 保存xls路径
* @ param fileName 保存xls文件名
* @ return 处理结果 , true成功 , false失败
* @ throws Exception */
public static boolean list2Xls ( ExcelConfig config , List < ? > list , String filePath , String fileName ) throws Exception { } } | return XlsUtil . list2Xls ( config , list , filePath , fileName ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.