signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class AWSGreengrassClient { /** * Retrieves a list of resource definitions .
* @ param listResourceDefinitionsRequest
* @ return Result of the ListResourceDefinitions operation returned by the service .
* @ sample AWSGreengrass . ListResourceDefinitions
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / greengrass - 2017-06-07 / ListResourceDefinitions "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public ListResourceDefinitionsResult listResourceDefinitions ( ListResourceDefinitionsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListResourceDefinitions ( request ) ; |
public class PactDslRequestWithoutPath { /** * Adds a query parameter that will have it ' s value injected from the provider state
* @ param name Name
* @ param expression Expression to be evaluated from the provider state
* @ param example Example value to use in the consumer test */
public PactDslRequestWithoutPath queryParameterFromProviderState ( String name , String expression , String example ) { } } | requestGenerators . addGenerator ( Category . QUERY , name , new ProviderStateGenerator ( expression ) ) ; query . put ( name , Collections . singletonList ( example ) ) ; return this ; |
public class BNFHeadersImpl { /** * Standard parsing of a token ; however , instead of saving the data into
* the global parsedToken variable , this merely returns the length of the
* token . Used for occasions where we just need to find the length of
* the token .
* @ param buff
* @ param bDelimiter
* @ param bApproveCRLF
* @ return int ( - 1 means we need more data )
* @ throws MalformedMessageException */
protected int parseTokenNonExtract ( WsByteBuffer buff , byte bDelimiter , boolean bApproveCRLF ) throws MalformedMessageException { } } | TokenCodes rc = findTokenLength ( buff , bDelimiter , bApproveCRLF ) ; return ( TokenCodes . TOKEN_RC_MOREDATA . equals ( rc ) ) ? - 1 : this . parsedTokenLength ; |
public class ZooKeeperMasterModel { /** * Undoes the effect of { @ link ZooKeeperMasterModel # registerHost ( String , String ) } . Cleans up
* any leftover host - related things . */
@ Override public void deregisterHost ( final String host ) throws HostNotFoundException , HostStillInUseException { } } | final ZooKeeperClient client = provider . get ( "deregisterHost" ) ; ZooKeeperRegistrarUtil . deregisterHost ( client , host ) ; |
public class FileFixer { /** * Poll namenode ( s ) to find corrupted files . Enqueue blocks for replication
* if needed . */
private void doFindFiles ( ) throws IOException { } } | Set < FileSystem > allFs = new HashSet < FileSystem > ( ) ; Set < Path > filesToFix = new HashSet < Path > ( ) ; // files that are yet to be fixed
// collect all unique filesystems in all policies .
for ( PolicyInfo pinfo : all ) { FileSystem fs = getFs ( pinfo . getConf ( ) , pinfo . getSrcPath ( ) ) ; if ( fs != null ) { allFs . add ( fs ) ; } for ( PathInfo d : pinfo . getDestPaths ( ) ) { fs = getFs ( pinfo . getConf ( ) , d . rpath ) ; if ( fs != null ) { allFs . add ( fs ) ; } } } // make a RPC to all relevant namenodes to find corrupt files
for ( FileSystem fs : allFs ) { if ( ! running ) break ; List < Path > corruptFiles = null ; corruptFiles = getCorruptFilesFromNamenode ( fs ) ; // if we are not already fixing this one , then put it in the list
// of files that need fixing .
for ( Path p : corruptFiles ) { if ( filesBeingFixed . add ( p ) ) { filesToFix . add ( p ) ; } } } if ( ! filesToFix . isEmpty ( ) ) { LOG . info ( "Found " + filesToFix . size ( ) + " corrupt files." ) ; } for ( Path path : filesToFix ) { if ( ! running ) break ; try { fixFile ( path ) ; } catch ( IOException ie ) { LOG . error ( "Error while processing " + path + ": " + StringUtils . stringifyException ( ie ) ) ; // For certain kinds of errors , it might be good if we remove
// this file from filesBeingFixed , so that the file - fix gets
// attemted in the immediate next iteration . For example , if
// we get a network Exception , we can retry immediately . On
// the other hand , if we get a file length mismatch exception
// then no amount of retry will fix it , so it is better to
// retry less frequently .
} } |
public class LiteralType { /** * Parses the .
* @ param result the result
* @ param input the input
* @ return the literal type */
static LiteralType parse ( LiteralType result , String input ) { } } | result . value = input ; Matcher matcher = CLASS_PATTERN . matcher ( input ) ; while ( matcher . find ( ) ) { if ( matcher . group ( GROUP_SIMPLE_INDEX ) != null || matcher . group ( GROUP_ARRAY_INDEX ) != null || matcher . group ( GROUP_TYPE_GENERIC_INDEX ) != null ) { result . value = matcher . group ( GROUP_SIMPLE_INDEX ) ; if ( result . value == null && matcher . group ( GROUP_ARRAY_INDEX ) != null ) { result . value = matcher . group ( GROUP_ARRAY_INDEX ) ; result . array = true ; } if ( result . value == null && matcher . group ( GROUP_TYPE_GENERIC_INDEX ) != null ) { result . value = matcher . group ( GROUP_TYPE_GENERIC_INDEX ) ; result . typeParameter = matcher . group ( GROUP_TYPE_PARAMETER_INDEX ) ; } if ( result . value != null && result . value . indexOf ( "." ) >= 0 ) { // assert : JDK lang
result . rawType = result . value ; if ( result . rawType . startsWith ( "java" ) ) { // assert : raw type is type defined in jdk
try { result . resolvedRawType = Class . forName ( result . rawType ) ; } catch ( ClassNotFoundException e ) { } } } else { // assert : primitive
result . rawType = result . value ; result . primitive = true ; Class < ? > resolved [ ] = { Byte . TYPE , Short . TYPE , Integer . TYPE , Long . TYPE , Float . TYPE , Double . TYPE } ; for ( Class < ? > i : resolved ) { if ( result . rawType . equals ( i . getSimpleName ( ) ) ) { result . resolvedRawType = i ; break ; } } if ( Void . TYPE . getSimpleName ( ) . equals ( result . rawType ) ) { result . resolvedRawType = Void . TYPE ; } } } } return result ; |
public class SocketRWChannelSelector { /** * @ see com . ibm . ws . tcpchannel . internal . ChannelSelector # checkForTimeouts ( ) */
@ Override protected void checkForTimeouts ( ) { } } | final boolean bTrace = TraceComponent . isAnyTracingEnabled ( ) ; // See if anything may have timed out
final long now = super . currentTime ; if ( now < nextTimeoutTime ) { if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "checkForTimeouts bypassing timeout processing" ) ; } return ; } Set < SelectionKey > selectorKeys = selector . keys ( ) ; if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "checkForTimeouts - checking " + selectorKeys . size ( ) + " keys for timeouts" ) ; } if ( selectorKeys . isEmpty ( ) ) { // if this isn ' t the primary ( first ) selector , see if it should be closed
if ( countIndex > 0 ) { // if we have already been waiting , and still no keys , and this
// isn ' t the primary selector , we should close this
if ( waitingToQuit ) { quit = true ; } else { wqm . updateCount ( countIndex , WorkQueueManager . CS_DELETE_IN_PROGRESS , channelType ) ; waitingToQuit = true ; nextTimeoutTime = now + TCPFactoryConfiguration . getChannelSelectorWaitToTerminate ( ) ; } } else { nextTimeoutTime = now + TCPFactoryConfiguration . getChannelSelectorIdleTimeout ( ) ; } } else { waitingToQuit = false ; // go through requests , timing out those that need it , and calculating new
// timeout
// set nexttimeouttime to whatever the selectoridletimeout is , and work
// back from there
nextTimeoutTime = now + TCPFactoryConfiguration . getChannelSelectorIdleTimeout ( ) ; for ( SelectionKey key : selectorKeys ) { try { if ( key . interestOps ( ) <= 0 ) { // skip if not waiting on read / writes
continue ; } TCPBaseRequestContext req = ( TCPBaseRequestContext ) key . attachment ( ) ; if ( ! req . hasTimeout ( ) ) { // skip if read / write does not have a timeout
continue ; } if ( req . getTimeoutTime ( ) <= now ) { if ( bTrace && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "Inactivity timeout on channel " + req . getTCPConnLink ( ) . getSocketIOChannel ( ) . getChannel ( ) ) ; } // create timeout exception to pass to callback error method
// Add local and remote address information
String ioeMessage = "Socket operation timed out before it could be completed" ; try { SocketAddress iaLocal = req . getTCPConnLink ( ) . getSocketIOChannel ( ) . getSocket ( ) . getLocalSocketAddress ( ) ; SocketAddress iaRemote = req . getTCPConnLink ( ) . getSocketIOChannel ( ) . getSocket ( ) . getRemoteSocketAddress ( ) ; ioeMessage = ioeMessage + " local=" + iaLocal + " remote=" + iaRemote ; } catch ( Exception x ) { // do not alter the message if the socket got nuked while we tried to look at it
} IOException e = new SocketTimeoutException ( ioeMessage ) ; if ( wqm . dispatch ( req , e ) ) { // reset interest ops so selector won ' t fire again for this key
key . interestOps ( 0 ) ; } else { // try again in another second
nextTimeoutTime = now ; } } else { // adjust times for 1 second granularity of ApproxTime
if ( req . getTimeoutTime ( ) < nextTimeoutTime ) { nextTimeoutTime = req . getTimeoutTime ( ) ; } } } catch ( CancelledKeyException cke ) { // either we didn ' t get the key , or we already dispatched the
// error . In either case , there is nothing more to do
continue ; } } // end - key - loop
} |
public class FileChooserCore { /** * Set a regular expression to filter the files that can be selected .
* @ param filter A regular expression . */
public void setFilter ( String filter ) { } } | if ( filter == null || filter . length ( ) == 0 ) { this . filter = null ; } else { this . filter = filter ; } // Reload the list of files .
this . loadFolder ( this . currentFolder ) ; |
public class AmazonEC2Client { /** * Searches for routes in the specified transit gateway route table .
* @ param searchTransitGatewayRoutesRequest
* @ return Result of the SearchTransitGatewayRoutes operation returned by the service .
* @ sample AmazonEC2 . SearchTransitGatewayRoutes
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / SearchTransitGatewayRoutes " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public SearchTransitGatewayRoutesResult searchTransitGatewayRoutes ( SearchTransitGatewayRoutesRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeSearchTransitGatewayRoutes ( request ) ; |
public class POIProxy { /** * This method is used to get the pois from a service and return a list of
* { @ link JTSFeature } document with the data retrieved given a longitude ,
* latitude and a radius in meters .
* @ param id
* The id of the service
* @ param lon
* The longitude
* @ param lat
* The latitude
* @ param distanceInMeters
* The distance in meters from the lon , lat
* @ return A list of { @ link JTSFeature } */
public ArrayList < JTSFeature > getFeatures ( String id , double lon , double lat , double distanceInMeters , List < Param > optionalParams ) throws Exception { } } | DescribeService describeService = getDescribeServiceByID ( id ) ; double [ ] bbox = Calculator . boundingCoordinates ( lon , lat , distanceInMeters ) ; return getFeatures ( id , optionalParams , describeService , bbox [ 0 ] , bbox [ 1 ] , bbox [ 2 ] , bbox [ 3 ] , lon , lat ) ; |
public class CmsElementOptionBar { /** * Creates an option - bar for the given drag element . < p >
* @ param element the element to create the option - bar for
* @ param dndHandler the drag and drop handler
* @ param buttons the list of buttons to display
* @ return the created option - bar */
public static CmsElementOptionBar createOptionBarForElement ( CmsContainerPageElementPanel element , CmsDNDHandler dndHandler , A_CmsToolbarOptionButton ... buttons ) { } } | CmsElementOptionBar optionBar = new CmsElementOptionBar ( element ) ; if ( buttons != null ) { // add buttons , last as first
for ( int i = buttons . length - 1 ; i >= 0 ; i -- ) { CmsElementOptionButton option = buttons [ i ] . createOptionForElement ( element ) ; if ( option == null ) { continue ; } optionBar . add ( option ) ; if ( buttons [ i ] instanceof CmsToolbarMoveButton ) { option . addMouseDownHandler ( dndHandler ) ; } } } return optionBar ; |
public class Database { public void delete_property ( String name , String [ ] propnames ) throws DevFailed { } } | databaseDAO . delete_property ( this , name , propnames ) ; |
public class PropertyChangeSupport { /** * Returns an array of all the listeners which have been associated with the
* named property .
* @ return all of the < code > PropertyChangeListeners < / code > associated with
* the named property or an empty array if no listeners have been added */
public PropertyChangeListener [ ] getPropertyChangeListeners ( String propertyName ) { } } | List returnList = new ArrayList ( ) ; if ( children != null ) { PropertyChangeSupport support = ( PropertyChangeSupport ) children . get ( propertyName ) ; if ( support != null ) { returnList . addAll ( Arrays . asList ( support . getPropertyChangeListeners ( ) ) ) ; } } return ( PropertyChangeListener [ ] ) ( returnList . toArray ( new PropertyChangeListener [ 0 ] ) ) ; |
public class RuntimeSpringConfigUtilities { /** * Loads any external Spring configuration into the given RuntimeSpringConfiguration object .
* @ param config The config instance */
public static void loadExternalSpringConfig ( RuntimeSpringConfiguration config , final GrailsApplication application ) { } } | if ( springGroovyResourcesBeanBuilder == null ) { try { Class < ? > groovySpringResourcesClass = null ; try { groovySpringResourcesClass = ClassUtils . forName ( SPRING_RESOURCES_CLASS , application . getClassLoader ( ) ) ; } catch ( ClassNotFoundException e ) { // ignore
} if ( groovySpringResourcesClass != null ) { reloadSpringResourcesConfig ( config , application , groovySpringResourcesClass ) ; } } catch ( Exception ex ) { LOG . error ( "[RuntimeConfiguration] Unable to load beans from resources.groovy" , ex ) ; } } else { if ( ! springGroovyResourcesBeanBuilder . getSpringConfig ( ) . equals ( config ) ) { springGroovyResourcesBeanBuilder . registerBeans ( config ) ; } } |
public class BoxRequestItemUpdate { /** * Sets the new tags for the item .
* @ param tags new tags for the item .
* @ return request with the updated tags . */
public R setTags ( List < String > tags ) { } } | JsonArray jsonArray = new JsonArray ( ) ; for ( String s : tags ) { jsonArray . add ( s ) ; } mBodyMap . put ( BoxItem . FIELD_TAGS , jsonArray ) ; return ( R ) this ; |
public class XMLDatabase { /** * Serializes the database to the output stream .
* @ param outputStream the output
* @ param encoding the encoding to use
* @ param indent the indent
* @ param lineSeparator the lineSeparator
* @ throws IOException in case the xml could not be written */
public void writeXML ( OutputStream outputStream , String encoding , String indent , String lineSeparator ) throws IOException { } } | XMLOutputter outputter = new XMLOutputter ( ) ; Format format = Format . getPrettyFormat ( ) ; format . setEncoding ( encoding ) ; format . setIndent ( indent ) ; format . setLineSeparator ( lineSeparator ) ; outputter . setFormat ( format ) ; outputter . output ( getDocument ( ) , outputStream ) ; |
public class StreamZipEntryTransformer { /** * Transforms the input stream entry , writes that to output stream , closes entry in the output stream .
* @ param in input stream of the entry contents
* @ param zipEntry zip entry metadata
* @ param out output stream to write transformed entry ( if necessary )
* @ throws IOException if anything goes wrong */
public void transform ( InputStream in , ZipEntry zipEntry , ZipOutputStream out ) throws IOException { } } | ZipEntry entry = new ZipEntry ( zipEntry . getName ( ) ) ; entry . setTime ( System . currentTimeMillis ( ) ) ; out . putNextEntry ( entry ) ; transform ( zipEntry , in , out ) ; out . closeEntry ( ) ; |
public class Graph { /** * Translate { @ link Vertex } values using the given { @ link MapFunction } .
* @ param translator implements conversion from { @ code VV } to { @ code NEW }
* @ param < NEW > new vertex value type
* @ return graph with translated vertex values
* @ throws Exception */
public < NEW > Graph < K , NEW , EV > translateVertexValues ( TranslateFunction < VV , NEW > translator ) throws Exception { } } | return run ( new TranslateVertexValues < > ( translator ) ) ; |
public class SQLUtility { /** * Get a long string , which could be a TEXT or CLOB type . ( CLOBs require
* special handling - - this method normalizes the reading of them ) */
public static String getLongString ( ResultSet rs , int pos ) throws SQLException { } } | return instance . i_getLongString ( rs , pos ) ; |
public class SvgUtil { /** * Renders an SVG image into a { @ link BufferedImage } .
* @ param svgFile the svg file
* @ param width the width
* @ param height the height
* @ return a buffered image
* @ throws TranscoderException */
public static BufferedImage convertFromSvg ( final URI svgFile , final int width , final int height ) throws TranscoderException { } } | BufferedImageTranscoder imageTranscoder = new BufferedImageTranscoder ( ) ; imageTranscoder . addTranscodingHint ( TIFFTranscoder . KEY_WIDTH , ( float ) width ) ; imageTranscoder . addTranscodingHint ( TIFFTranscoder . KEY_HEIGHT , ( float ) height ) ; TranscoderInput input = new TranscoderInput ( svgFile . toString ( ) ) ; imageTranscoder . transcode ( input , null ) ; return imageTranscoder . getBufferedImage ( ) ; |
public class PopulateScanner { /** * Scan for prime / complex gen annotation and its child annotation
* @ param t class to scan
* @ return populate field map , where
* KEY is field that has populate annotations
* VALUE is Gen container with generate params for that field
* @ see GenContainer */
@ Override public Map < Field , GenContainer > scan ( final Class t ) { } } | final Map < Field , GenContainer > populateAnnotationMap = new LinkedHashMap < > ( ) ; // Check if class is auto generative
final boolean isAutoGen = Arrays . stream ( t . getDeclaredAnnotations ( ) ) . anyMatch ( a -> a . annotationType ( ) . equals ( GenAuto . class ) ) ; for ( final Field field : t . getDeclaredFields ( ) ) { GenContainer genContainer = findGenAnnotation ( field ) ; // Create auto gen container class is auto generative
if ( genContainer == null && isAutoGen ) { Class < ? extends IGenerator > generator = getAutoGenerator ( field . getType ( ) ) ; if ( generator . equals ( NullGenerator . class ) ) { // Try to treat field as embedded object , when no suitable generator
generator = EmbeddedGenerator . class ; } genContainer = GenContainer . asAuto ( generator , isComplex ( field ) ) ; } if ( genContainer != null ) { populateAnnotationMap . put ( field , genContainer ) ; } } return populateAnnotationMap ; |
public class CustomizeWindowsGuest { /** * Connects to specified data center and customize an existing Windows OS based virtual machine identified by the
* inputs provided .
* @ param host VMware host or IP - Example : " vc6 . subdomain . example . com "
* @ param port optional - the port to connect through - Examples : " 443 " , " 80 " - Default : " 443"
* @ param protocol optional - the connection protocol - Valid : " http " , " https " - Default : " https "
* @ param username the VMware username use to connect
* @ param password the password associated with " username " input
* @ param trustEveryone optional - if " true " will allow connections from any host , if " false " the connection will
* be allowed only using a valid vCenter certificate - Default : " true "
* Check the : https : / / pubs . vmware . com / vsphere - 50 / index . jsp ? topic = % 2Fcom . vmware . wssdk . dsg . doc _ 50%2Fsdk _ java _ development . 4.3 . html
* to see how to import a certificate into Java Keystore and
* https : / / pubs . vmware . com / vsphere - 50 / index . jsp ? topic = % 2Fcom . vmware . wssdk . dsg . doc _ 50%2Fsdk _ sg _ server _ certificate _ Appendix . 6.4 . html
* to see how to obtain a valid vCenter certificate
* @ param closeSession Whether to use the flow session context to cache the Connection to the host or not . If set to
* " false " it will close and remove any connection from the session context , otherwise the Connection
* will be kept alive and not removed .
* Valid values : " true " , " false "
* Default value : " true "
* @ param virtualMachineName name of Windows OS based virtual machine that will be customized
* @ param rebootOption specifies whether to shutdown , reboot or not the machine in the customization process
* - Valid : " noreboot " , " reboot " , " shutdown " - Default : " reboot "
* @ param computerName : the network host name of the ( Windows ) virtual machine
* @ param computerPassword the new password for the ( Windows ) virtual machine
* @ param ownerName the user ' s full name
* @ param ownerOrganization : the user ' s organization
* @ param productKey : optional - a valid serial number to be included in the answer file - Default : " "
* @ param domainUsername : optional - the domain user account used for authentication if the virtual machine is
* joining a domain . The user must have the privileges required to add computers to the domain
* - Default : " "
* @ param domainPassword : optional - the password for the domain user account used for authentication if the virtual
* machine is joining a domain - Default : " "
* @ param domain : optional - the fully qualified domain name - Default : " "
* @ param workgroup : optional - the workgroup that the virtual machine should join . If this is supplied , then
* the domain name and authentication fields should not be supplied ( mutually exclusive )
* - Default : " "
* @ param licenseDataMode : the type of the windows license . " perServer " indicates that a client access license has
* been purchased for each computer that accesses the VirtualCenter server . " perSeat " indicates
* that client access licenses have been purchased for the server , allowing a certain number
* of concurrent connections to the VirtualCenter server - Valid : " perServer " , " perSeat "
* - Default : " perServer "
* @ param dnsServer : optional - the server IP address to use for DNS lookup in a Windows guest operating system
* - Default : " "
* @ param ipAddress : optional - the static ip address - Default : " "
* @ param subnetMask : optional - the subnet mask for the virtual network adapter - Default : " "
* @ param defaultGateway : optional - the default gateway for network adapter with a static IP address - Default : " "
* @ param macAddress : optional - the MAC address for network adapter with a static IP address - Default : " "
* @ param autoLogon : optional - specifies whether or not the machine automatically logs on as Administrator
* - Valid : " true " , " false " - Default : " false "
* @ param deleteAccounts : optional - specifies whether if all user accounts will be removed from the system as part
* of the customization or not . This input can be use only for older than API 2.5 versions .
* Since API 2.5 this value is ignored and removing user accounts during customization is
* no longer supported . For older API versions : if deleteAccounts is true , then all user
* accounts are removed from the system as part of the customization . Mini - setup creates a
* new Administrator account with a blank password - Default : " "
* @ param changeSID : specifies whether the customization process should modify or not the machine ' s security
* identifier ( SID ) . For Vista OS , SID will always be modified - Valid : " true " , " false "
* - Default : " true "
* @ param autoLogonCount : optional - if the AutoLogon flag is set , then the AutoLogonCount property specifies the
* number of times the machine should automatically log on as Administrator . Generally it
* should be 1 , but if your setup requires a number of reboots , you may want to increase it
* - Default : " 1"
* @ param autoUsers : optional - this key is valid only if license _ data _ mode input is set ' perServer ' , otherwise
* is ignored . The integer value indicates the number of client licenses purchased for the
* VirtualCenter server being installed - Default : " "
* @ param timeZone : optional - the time zone for the new virtual machine according with
* https : / / technet . microsoft . com / en - us / library / ms145276%28v = sql . 90%29 . aspx
* - Default : " 360"
* @ return resultMap with String as key and value that contains returnCode of the operation , success message with
* task id of the execution or failure message and the exception if there is one */
@ Action ( name = "Customize Windows Guest" , outputs = { } } | @ Output ( Outputs . RETURN_CODE ) , @ Output ( Outputs . RETURN_RESULT ) , @ Output ( Outputs . EXCEPTION ) } , responses = { @ Response ( text = Outputs . SUCCESS , field = Outputs . RETURN_CODE , value = Outputs . RETURN_CODE_SUCCESS , matchType = MatchType . COMPARE_EQUAL , responseType = ResponseType . RESOLVED ) , @ Response ( text = Outputs . FAILURE , field = Outputs . RETURN_CODE , value = Outputs . RETURN_CODE_FAILURE , matchType = MatchType . COMPARE_EQUAL , responseType = ResponseType . ERROR , isOnFail = true ) } ) public Map < String , String > customizeWindowsGuest ( @ Param ( value = HOST , required = true ) String host , @ Param ( value = PORT ) String port , @ Param ( value = PROTOCOL ) String protocol , @ Param ( value = USERNAME , required = true ) String username , @ Param ( value = PASSWORD , encrypted = true ) String password , @ Param ( value = TRUST_EVERYONE ) String trustEveryone , @ Param ( value = CLOSE_SESSION ) String closeSession , @ Param ( value = VM_NAME , required = true ) String virtualMachineName , @ Param ( value = REBOOT_OPTION , required = true ) String rebootOption , @ Param ( value = COMPUTER_NAME , required = true ) String computerName , @ Param ( value = COMPUTER_PASSWORD , required = true ) String computerPassword , @ Param ( value = OWNER_NAME , required = true ) String ownerName , @ Param ( value = OWNER_ORGANIZATION , required = true ) String ownerOrganization , @ Param ( value = PRODUCT_KEY ) String productKey , @ Param ( value = DOMAIN_USERNAME ) String domainUsername , @ Param ( value = DOMAIN_PASSWORD ) String domainPassword , @ Param ( value = DOMAIN ) String domain , @ Param ( value = WORKGROUP ) String workgroup , @ Param ( value = LICENSE_DATA_MODE , required = true ) String licenseDataMode , @ Param ( value = DNS_SERVER ) String dnsServer , @ Param ( value = IP_ADDRESS ) String ipAddress , @ Param ( value = SUBNET_MASK ) String subnetMask , @ Param ( value = DEFAULT_GATEWAY ) String defaultGateway , @ Param ( value = MAC_ADDRESS ) String macAddress , @ Param ( value = AUTO_LOGON ) String autoLogon , @ Param ( value = DELETE_ACCOUNTS ) String deleteAccounts , @ Param ( value = CHANGE_SID , required = true ) String changeSID , @ Param ( value = AUTO_LOGON_COUNT ) String autoLogonCount , @ Param ( value = AUTO_USERS ) String autoUsers , @ Param ( value = TIME_ZONE ) String timeZone , @ Param ( value = VMWARE_GLOBAL_SESSION_OBJECT ) GlobalSessionObject < Map < String , Connection > > globalSessionObject ) { try { final HttpInputs httpInputs = new HttpInputs . HttpInputsBuilder ( ) . withHost ( host ) . withPort ( port ) . withProtocol ( protocol ) . withUsername ( username ) . withPassword ( password ) . withTrustEveryone ( defaultIfEmpty ( trustEveryone , FALSE ) ) . withCloseSession ( defaultIfEmpty ( closeSession , TRUE ) ) . withGlobalSessionObject ( globalSessionObject ) . build ( ) ; final VmInputs vmInputs = new VmInputs . VmInputsBuilder ( ) . withVirtualMachineName ( virtualMachineName ) . build ( ) ; final GuestInputs guestInputs = new GuestInputs . GuestInputsBuilder ( ) . withRebootOption ( rebootOption ) . withComputerName ( computerName ) . withComputerPassword ( computerPassword ) . withOwnerName ( ownerName ) . withOwnerOrganization ( ownerOrganization ) . withProductKey ( productKey ) . withDomainUsername ( domainUsername ) . withDomainPassword ( domainPassword ) . withDomain ( domain ) . withWorkgroup ( workgroup ) . withLicenseDataMode ( licenseDataMode ) . withDnsServer ( dnsServer ) . withIpAddress ( ipAddress ) . withSubnetMask ( subnetMask ) . withDefaultGateway ( defaultGateway ) . withMacAddress ( macAddress ) . withAutoLogon ( autoLogon ) . withDeleteAccounts ( deleteAccounts ) . withChangeSID ( changeSID ) . withAutoLogonCount ( autoLogonCount ) . withAutoUsers ( autoUsers ) . withTimeZone ( timeZone ) . build ( ) ; return new GuestService ( ) . customizeVM ( httpInputs , vmInputs , guestInputs , true ) ; } catch ( Exception ex ) { return OutputUtilities . getFailureResultsMap ( ex ) ; } |
public class StatementHandle { /** * # endif JDK7 */
public void setCursorName ( String name ) throws SQLException { } } | checkClosed ( ) ; try { this . internalStatement . setCursorName ( name ) ; } catch ( SQLException e ) { throw this . connectionHandle . markPossiblyBroken ( e ) ; } |
public class EditUtilities { /** * Gets the coordinate of a Geometry that is the nearest of a given Point ,
* with a distance tolerance .
* @ param g
* @ param p
* @ param tolerance
* @ return */
public static GeometryLocation getVertexToSnap ( Geometry g , Point p , double tolerance ) { } } | DistanceOp distanceOp = new DistanceOp ( g , p ) ; GeometryLocation snapedPoint = distanceOp . nearestLocations ( ) [ 0 ] ; if ( tolerance == 0 || snapedPoint . getCoordinate ( ) . distance ( p . getCoordinate ( ) ) <= tolerance ) { return snapedPoint ; } return null ; |
public class SARLProjectConfigurator { /** * Replies the list of the standard source folders for a SARL project .
* @ return the list of the standard source folders .
* @ since 0.8 */
public static String [ ] getSARLProjectSourceFolders ( ) { } } | return new String [ ] { SARLConfig . FOLDER_SOURCE_SARL , SARLConfig . FOLDER_SOURCE_JAVA , SARLConfig . FOLDER_RESOURCES , SARLConfig . FOLDER_TEST_SOURCE_SARL , SARLConfig . FOLDER_SOURCE_GENERATED , SARLConfig . FOLDER_TEST_SOURCE_GENERATED , } ; |
public class ReferenceAccessController { /** * { @ inheritDoc } */
@ Override public void assertAuthorized ( ClientApplication clientApplication , Action action , Context context ) throws NotAuthorizedException { } } | if ( ! isAuthorized ( clientApplication , action , context ) ) { throw new NotAuthorizedException ( "Access is not allowed for client application: " + clientApplication + " when trying to perform action : " + action + " using context: " + context ) ; } |
public class FedoraTypesUtils { /** * Get the JCR property type ID for a given property name . If unsure , mark
* it as UNDEFINED .
* @ param node the JCR node to add the property on
* @ param propertyName the property name
* @ return a PropertyType value
* @ throws RepositoryException if repository exception occurred */
public static Optional < Integer > getPropertyType ( final Node node , final String propertyName ) throws RepositoryException { } } | LOGGER . debug ( "Getting type of property: {} from node: {}" , propertyName , node ) ; return getDefinitionForPropertyName ( node , propertyName ) . map ( PropertyDefinition :: getRequiredType ) ; |
public class TextField { /** * The TextField type function
* It invokes SeLion session to handle the type action against the element . */
public void type ( String value ) { } } | getDispatcher ( ) . beforeType ( this , value ) ; RemoteWebElement element = getElement ( ) ; element . clear ( ) ; element . sendKeys ( value ) ; if ( Config . getBoolConfigProperty ( ConfigProperty . ENABLE_GUI_LOGGING ) ) { logUIActions ( UIActions . ENTERED , value ) ; } getDispatcher ( ) . afterType ( this , value ) ; |
public class SignatureFinder { /** * Calculate the signature by which we can reliably recognize a loaded track .
* @ param title the track title
* @ param artist the track artist , or { @ code null } if there is no artist
* @ param duration the duration of the track in seconds
* @ param waveformDetail the monochrome waveform detail of the track
* @ param beatGrid the beat grid of the track
* @ return the SHA - 1 hash of all the arguments supplied , or { @ code null } if any either { @ code waveFormDetail } or { @ code beatGrid } were { @ code null } */
public String computeTrackSignature ( final String title , final SearchableItem artist , final int duration , final WaveformDetail waveformDetail , final BeatGrid beatGrid ) { } } | final String safeTitle = ( title == null ) ? "" : title ; final String artistName = ( artist == null ) ? "[no artist]" : artist . label ; try { // Compute the SHA - 1 hash of our fields
MessageDigest digest = MessageDigest . getInstance ( "SHA1" ) ; digest . update ( safeTitle . getBytes ( "UTF-8" ) ) ; digest . update ( ( byte ) 0 ) ; digest . update ( artistName . getBytes ( "UTF-8" ) ) ; digest . update ( ( byte ) 0 ) ; digestInteger ( digest , duration ) ; digest . update ( waveformDetail . getData ( ) ) ; for ( int i = 1 ; i <= beatGrid . beatCount ; i ++ ) { digestInteger ( digest , beatGrid . getBeatWithinBar ( i ) ) ; digestInteger ( digest , ( int ) beatGrid . getTimeWithinTrack ( i ) ) ; } byte [ ] result = digest . digest ( ) ; // Create a hex string representation of the hash
StringBuilder hex = new StringBuilder ( result . length * 2 ) ; for ( byte aResult : result ) { hex . append ( Integer . toString ( ( aResult & 0xff ) + 0x100 , 16 ) . substring ( 1 ) ) ; } return hex . toString ( ) ; } catch ( NullPointerException e ) { logger . info ( "Returning null track signature because an input element was null." , e ) ; } catch ( NoSuchAlgorithmException e ) { logger . error ( "Unable to obtain SHA-1 MessageDigest instance for computing track signatures." , e ) ; } catch ( UnsupportedEncodingException e ) { logger . error ( "Unable to work with UTF-8 string encoding for computing track signatures." , e ) ; } return null ; // We were unable to compute a signature |
public class ActionBarSherlock { /** * Register an ActionBarSherlock implementation .
* @ param implementationClass Target implementation class which extends
* { @ link ActionBarSherlock } . This class must also be annotated with
* { @ link Implementation } . */
public static void registerImplementation ( Class < ? extends ActionBarSherlock > implementationClass ) { } } | if ( ! implementationClass . isAnnotationPresent ( Implementation . class ) ) { throw new IllegalArgumentException ( "Class " + implementationClass . getSimpleName ( ) + " is not annotated with @Implementation" ) ; } else if ( IMPLEMENTATIONS . containsValue ( implementationClass ) ) { if ( DEBUG ) Log . w ( TAG , "Class " + implementationClass . getSimpleName ( ) + " already registered" ) ; return ; } Implementation impl = implementationClass . getAnnotation ( Implementation . class ) ; if ( DEBUG ) Log . i ( TAG , "Registering " + implementationClass . getSimpleName ( ) + " with qualifier " + impl ) ; IMPLEMENTATIONS . put ( impl , implementationClass ) ; |
public class MessageMgr { /** * Creates a new warning message .
* @ param what the what part of the message ( what has happened )
* @ param obj objects to add to the message
* @ return new information message */
public static Message5WH createWarningMessage ( String what , Object ... obj ) { } } | return new Message5WH_Builder ( ) . addWhat ( FormattingTupleWrapper . create ( what , obj ) ) . setType ( E_MessageType . WARNING ) . build ( ) ; |
public class IfConditionImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setElseif ( boolean newElseif ) { } } | boolean oldElseif = elseif ; elseif = newElseif ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , SimpleExpressionsPackage . IF_CONDITION__ELSEIF , oldElseif , elseif ) ) ; |
public class JobXMLDescriptorImpl { /** * If not already created , a new < code > step < / code > element will be created and returned .
* Otherwise , the first existing < code > step < / code > element will be returned .
* @ return the instance defined for the element < code > step < / code > */
public Step < JobXMLDescriptor > getOrCreateStep ( ) { } } | List < Node > nodeList = model . get ( "step" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new StepImpl < JobXMLDescriptor > ( this , "step" , model , nodeList . get ( 0 ) ) ; } return createStep ( ) ; |
public class ULocale { /** * < strong > [ icu ] < / strong > Returns a locale ' s language localized for display in the provided locale .
* If a dialect name is present in the data , then it is returned .
* This is a cover for the ICU4C API .
* @ param localeID the id of the locale whose language will be displayed
* @ param displayLocaleID the id of the locale in which to display the name .
* @ return the localized language name . */
public static String getDisplayLanguageWithDialect ( String localeID , String displayLocaleID ) { } } | return getDisplayLanguageInternal ( new ULocale ( localeID ) , new ULocale ( displayLocaleID ) , true ) ; |
public class netbridge_vlan_binding { /** * Use this API to fetch netbridge _ vlan _ binding resources of given name . */
public static netbridge_vlan_binding [ ] get ( nitro_service service , String name ) throws Exception { } } | netbridge_vlan_binding obj = new netbridge_vlan_binding ( ) ; obj . set_name ( name ) ; netbridge_vlan_binding response [ ] = ( netbridge_vlan_binding [ ] ) obj . get_resources ( service ) ; return response ; |
public class RaftServiceContext { /** * Registers the given session .
* @ param index The index of the registration .
* @ param timestamp The timestamp of the registration .
* @ param session The session to register . */
public long openSession ( long index , long timestamp , RaftSession session ) { } } | log . debug ( "Opening session {}" , session . sessionId ( ) ) ; // Update the state machine index / timestamp .
tick ( index , timestamp ) ; // Set the session timestamp to the current service timestamp .
session . setLastUpdated ( currentTimestamp ) ; // Expire sessions that have timed out .
expireSessions ( currentTimestamp ) ; // Add the session to the sessions list .
session . open ( ) ; service . register ( sessions . addSession ( session ) ) ; // Commit the index , causing events to be sent to clients if necessary .
commit ( ) ; // Complete the future .
return session . sessionId ( ) . id ( ) ; |
public class DescribeWorkingStorageRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeWorkingStorageRequest describeWorkingStorageRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeWorkingStorageRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeWorkingStorageRequest . getGatewayARN ( ) , GATEWAYARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class IHEAuditor { /** * Sends a DICOM Application Activity / Application Stop Event audit message
* @ param eventOutcome Event Outcome Indicator
* @ param actorNameApplication Participant User ID ( Actor Name )
* @ param actorStopper Application Starter Participant User ID ( Actor Starter Name ) */
public void auditActorStopEvent ( RFC3881EventOutcomeCodes eventOutcome , String actorName , String actorStopper ) { } } | if ( ! isAuditorEnabled ( ) ) { return ; } ApplicationStopEvent stopEvent = new ApplicationStopEvent ( eventOutcome ) ; stopEvent . setAuditSourceId ( getAuditSourceId ( ) , getAuditEnterpriseSiteId ( ) ) ; stopEvent . addApplicationParticipant ( actorName , null , null , getSystemNetworkId ( ) ) ; if ( ! EventUtils . isEmptyOrNull ( actorStopper ) ) { stopEvent . addApplicationStarterParticipant ( actorStopper , null , null , null ) ; } audit ( stopEvent ) ; |
public class CommerceNotificationTemplateUtil { /** * Returns the last commerce notification template in the ordered set where uuid = & # 63 ; and companyId = & # 63 ; .
* @ param uuid the uuid
* @ param companyId the company ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching commerce notification template , or < code > null < / code > if a matching commerce notification template could not be found */
public static CommerceNotificationTemplate fetchByUuid_C_Last ( String uuid , long companyId , OrderByComparator < CommerceNotificationTemplate > orderByComparator ) { } } | return getPersistence ( ) . fetchByUuid_C_Last ( uuid , companyId , orderByComparator ) ; |
public class DateTimeConverter { /** * - - - - - StateHolder Methods */
public Object saveState ( FacesContext context ) { } } | if ( context == null ) { throw new NullPointerException ( ) ; } if ( ! initialStateMarked ( ) ) { Object values [ ] = new Object [ 6 ] ; values [ 0 ] = dateStyle ; values [ 1 ] = locale ; values [ 2 ] = pattern ; values [ 3 ] = timeStyle ; values [ 4 ] = timeZone ; values [ 5 ] = type ; return ( values ) ; } return null ; |
public class SimpleBase { /** * Returns true of the specified matrix element is valid element inside this matrix .
* @ param row Row index .
* @ param col Column index .
* @ return true if it is a valid element in the matrix . */
public boolean isInBounds ( int row , int col ) { } } | return row >= 0 && col >= 0 && row < mat . getNumRows ( ) && col < mat . getNumCols ( ) ; |
public class HTMLFileWriter { /** * Returns type string .
* @ param type type for which to return type string
* @ return type string , including parametrized types , dimensions and links . */
private String getTypeString ( Type type ) { } } | String typeQualifiedName = type . qualifiedTypeName ( ) . replaceFirst ( "^java\\.lang\\." , "" ) ; typeQualifiedName = typeQualifiedName . replaceFirst ( "^com\\.qspin\\.qtaste\\.testsuite\\.(QTaste\\w*Exception)" , "$1" ) ; String typeDocFileName = null ; if ( typeQualifiedName . startsWith ( "com.qspin." ) ) { String javaDocDir = typeQualifiedName . startsWith ( "com.qspin.qtaste." ) ? QTaste_JAVADOC_URL_PREFIX : SUT_JAVADOC_URL_PREFIX ; typeDocFileName = javaDocDir + typeQualifiedName . replace ( '.' , '/' ) + ".html" ; } String typeString = typeQualifiedName ; if ( typeDocFileName != null ) { typeString = "<A HREF=\"" + typeDocFileName + "\">" + typeString + "</A>" ; } if ( type . asParameterizedType ( ) != null ) { ParameterizedType parametrizedType = type . asParameterizedType ( ) ; final Type [ ] parameterTypes = parametrizedType . typeArguments ( ) ; if ( parameterTypes . length > 0 ) { String [ ] parametersTypeStrings = new String [ parameterTypes . length ] ; for ( int i = 0 ; i < parameterTypes . length ; i ++ ) { parametersTypeStrings [ i ] = getTypeString ( parameterTypes [ i ] ) ; } typeString += "<" + Strings . join ( parametersTypeStrings , "," ) + ">" ; } } typeString += type . dimension ( ) ; return typeString ; |
public class CmsXmlContentPropertyHelper { /** * Resolves the macros in a single property . < p >
* @ param property the property in which macros should be resolved
* @ param resolver the macro resolver to use
* @ return a new property with resolved macros */
public static CmsXmlContentProperty resolveMacrosInProperty ( CmsXmlContentProperty property , I_CmsMacroResolver resolver ) { } } | String propName = property . getName ( ) ; CmsXmlContentProperty result = new CmsXmlContentProperty ( propName , property . getType ( ) , resolver . resolveMacros ( property . getWidget ( ) ) , resolver . resolveMacros ( property . getWidgetConfiguration ( ) ) , property . getRuleRegex ( ) , property . getRuleType ( ) , property . getDefault ( ) , resolver . resolveMacros ( property . getNiceName ( ) ) , resolver . resolveMacros ( property . getDescription ( ) ) , resolver . resolveMacros ( property . getError ( ) ) , property . isPreferFolder ( ) ? "true" : "false" ) ; return result ; |
public class DenseValueSchema { @ Override public void addType ( int pos , Class < ? extends Value > type ) throws ConflictingFieldTypeInfoException { } } | if ( pos == schema . size ( ) ) { // right at the end , most common case
schema . add ( type ) ; } else if ( pos < schema . size ( ) ) { // in the middle , check for existing conflicts
Class < ? extends Value > previous = schema . get ( pos ) ; if ( previous == null ) { schema . set ( pos , type ) ; } else if ( previous != type ) { throw new ConflictingFieldTypeInfoException ( pos , previous , type ) ; } } else { // grow to the end
for ( int i = schema . size ( ) ; i <= pos ; i ++ ) { schema . add ( null ) ; } schema . set ( pos , type ) ; } |
public class StubServer { /** * Starts the server */
public StubServer run ( ) { } } | simpleServer . getServerConfiguration ( ) . addHttpHandler ( stubsToHandler ( ) , "/" ) ; try { if ( secured ) { for ( NetworkListener networkListener : simpleServer . getListeners ( ) ) { networkListener . setSecure ( true ) ; SSLEngineConfigurator sslEngineConfig = new SSLEngineConfigurator ( getSslConfig ( ) , false , false , false ) ; networkListener . setSSLEngineConfig ( sslEngineConfig ) ; } } simpleServer . start ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } return this ; |
public class HylaFaxClientSpi { /** * This function will submit a new fax job . < br >
* The fax job ID may be populated by this method in the provided
* fax job object .
* @ param faxJob
* The fax job object containing the needed information */
@ Override protected void submitFaxJobImpl ( FaxJob faxJob ) { } } | // get fax job
HylaFaxJob hylaFaxJob = ( HylaFaxJob ) faxJob ; // get client
HylaFAXClient client = this . getHylaFAXClient ( ) ; try { this . submitFaxJob ( hylaFaxJob , client ) ; } catch ( FaxException exception ) { throw exception ; } catch ( Exception exception ) { throw new FaxException ( "General error." , exception ) ; } |
public class AtlasKnoxSSOAuthenticationFilter { /** * public static RSAPublicKey getPublicKeyFromFile ( String filePath ) throws
* IOException , CertificateException {
* FileUtils . readFileToString ( new File ( filePath ) ) ;
* getPublicKeyFromString ( pemString ) ; } */
public static RSAPublicKey parseRSAPublicKey ( String pem ) throws CertificateException , UnsupportedEncodingException , ServletException { } } | String PEM_HEADER = "-----BEGIN CERTIFICATE-----\n" ; String PEM_FOOTER = "\n-----END CERTIFICATE-----" ; String fullPem = PEM_HEADER + pem + PEM_FOOTER ; PublicKey key = null ; try { CertificateFactory fact = CertificateFactory . getInstance ( "X.509" ) ; ByteArrayInputStream is = new ByteArrayInputStream ( fullPem . getBytes ( "UTF8" ) ) ; X509Certificate cer = ( X509Certificate ) fact . generateCertificate ( is ) ; key = cer . getPublicKey ( ) ; } catch ( CertificateException ce ) { String message = null ; if ( pem . startsWith ( PEM_HEADER ) ) { message = "CertificateException - be sure not to include PEM header " + "and footer in the PEM configuration element." ; } else { message = "CertificateException - PEM may be corrupt" ; } throw new ServletException ( message , ce ) ; } catch ( UnsupportedEncodingException uee ) { throw new ServletException ( uee ) ; } return ( RSAPublicKey ) key ; |
public class UTF8String { /** * Encodes a string into a Soundex value . Soundex is an encoding used to relate similar names ,
* but can also be used as a general purpose scheme to find word with similar phonemes .
* https : / / en . wikipedia . org / wiki / Soundex */
public UTF8String soundex ( ) { } } | if ( numBytes == 0 ) { return EMPTY_UTF8 ; } byte b = getByte ( 0 ) ; if ( 'a' <= b && b <= 'z' ) { b -= 32 ; } else if ( b < 'A' || 'Z' < b ) { // first character must be a letter
return this ; } byte [ ] sx = { '0' , '0' , '0' , '0' } ; sx [ 0 ] = b ; int sxi = 1 ; int idx = b - 'A' ; byte lastCode = US_ENGLISH_MAPPING [ idx ] ; for ( int i = 1 ; i < numBytes ; i ++ ) { b = getByte ( i ) ; if ( 'a' <= b && b <= 'z' ) { b -= 32 ; } else if ( b < 'A' || 'Z' < b ) { // not a letter , skip it
lastCode = '0' ; continue ; } idx = b - 'A' ; byte code = US_ENGLISH_MAPPING [ idx ] ; if ( code == '7' ) { // ignore it
} else { if ( code != '0' && code != lastCode ) { sx [ sxi ++ ] = code ; if ( sxi > 3 ) break ; } lastCode = code ; } } return UTF8String . fromBytes ( sx ) ; |
public class AmazonIdentityManagementAsyncClient { /** * Simplified method form for invoking the GetAccountAuthorizationDetails operation with an AsyncHandler .
* @ see # getAccountAuthorizationDetailsAsync ( GetAccountAuthorizationDetailsRequest ,
* com . amazonaws . handlers . AsyncHandler ) */
@ Override public java . util . concurrent . Future < GetAccountAuthorizationDetailsResult > getAccountAuthorizationDetailsAsync ( com . amazonaws . handlers . AsyncHandler < GetAccountAuthorizationDetailsRequest , GetAccountAuthorizationDetailsResult > asyncHandler ) { } } | return getAccountAuthorizationDetailsAsync ( new GetAccountAuthorizationDetailsRequest ( ) , asyncHandler ) ; |
public class AbstractLog { /** * Provide a non - fatal notification , unless suppressed by the - nowarn option .
* @ param key The key for the localized notification message .
* @ param args Fields of the notification message . */
public void note ( JavaFileObject file , String key , Object ... args ) { } } | note ( file , diags . noteKey ( key , args ) ) ; |
public class ClassPathUtils { /** * Scan the classpath string provided , and collect a set of package paths found in jars and classes on the path ,
* excluding any that match a set of exclude prefixes .
* @ param classPath the classpath string
* @ param excludeJarSet a set of jars to exclude from scanning
* @ param excludePrefixes a set of path prefixes that determine what is excluded
* @ return the results of the scan , as a set of package paths ( separated by ' / ' ) . */
public static Set < String > scanClassPathWithExcludes ( final String classPath , final Set < String > excludeJarSet , final Set < String > excludePrefixes ) { } } | final Set < String > pathSet = new HashSet < String > ( ) ; // Defer to JDKPaths to do the actual classpath scanning .
__JDKPaths . processClassPathItem ( classPath , excludeJarSet , pathSet ) ; return filterPathSet ( pathSet , excludePrefixes , Collections . < String > emptySet ( ) ) ; |
public class ConnectorFactory { /** * Creates a new connector object using concrete connector factories chosen by the endpointAddress which is passed
* in .
* @ param fromParticipantId origin participant id
* @ param arbitrationResult result of arbitration
* @ param qosSettings QOS settings
* @ param statelessAsyncParticipantId
* @ return connector object */
@ CheckForNull public ConnectorInvocationHandler create ( final String fromParticipantId , final ArbitrationResult arbitrationResult , final MessagingQos qosSettings , String statelessAsyncParticipantId ) { } } | // iterate through arbitrationResult . getDiscoveryEntries ( )
// check if there is at least one Globally visible
// set isGloballyVisible = true . otherwise = false
boolean isGloballyVisible = false ; Set < DiscoveryEntryWithMetaInfo > entries = arbitrationResult . getDiscoveryEntries ( ) ; for ( DiscoveryEntryWithMetaInfo entry : entries ) { if ( entry . getQos ( ) . getScope ( ) == ProviderScope . GLOBAL ) { isGloballyVisible = true ; } messageRouter . setToKnown ( entry . getParticipantId ( ) ) ; } messageRouter . addNextHop ( fromParticipantId , libjoynrMessagingAddress , isGloballyVisible ) ; return joynrMessagingConnectorFactory . create ( fromParticipantId , arbitrationResult . getDiscoveryEntries ( ) , qosSettings , statelessAsyncParticipantId ) ; |
public class MIMEUtil { /** * Returns the default file extension for the given MIME type .
* Specifying a wildcard type will return { @ code null } .
* @ param pMIME the MIME type
* @ return a { @ code String } containing the file extension , or { @ code null }
* if there are no known file extensions for the given MIME type . */
public static String getExtension ( final String pMIME ) { } } | String mime = bareMIME ( StringUtil . toLowerCase ( pMIME ) ) ; List < String > extensions = sMIMEToExt . get ( mime ) ; return ( extensions == null || extensions . isEmpty ( ) ) ? null : extensions . get ( 0 ) ; |
public class RedisMemoryImpl { @ Override public String hget ( String key , long field ) { } } | return this . hget ( key , Long . toString ( field ) ) ; |
public class StackTraceUtil { /** * Defines a custom format for the stack trace as String . */
public static String toStackTraceString ( String firstLine , StackTraceElement [ ] stack ) { } } | // add the class name and any message passed to constructor
final StringBuilder result = new StringBuilder ( firstLine ) ; // result . append ( aThrowable . toString ( ) ) ;
final String NEW_LINE = System . getProperty ( "line.separator" ) ; result . append ( NEW_LINE ) ; // add each element of the stack trace
for ( StackTraceElement element : stack ) { result . append ( " at " ) ; result . append ( element ) ; result . append ( NEW_LINE ) ; } return result . toString ( ) ; |
public class SourceStreamSetControllableIterator { /** * / * ( non - Javadoc )
* @ see java . util . Iterator # next ( ) */
public Object next ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "next" ) ; StreamSet sourceStreamSet = ( StreamSet ) super . next ( ) ; SIMPPtoPOutboundTransmitControllable sourceStreamSetControl = ( SIMPPtoPOutboundTransmitControllable ) sourceStreamSet . getControlAdapter ( ) ; if ( sourceStreamSetControl != null ) { ( ( SourceStreamSetControl ) sourceStreamSetControl ) . setSourceStreamManager ( sourceStreamMgr ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "next" , sourceStreamSetControl ) ; return sourceStreamSetControl ; |
public class NFLockFreeLogger { /** * ( non - Javadoc )
* @ see org . apache . log4j . Category # addAppender ( org . apache . log4j . Appender ) */
@ Override public void addAppender ( Appender newAppender ) { } } | if ( aai == null ) { synchronized ( this ) { if ( aai == null ) { aai = new NFAppenderAttachableImpl ( ) ; } } } aai . addAppender ( newAppender ) ; repository . fireAddAppenderEvent ( this , newAppender ) ; |
public class Nodes { /** * Creates a new Node ( of the same type as the original node ) that
* is similar to the orginal but doesn ' t contain any empty text or
* CDATA nodes and where all textual content including attribute
* values or comments are trimmed . */
public static Node stripWhitespace ( Node original ) { } } | Node cloned = original . cloneNode ( true ) ; cloned . normalize ( ) ; handleWsRec ( cloned , false ) ; return cloned ; |
public class CmsXmlContentFactory { /** * Creates a new XML content based on a resource type . < p >
* @ param cms the current OpenCms context
* @ param locale the locale to generate the default content for
* @ param resourceType the resource type for which the document should be created
* @ return the created XML content
* @ throws CmsXmlException if something goes wrong */
public static CmsXmlContent createDocument ( CmsObject cms , Locale locale , CmsResourceTypeXmlContent resourceType ) throws CmsXmlException { } } | String schema = resourceType . getSchema ( ) ; CmsXmlContentDefinition contentDefinition = CmsXmlContentDefinition . unmarshal ( cms , schema ) ; CmsXmlContent xmlContent = CmsXmlContentFactory . createDocument ( cms , locale , OpenCms . getSystemInfo ( ) . getDefaultEncoding ( ) , contentDefinition ) ; return xmlContent ; |
public class SwingPortableImageUtil { /** * Loads the image , returning only when the image is loaded .
* Note : This USUSALLY is a bad idea ( to hang this thread until the image loads ) ,
* but in this case , images are ONLY loaded here when they are initially set which
* is when they are selected by the user .
* @ param image the image */
protected void loadImage ( Image image ) { } } | MediaTracker mTracker = getTracker ( ) ; synchronized ( mTracker ) { int id = getNextID ( ) ; mTracker . addImage ( image , id ) ; try { mTracker . waitForID ( id , 0 ) ; } catch ( InterruptedException e ) { System . out . println ( "INTERRUPTED while loading Image" ) ; } // ? int loadStatus = mTracker . statusID ( id , false ) ;
mTracker . removeImage ( image , id ) ; } |
public class Datatype_Builder { /** * Sets the value to be returned by { @ link Datatype # getPropertyEnum ( ) } .
* @ return this { @ code Builder } object
* @ throws NullPointerException if { @ code propertyEnum } is null */
public Datatype . Builder setPropertyEnum ( TypeClass propertyEnum ) { } } | this . propertyEnum = Objects . requireNonNull ( propertyEnum ) ; _unsetProperties . remove ( Property . PROPERTY_ENUM ) ; return ( Datatype . Builder ) this ; |
public class CSSNumberHelper { /** * Try to find the unit that is used in the specified values . This check is
* done using " endsWith " so you have to make sure , that no trailing spaces are
* contained in the passed value . This check excludes a check for percentage
* values ( e . g . < code > 10 % < / code > )
* @ param sCSSValue
* The value to check . May not be < code > null < / code > .
* @ return < code > null < / code > if no matching unit from { @ link ECSSUnit } was
* found .
* @ see # getMatchingUnitInclPercentage ( String ) */
@ Nullable public static ECSSUnit getMatchingUnitExclPercentage ( @ Nonnull final String sCSSValue ) { } } | final ECSSUnit eUnit = getMatchingUnitInclPercentage ( sCSSValue ) ; return eUnit == null || eUnit == ECSSUnit . PERCENTAGE ? null : eUnit ; |
public class AnnotationTypeRequiredMemberWriterImpl { /** * { @ inheritDoc } */
public void addAnnotationDetailsTreeHeader ( ClassDoc classDoc , Content memberDetailsTree ) { } } | if ( ! writer . printedAnnotationHeading ) { memberDetailsTree . addContent ( writer . getMarkerAnchor ( SectionName . ANNOTATION_TYPE_ELEMENT_DETAIL ) ) ; Content heading = HtmlTree . HEADING ( HtmlConstants . DETAILS_HEADING , writer . annotationTypeDetailsLabel ) ; memberDetailsTree . addContent ( heading ) ; writer . printedAnnotationHeading = true ; } |
public class StructSupport { /** * throw exception for invalid key
* @ param key Invalid key
* @ return returns an invalid key Exception */
public static ExpressionException invalidKey ( Config config , Struct sct , Key key , String in ) { } } | String appendix = StringUtil . isEmpty ( in , true ) ? "" : " in the " + in ; Iterator < Key > it = sct . keyIterator ( ) ; Key k ; while ( it . hasNext ( ) ) { k = it . next ( ) ; if ( k . equals ( key ) ) return new ExpressionException ( "the value from key [" + key . getString ( ) + "] " + appendix + " is NULL, which is the same as not existing in CFML" ) ; } config = ThreadLocalPageContext . getConfig ( config ) ; if ( config != null && config . debug ( ) ) return new ExpressionException ( ExceptionUtil . similarKeyMessage ( sct , key . getString ( ) , "key" , "keys" , in , true ) ) ; return new ExpressionException ( "key [" + key . getString ( ) + "] doesn't exist" + appendix ) ; |
public class FCKeditorConfigurations { /** * Generate the url parameter sequence used to pass this configuration to the editor .
* @ return html endocode sequence of configuration parameters */
public String getUrlParams ( ) { } } | StringBuffer osParams = new StringBuffer ( ) ; for ( Iterator i = this . entrySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) i . next ( ) ; if ( entry . getValue ( ) != null ) osParams . append ( "&" + encodeConfig ( entry . getKey ( ) . toString ( ) ) + "=" + encodeConfig ( entry . getValue ( ) . toString ( ) ) ) ; } return osParams . toString ( ) ; |
public class GenericCollectionTypeResolver { /** * Determine the generic element type of the given Collection field .
* @ param collectionField the collection field to introspect
* @ param nestingLevel the nesting level of the target type
* ( typically 1 ; e . g . in case of a List of Lists , 1 would indicate the
* nested List , whereas 2 would indicate the element of the nested List )
* @ return the generic type , or { @ code null } if none */
public static Class < ? > getCollectionFieldType ( Field collectionField , int nestingLevel ) { } } | return getGenericFieldType ( collectionField , Collection . class , 0 , null , nestingLevel ) ; |
public class CompoundTag { /** * method to add child tag to this { @ link CompoundTag } , updates the size on add
* @ param ch
* - child { @ link Tag } to be added
* @ return - this for chaining */
public CompoundTag add ( Tag ch ) { } } | subElements . put ( ch . getName ( ) , ch ) ; long sz = getSize ( ) + ch . totalSize ( ) ; byte length = 1 ; long v = ( sz + 1 ) >> BIT_IN_BYTE ; while ( v > 0 ) { length ++ ; v = v >> BIT_IN_BYTE ; } size = new VINT ( 0L , length , sz ) ; return this ; |
public class AdminToolMenuUtils { /** * reverse collector
* @ return */
public static < T > Collector < T , ? , List < T > > toListReversed ( ) { } } | return Collectors . collectingAndThen ( Collectors . toList ( ) , l -> { Collections . reverse ( l ) ; return l ; } ) ; |
public class ParaClient { /** * Deserializes ParaObjects from a JSON array ( the " items : [ ] " field in search results ) .
* @ param < P > type
* @ param result a list of deserialized maps
* @ return a list of ParaObjects */
@ SuppressWarnings ( "unchecked" ) public < P extends ParaObject > List < P > getItemsFromList ( List < ? > result ) { } } | if ( result != null && ! result . isEmpty ( ) ) { // this isn ' t very efficient but there ' s no way to know what type of objects we ' re reading
ArrayList < P > objects = new ArrayList < > ( result . size ( ) ) ; for ( Object map : result ) { P p = ParaObjectUtils . setAnnotatedFields ( ( Map < String , Object > ) map ) ; if ( p != null ) { objects . add ( p ) ; } } return objects ; } return Collections . emptyList ( ) ; |
public class VEvent { /** * Convenience method to pull the DTEND out of the property list . If DTEND was not specified , use the DTSTART +
* DURATION to calculate it .
* @ param deriveFromDuration specifies whether to derive an end date from the event duration where an end date is
* not found
* @ return The end for this VEVENT . */
public final DtEnd getEndDate ( final boolean deriveFromDuration ) { } } | DtEnd dtEnd = getProperty ( Property . DTEND ) ; // No DTEND ? No problem , we ' ll use the DURATION .
if ( dtEnd == null && deriveFromDuration && getStartDate ( ) != null ) { final DtStart dtStart = getStartDate ( ) ; final Duration vEventDuration ; if ( getDuration ( ) != null ) { vEventDuration = getDuration ( ) ; } else if ( dtStart . getDate ( ) instanceof DateTime ) { // If " DTSTART " is a DATE - TIME , then the event ' s duration is zero ( see : RFC 5545 , 3.6.1 Event Component )
vEventDuration = new Duration ( java . time . Duration . ZERO ) ; } else { // If " DTSTART " is a DATE , then the event ' s duration is one day ( see : RFC 5545 , 3.6.1 Event Component )
vEventDuration = new Duration ( java . time . Duration . ofDays ( 1 ) ) ; } dtEnd = new DtEnd ( Dates . getInstance ( Date . from ( dtStart . getDate ( ) . toInstant ( ) . plus ( vEventDuration . getDuration ( ) ) ) , dtStart . getParameter ( Parameter . VALUE ) ) ) ; if ( dtStart . isUtc ( ) ) { dtEnd . setUtc ( true ) ; } else { dtEnd . setTimeZone ( dtStart . getTimeZone ( ) ) ; } } return dtEnd ; |
public class CreateTaskRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CreateTaskRequest createTaskRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( createTaskRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createTaskRequest . getSourceLocationArn ( ) , SOURCELOCATIONARN_BINDING ) ; protocolMarshaller . marshall ( createTaskRequest . getDestinationLocationArn ( ) , DESTINATIONLOCATIONARN_BINDING ) ; protocolMarshaller . marshall ( createTaskRequest . getCloudWatchLogGroupArn ( ) , CLOUDWATCHLOGGROUPARN_BINDING ) ; protocolMarshaller . marshall ( createTaskRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( createTaskRequest . getOptions ( ) , OPTIONS_BINDING ) ; protocolMarshaller . marshall ( createTaskRequest . getTags ( ) , TAGS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class GenericsUtils { /** * for TypeVariableUtils access */
@ SuppressWarnings ( { } } | "PMD.AvoidProtectedMethodInFinalClassNotExtending" , "PMD.CyclomaticComplexity" , "checkstyle:CyclomaticComplexity" } ) protected static Type resolveTypeVariables ( final Type type , final Map < String , Type > generics , final boolean countPreservedVariables ) { Type resolvedGenericType = null ; if ( type instanceof TypeVariable ) { // simple named generics resolved to target types
resolvedGenericType = declaredGeneric ( ( TypeVariable ) type , generics ) ; } else if ( type instanceof ExplicitTypeVariable ) { // special type used to preserve named generic ( and differentiate from type variable )
resolvedGenericType = declaredGeneric ( ( ExplicitTypeVariable ) type , generics , countPreservedVariables ) ; } else if ( type instanceof Class ) { resolvedGenericType = type ; } else if ( type instanceof ParameterizedType ) { // here parameterized type could shrink to class ( if it has no arguments and owner class )
resolvedGenericType = resolveParameterizedTypeVariables ( ( ParameterizedType ) type , generics , countPreservedVariables ) ; } else if ( type instanceof GenericArrayType ) { // here generic array could shrink to array class ( if component type shrink to simple class )
resolvedGenericType = resolveGenericArrayTypeVariables ( ( GenericArrayType ) type , generics , countPreservedVariables ) ; } else if ( type instanceof WildcardType ) { // here wildcard could shrink to upper type ( if it has only one upper type )
resolvedGenericType = resolveWildcardTypeVariables ( ( WildcardType ) type , generics , countPreservedVariables ) ; } return resolvedGenericType ; |
public class BootstrapTools { /** * Parse the dynamic properties ( passed on the command line ) . */
public static Configuration parseDynamicProperties ( CommandLine cmd ) { } } | final Configuration config = new Configuration ( ) ; String [ ] values = cmd . getOptionValues ( DYNAMIC_PROPERTIES_OPT ) ; if ( values != null ) { for ( String value : values ) { String [ ] pair = value . split ( "=" , 2 ) ; if ( pair . length == 1 ) { config . setString ( pair [ 0 ] , Boolean . TRUE . toString ( ) ) ; } else if ( pair . length == 2 ) { config . setString ( pair [ 0 ] , pair [ 1 ] ) ; } } } return config ; |
public class ClassPathResource { /** * Returns URL of the requested resource
* @ return URL of the resource , if it ' s available in current Jar */
private URL getUrl ( ) { } } | ClassLoader loader = null ; try { loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; } catch ( Exception e ) { // do nothing
} if ( loader == null ) { loader = ClassPathResource . class . getClassLoader ( ) ; } URL url = loader . getResource ( this . resourceName ) ; if ( url == null ) { // try to check for mis - used starting slash
// TODO : see TODO below
if ( this . resourceName . startsWith ( "/" ) ) { url = loader . getResource ( this . resourceName . replaceFirst ( "[\\\\/]" , "" ) ) ; if ( url != null ) return url ; } else { // try to add slash , to make clear it ' s not an issue
// TODO : change this mechanic to actual path purifier
url = loader . getResource ( "/" + this . resourceName ) ; if ( url != null ) return url ; } throw new IllegalStateException ( "Resource '" + this . resourceName + "' cannot be found." ) ; } return url ; |
public class JmesPathCodeGenVisitor { /** * Generates the code for a new JmesPathMultiSelectList .
* @ param multiSelectList JmesPath multiSelectList type
* @ param aVoid void
* @ return String that represents a call to
* the new multiSelectList
* @ throws InvalidTypeException */
@ Override public String visit ( final JmesPathMultiSelectList multiSelectList , final Void aVoid ) throws InvalidTypeException { } } | final String prefix = "new JmesPathMultiSelectList( " ; return multiSelectList . getExpressions ( ) . stream ( ) . map ( a -> a . accept ( this , aVoid ) ) . collect ( Collectors . joining ( "," , prefix , ")" ) ) ; |
public class CmsDefaultLinkSubstitutionHandler { /** * Returns the root path for given site . < p >
* This method is required as a hook used in { @ link CmsLocalePrefixLinkSubstitutionHandler } . < p >
* @ param cms the cms context
* @ param path the path
* @ param siteRoot the site root , will be null in case of the root site
* @ param isRootPath in case the path is already a root path
* @ return the root path */
protected String getRootPathForSite ( CmsObject cms , String path , String siteRoot , boolean isRootPath ) { } } | if ( isRootPath || ( siteRoot == null ) ) { return CmsStringUtil . joinPaths ( "/" , path ) ; } else { return cms . getRequestContext ( ) . addSiteRoot ( siteRoot , path ) ; } |
public class DiagnosticsInner { /** * List Site Detector Responses .
* List Site Detector Responses .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the PagedList & lt ; DetectorResponseInner & gt ; object if successful . */
public PagedList < DetectorResponseInner > listSiteDetectorResponsesNext ( final String nextPageLink ) { } } | ServiceResponse < Page < DetectorResponseInner > > response = listSiteDetectorResponsesNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) ; return new PagedList < DetectorResponseInner > ( response . body ( ) ) { @ Override public Page < DetectorResponseInner > nextPage ( String nextPageLink ) { return listSiteDetectorResponsesNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) . body ( ) ; } } ; |
public class EsperBolt { /** * { @ inheritDoc }
* @ param newEvents
* @ param oldEvents */
@ Override public void update ( EventBean [ ] newEvents , EventBean [ ] oldEvents ) { } } | if ( newEvents == null ) { return ; } for ( EventBean newEvent : newEvents ) { List < Object > tuple = new ArrayList < > ( ) ; String eventType ; if ( outputTypes . containsKey ( newEvent . getEventType ( ) . getName ( ) ) ) { eventType = newEvent . getEventType ( ) . getName ( ) ; for ( String field : outputTypes . get ( newEvent . getEventType ( ) . getName ( ) ) ) { if ( newEvent . get ( field ) != null ) { tuple . add ( newEvent . get ( field ) ) ; } } } else { eventType = "default" ; for ( String field : newEvent . getEventType ( ) . getPropertyNames ( ) ) { tuple . add ( newEvent . get ( field ) ) ; } } collector . emit ( eventType , tuple ) ; } |
public class ManagedPropertiesFactory { /** * Registers a configuration backed by the Configuration Admin . When this method is called , a { @ link Proxy } object is created based on the { @ code type }
* provided to the method . The configuration is automatically registered as a { @ link org . osgi . service . cm . ManagedService } and { @ link org . osgi . service . metatype . MetaTypeProvider } .
* The configuration can also be created with a Defaults object . In order to create a Defaults object , implement the Interface provided by { @ code type }
* and supplying an instance of that class to { @ code defaults } . { @ code defaults } may be null .
* * Example :
* SomeInterface properties = ManagedPropertiesFactory . register ( SomeInterface . class , new SomeInterfaceImpl ( ) , context ) ;
* @ param < I > The return type ofs the configuration .
* @ param < T > The return type of the default .
* @ param type The type of configuration to create . The type of interface must be be annotated by
* { @ link dk . netdesign . common . osgi . config . annotation . Property } , and each parameter must be annotated by
* { @ link dk . netdesign . common . osgi . config . annotation . PropertyDefinition }
* @ param defaults The defaults object to create . When a configuration item is not found in the Configuration Admin , the defaults method is called .
* @ return A proxy representing a Configuration Admin configuration .
* @ throws InvalidTypeException If a method / configuration item mapping uses an invalid type .
* @ throws TypeFilterException If a method / configuration item mapping uses an invalid TypeMapper .
* @ throws DoubleIDException If a method / configuration item mapping uses an ID that is already defined .
* @ throws InvalidMethodException If a method / configuration violates any restriction not defined in the other exceptions . */
public synchronized < I , T extends I > I register ( Class < I > type , T defaults ) throws InvalidTypeException , TypeFilterException , DoubleIDException , InvalidMethodException , InvocationException , ControllerPersistenceException { } } | ManagedPropertiesController controller = null ; if ( ! type . isInterface ( ) ) { throw new InvalidTypeException ( "Could not register the type " + type . getName ( ) + " as a Managed Property. The type must be an interface" ) ; } if ( persistenceProvider != null ) { controller = persistenceProvider . getController ( type ) ; } if ( controller == null ) { ArrayList < Class < ? extends TypeFilter > > filters = new ArrayList < > ( ) ; if ( filterProvider != null ) { filters . addAll ( filterProvider . getFilters ( ) ) ; } controller = getInvocationHandler ( type , defaults , filters ) ; ManagedPropertiesProvider provider = handlerFactory . getProvider ( type , controller , defaults ) ; validateInputTypesWithProvider ( provider , controller . getAttributes ( ) , filters ) ; try { provider . start ( ) ; } catch ( Exception ex ) { throw new InvocationException ( "Could not start provider: " + provider , ex ) ; } controller . setProvider ( provider ) ; if ( persistenceProvider != null ) { persistenceProvider . persistController ( type , controller ) ; } logger . info ( "Registered " + controller ) ; } return castToProxy ( type , controller ) ; |
public class ConnectivityStateInfo { /** * Returns an instance for { @ code TRANSIENT _ FAILURE } , associated with an error status . */
public static ConnectivityStateInfo forTransientFailure ( Status error ) { } } | Preconditions . checkArgument ( ! error . isOk ( ) , "The error status must not be OK" ) ; return new ConnectivityStateInfo ( TRANSIENT_FAILURE , error ) ; |
public class RegisteredResources { /** * Distributes forget messages to all Resources in
* the appropriate state . Called during retry and mainline .
* @ return boolean value to indicate whether retries are necessary . */
public boolean distributeForget ( ) throws SystemException { } } | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "distributeForget" , this ) ; boolean retryRequired = false ; // indicates whether retry necessary
final int resourceCount = _resourceObjects . size ( ) ; // Browse through the participants , processing them as appropriate
for ( int i = 0 ; i < resourceCount ; i ++ ) { final JTAResource currResource = _resourceObjects . get ( i ) ; switch ( currResource . getResourceStatus ( ) ) { case StatefulResource . HEURISTIC_COMMIT : case StatefulResource . HEURISTIC_ROLLBACK : case StatefulResource . HEURISTIC_MIXED : case StatefulResource . HEURISTIC_HAZARD : if ( forgetResource ( currResource ) ) { retryRequired = true ; _retryRequired = true ; } break ; default : // do nothing
break ; } // end switch
} // end for
if ( _systemException != null ) { final Throwable toThrow = new SystemException ( ) . initCause ( _systemException ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "distributeForget" , toThrow ) ; throw ( SystemException ) toThrow ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "distributeForget" , retryRequired ) ; return retryRequired ; |
public class Reflector { /** * to invoke a setter Method of a Object
* @ param obj Object to invoke method from
* @ param prop Name of the Method without get
* @ param value Value to set to the Method
* @ return MethodInstance
* @ throws NoSuchMethodException
* @ throws PageException */
public static MethodInstance getSetter ( Object obj , String prop , Object value ) throws NoSuchMethodException { } } | prop = "set" + StringUtil . ucFirst ( prop ) ; MethodInstance mi = getMethodInstance ( obj , obj . getClass ( ) , prop , new Object [ ] { value } ) ; Method m = mi . getMethod ( ) ; if ( m . getReturnType ( ) != void . class ) throw new NoSuchMethodException ( "invalid return Type, method [" + m . getName ( ) + "] must have return type void, now [" + m . getReturnType ( ) . getName ( ) + "]" ) ; return mi ; |
public class VarExporter { /** * Export all public fields and methods of a given object instance , including static fields , that are annotated
* with { @ link com . indeed . util . varexport . Export } . Also finds annotation on interfaces .
* @ param obj object instance to export
* @ param prefix prefix for variable names ( e . g . " mywidget - " ) */
public void export ( Object obj , String prefix ) { } } | checkTypeCompatibility ( obj . getClass ( ) ) ; final boolean isNamespaceClassSet = namespaceClass != null ; final Class c = isNamespaceClassSet ? namespaceClass : obj . getClass ( ) ; for ( final Field field : ( declaredFieldsOnly ? c . getDeclaredFields ( ) : c . getFields ( ) ) ) { Export export = field . getAnnotation ( Export . class ) ; if ( Modifier . isStatic ( field . getModifiers ( ) ) ) { loadMemberVariable ( field , export , c , true , prefix , null ) ; } else { loadMemberVariable ( field , export , obj , true , prefix , null ) ; } } Set < Class < ? > > classAndInterfaces = Sets . newHashSet ( ) ; getAllInterfaces ( c , classAndInterfaces ) ; classAndInterfaces . add ( c ) ; for ( Class < ? > cls : classAndInterfaces ) { for ( final Method method : ( declaredFieldsOnly ? cls . getDeclaredMethods ( ) : cls . getMethods ( ) ) ) { Export export = method . getAnnotation ( Export . class ) ; if ( Modifier . isStatic ( method . getModifiers ( ) ) ) { loadMemberVariable ( method , export , c , true , prefix , null ) ; } else { loadMemberVariable ( method , export , obj , true , prefix , null ) ; } } } |
public class HashUserRealm { /** * Put user into realm .
* @ param name User name
* @ param credentials String password , Password or UserPrinciple
* instance .
* @ return Old UserPrinciple value or null */
public synchronized Object put ( Object name , Object credentials ) { } } | if ( credentials instanceof Principal ) return super . put ( name . toString ( ) , credentials ) ; if ( credentials instanceof Password ) return super . put ( name , new KnownUser ( name . toString ( ) , ( Password ) credentials ) ) ; if ( credentials != null ) return super . put ( name , new KnownUser ( name . toString ( ) , Credential . getCredential ( credentials . toString ( ) ) ) ) ; return null ; |
public class DefaultSerializationProviderConfiguration { /** * Adds a new { @ link Serializer } mapping for the class { @ code serializableClass }
* @ param serializableClass the { @ code Class } to add the mapping for
* @ param serializerClass the { @ link Serializer } type to use
* @ param < T > the type of instances to be serialized / deserialized
* @ return this configuration object
* @ throws NullPointerException if any argument is null
* @ throws IllegalArgumentException if a mapping for { @ code serializableClass } already exists */
public < T > DefaultSerializationProviderConfiguration addSerializerFor ( Class < T > serializableClass , Class < ? extends Serializer < T > > serializerClass ) { } } | return addSerializerFor ( serializableClass , serializerClass , false ) ; |
public class Activator { /** * { @ inheritDoc } */
public final void start ( BundleContext context ) throws Exception { } } | serviceRegistration = context . registerService ( ProxyTargetLocatorFactory . class , new SpringDMProxyTargetLocatorFactory ( ) , null ) ; LOGGER . info ( "registered Spring DM injection SPI for PAX Wicket." ) ; |
public class RegularEnumSet { /** * Adds the specified element to this set if it is not already present .
* @ param e element to be added to this set
* @ return < tt > true < / tt > if the set changed as a result of the call
* @ throws NullPointerException if < tt > e < / tt > is null */
public boolean add ( E e ) { } } | typeCheck ( e ) ; long oldElements = elements ; elements |= ( 1L << ( ( Enum < ? > ) e ) . ordinal ( ) ) ; return elements != oldElements ; |
public class ScimV1PrincipalProvisioner { /** * Create user resource boolean .
* @ param p the p
* @ param credential the credential
* @ return the boolean */
@ SneakyThrows protected boolean createUserResource ( final Principal p , final Credential credential ) { } } | val user = new UserResource ( CoreSchema . USER_DESCRIPTOR ) ; this . mapper . map ( user , p , credential ) ; return endpoint . create ( user ) != null ; |
public class SvgGraphicsContext { /** * Delete this element from the graphics DOM structure .
* @ param parent
* parent group object
* @ param name
* The element ' s name . */
public void deleteElement ( Object parent , String name ) { } } | if ( isAttached ( ) ) { helper . deleteElement ( parent , name ) ; } |
public class SiblingsIssueMerger { /** * Look for all unclosed issues in branches / PR targeting the same long living branch , and run
* a light issue tracking to find matches . Then merge issue attributes in the new issues . */
public void tryMerge ( Component component , Collection < DefaultIssue > newIssues ) { } } | Collection < SiblingIssue > siblingIssues = siblingsIssuesLoader . loadCandidateSiblingIssuesForMerging ( component ) ; Tracking < DefaultIssue , SiblingIssue > tracking = tracker . track ( newIssues , siblingIssues ) ; Map < DefaultIssue , SiblingIssue > matchedRaws = tracking . getMatchedRaws ( ) ; Map < SiblingIssue , DefaultIssue > defaultIssues = siblingsIssuesLoader . loadDefaultIssuesWithChanges ( matchedRaws . values ( ) ) ; for ( Map . Entry < DefaultIssue , SiblingIssue > e : matchedRaws . entrySet ( ) ) { SiblingIssue issue = e . getValue ( ) ; issueLifecycle . mergeConfirmedOrResolvedFromShortLivingBranchOrPr ( e . getKey ( ) , defaultIssues . get ( issue ) , issue . getBranchType ( ) , issue . getBranchKey ( ) ) ; } |
public class ServletContextService { /** * Obtains the { @ link ServletContext } associated with this request .
* @ return the ServletContext associated with this request or null if there is no such association */
public ServletContext getCurrentServletContext ( ) { } } | final ClassLoader cl = getContextClassLoader ( ) ; if ( cl == null ) { return null ; } return servletContexts . get ( cl ) ; |
public class LoganSquare { /** * Register a new TypeConverter for parsing and serialization .
* @ param cls The class for which the TypeConverter should be used .
* @ param converter The TypeConverter */
public static < E > void registerTypeConverter ( Class < E > cls , TypeConverter < E > converter ) { } } | TYPE_CONVERTERS . put ( cls , converter ) ; |
public class AnnotationClassReader { /** * Reads an UTF8 string constant pool item in { @ link # b b } . < i > This method
* is intended for { @ link Attribute } sub classes , and is normally not needed
* by class generators or adapters . < / i >
* @ param index the start index of an unsigned short value in { @ link # b b } ,
* whose value is the index of an UTF8 constant pool item .
* @ param buf buffer to be used to read the item . This buffer must be
* sufficiently large . It is not automatically resized .
* @ return the String corresponding to the specified UTF8 item . */
public String readUTF8 ( int index , final char [ ] buf ) { } } | int item = readUnsignedShort ( index ) ; if ( index == 0 || item == 0 ) { return null ; } String s = strings [ item ] ; if ( s != null ) { return s ; } index = items [ item ] ; strings [ item ] = readUTF ( index + 2 , readUnsignedShort ( index ) , buf ) ; return strings [ item ] ; |
public class Version { /** * < pre >
* Custom static error pages . Limited to 10KB per page .
* Only returned in ` GET ` requests if ` view = FULL ` is set .
* < / pre >
* < code > repeated . google . appengine . v1 . ErrorHandler error _ handlers = 101 ; < / code > */
public java . util . List < com . google . appengine . v1 . ErrorHandler > getErrorHandlersList ( ) { } } | return errorHandlers_ ; |
public class Jdt2Ecore { /** * Create the JvmOperation for the given JDT method .
* @ param method the JDT method .
* @ param context the context of the constructor .
* @ return the JvmOperation
* @ throws JavaModelException if the Java model is invalid . */
private JvmOperation getJvmOperation ( IMethod method , JvmType context ) throws JavaModelException { } } | if ( context instanceof JvmDeclaredType ) { final JvmDeclaredType declaredType = ( JvmDeclaredType ) context ; final ActionParameterTypes jdtSignature = this . actionPrototypeProvider . createParameterTypes ( Flags . isVarargs ( method . getFlags ( ) ) , getFormalParameterProvider ( method ) ) ; for ( final JvmOperation jvmOperation : declaredType . getDeclaredOperations ( ) ) { final ActionParameterTypes jvmSignature = this . actionPrototypeProvider . createParameterTypesFromJvmModel ( jvmOperation . isVarArgs ( ) , jvmOperation . getParameters ( ) ) ; if ( jvmSignature . equals ( jdtSignature ) ) { return jvmOperation ; } } } return null ; |
public class EstimateKeywordTraffic { /** * Returns a formatted version of { @ code mean } , handling nulls . */
private static String formatMean ( Double mean ) { } } | if ( mean == null ) { // Handle nulls separately , else the % . 2f format below will
// truncate ' null ' to ' nu ' .
return null ; } return String . format ( "%.2f" , mean ) ; |
public class CpuEventViewer { /** * Bus Messages */
public void drawMessageCompleted ( GenericTabItem tab , TraceCPU cpu , TraceThread thread , TraceBus bus , TraceOperation op , TraceObject obj ) { } } | updateObject ( tab , obj ) ; Long busX = bus . getX ( ) ; String toolTipLabel = op . getName ( ) ; Long objX = obj . getX ( ) ; // Draw Bus Marker
drawMarker ( tab , busX , tab . getYMax ( ) , busX , tab . getYMax ( ) + ELEMENT_SIZE , ColorConstants . darkGray ) ; // Draw Message Arrow
drawHorizontalArrow ( tab , busX + BUSMSG_ARROW_OFFSET , objX - BUSMSG_ARROW_OFFSET , tab . getYMax ( ) , " " , toolTipLabel , ColorConstants . darkGreen ) ; |
public class RuleCallImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case XtextPackage . RULE_CALL__RULE : setRule ( ( AbstractRule ) null ) ; return ; case XtextPackage . RULE_CALL__ARGUMENTS : getArguments ( ) . clear ( ) ; return ; case XtextPackage . RULE_CALL__EXPLICITLY_CALLED : setExplicitlyCalled ( EXPLICITLY_CALLED_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ; |
public class AnyWordStartsWithFilter { /** * Return < tt > true < / tt > if the specified value matches this filter .
* TODO : javadoc */
protected boolean isMatch ( String [ ] words , String filter ) { } } | for ( String word : words ) { int len = filter . length ( ) ; if ( word . regionMatches ( ignoreCase , 0 , filter , 0 , len ) ) { return true ; } } return false ; |
public class BigDecimal { /** * Returns a { @ code BigDecimal } whose value is { @ code ( this + augend ) } ,
* with rounding according to the context settings .
* If either number is zero and the precision setting is nonzero then
* the other number , rounded if necessary , is used as the result .
* @ param augend value to be added to this { @ code BigDecimal } .
* @ param mc the context to use .
* @ return { @ code this + augend } , rounded as necessary .
* @ throws ArithmeticException if the result is inexact but the
* rounding mode is { @ code UNNECESSARY } .
* @ since 1.5 */
public BigDecimal add ( BigDecimal augend , MathContext mc ) { } } | if ( mc . precision == 0 ) return add ( augend ) ; BigDecimal lhs = this ; // If either number is zero then the other number , rounded and
// scaled if necessary , is used as the result .
{ boolean lhsIsZero = lhs . signum ( ) == 0 ; boolean augendIsZero = augend . signum ( ) == 0 ; if ( lhsIsZero || augendIsZero ) { int preferredScale = Math . max ( lhs . scale ( ) , augend . scale ( ) ) ; BigDecimal result ; if ( lhsIsZero && augendIsZero ) return zeroValueOf ( preferredScale ) ; result = lhsIsZero ? doRound ( augend , mc ) : doRound ( lhs , mc ) ; if ( result . scale ( ) == preferredScale ) return result ; else if ( result . scale ( ) > preferredScale ) { return stripZerosToMatchScale ( result . intVal , result . intCompact , result . scale , preferredScale ) ; } else { // result . scale < preferredScale
int precisionDiff = mc . precision - result . precision ( ) ; int scaleDiff = preferredScale - result . scale ( ) ; if ( precisionDiff >= scaleDiff ) return result . setScale ( preferredScale ) ; // can achieve target scale
else return result . setScale ( result . scale ( ) + precisionDiff ) ; } } } long padding = ( long ) lhs . scale - augend . scale ; if ( padding != 0 ) { // scales differ ; alignment needed
BigDecimal arg [ ] = preAlign ( lhs , augend , padding , mc ) ; matchScale ( arg ) ; lhs = arg [ 0 ] ; augend = arg [ 1 ] ; } return doRound ( lhs . inflated ( ) . add ( augend . inflated ( ) ) , lhs . scale , mc ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.