signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class DiffTool { /** * Starts the DiffTool application .
* @ param args
* program arguments args [ 0 ] has to be the path to the
* configuration file */
public static void main ( final String [ ] args ) { } }
|
if ( args . length != 1 ) { throw new IllegalArgumentException ( "Configuration File ist missing." ) ; } try { // Reads the configuration
ConfigSettings config = readConfiguration ( args [ 0 ] ) ; new DiffToolThread ( config ) . run ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; }
|
public class Event { /** * indexed setter for causes _ event - sets an indexed value -
* @ generated
* @ param i index in the array to set
* @ param v value to set into the array */
public void setCauses_event ( int i , Event v ) { } }
|
if ( Event_Type . featOkTst && ( ( Event_Type ) jcasType ) . casFeat_causes_event == null ) jcasType . jcas . throwFeatMissing ( "causes_event" , "ch.epfl.bbp.uima.genia.Event" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Event_Type ) jcasType ) . casFeatCode_causes_event ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Event_Type ) jcasType ) . casFeatCode_causes_event ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ;
|
public class EntryInformationImpl { /** * Defined by the ROME module API
* @ param obj Object to copy from */
@ Override public void copyFrom ( final CopyFrom obj ) { } }
|
final EntryInformationImpl info = ( EntryInformationImpl ) obj ; setAuthor ( info . getAuthor ( ) ) ; setBlock ( info . getBlock ( ) ) ; if ( info . getDuration ( ) != null ) { setDuration ( new Duration ( info . getDuration ( ) . getMilliseconds ( ) ) ) ; } setExplicit ( info . getExplicit ( ) ) ; try { if ( info . getImage ( ) != null ) { setImage ( new URL ( info . getImage ( ) . toExternalForm ( ) ) ) ; } } catch ( final MalformedURLException e ) { LOG . debug ( "Error copying URL:" + info . getImage ( ) , e ) ; } if ( info . getKeywords ( ) != null ) { setKeywords ( info . getKeywords ( ) . clone ( ) ) ; } setSubtitle ( info . getSubtitle ( ) ) ; setSummary ( info . getSummary ( ) ) ; setClosedCaptioned ( info . getClosedCaptioned ( ) ) ; setOrder ( info . getOrder ( ) ) ;
|
public class BatchDeleteBuildsResult { /** * The IDs of the builds that were successfully deleted .
* @ param buildsDeleted
* The IDs of the builds that were successfully deleted . */
public void setBuildsDeleted ( java . util . Collection < String > buildsDeleted ) { } }
|
if ( buildsDeleted == null ) { this . buildsDeleted = null ; return ; } this . buildsDeleted = new java . util . ArrayList < String > ( buildsDeleted ) ;
|
public class UISlot { /** * Updates the { @ link UITooltip } of this { @ link UISlot } based on the contained ItemStack . < br >
* If no ItemStack is present in slot , revert the tooltip back to default one . */
protected void updateTooltip ( ) { } }
|
if ( slot . getItemStack ( ) . isEmpty ( ) ) { tooltip = defaultTooltip ; return ; } List < String > lines = slot . getItemStack ( ) . getTooltip ( Utils . getClientPlayer ( ) , Minecraft . getMinecraft ( ) . gameSettings . advancedItemTooltips ? ITooltipFlag . TooltipFlags . ADVANCED : ITooltipFlag . TooltipFlags . NORMAL ) ; String text = lines . stream ( ) . collect ( Collectors . joining ( TextFormatting . RESET + "\n" + TextFormatting . GRAY ) ) ; // lines . set ( 0 , slot . getItemStack ( ) . getRarity ( ) . rarityColor + lines . get ( 0 ) ) ;
// for ( int i = 1 ; i < lines . size ( ) ; i + + )
// lines . set ( i , TextFormatting . GRAY + lines . get ( i ) ) ;
tooltip = new UITooltip ( slot . getItemStack ( ) . getRarity ( ) . rarityColor + text ) ;
|
public class RepositoryDataTask { /** * Reads a single schema file .
* @ param reader The schema reader
* @ param schemaFile The schema file
* @ return The model */
private Database readSingleSchemaFile ( DatabaseIO reader , File schemaFile ) { } }
|
Database model = null ; if ( ! schemaFile . isFile ( ) ) { log ( "Path " + schemaFile . getAbsolutePath ( ) + " does not denote a schema file" , Project . MSG_ERR ) ; } else if ( ! schemaFile . canRead ( ) ) { log ( "Could not read schema file " + schemaFile . getAbsolutePath ( ) , Project . MSG_ERR ) ; } else { try { model = reader . read ( schemaFile ) ; log ( "Read schema file " + schemaFile . getAbsolutePath ( ) , Project . MSG_INFO ) ; } catch ( Exception ex ) { throw new BuildException ( "Could not read schema file " + schemaFile . getAbsolutePath ( ) + ": " + ex . getLocalizedMessage ( ) , ex ) ; } } return model ;
|
public class ImageProxy { /** * Returns an ImageData object that can be used for further image processing
* e . g . by image filters .
* @ return ImageData */
public ImageData getImageData ( ) { } }
|
if ( false == isLoaded ( ) ) { return null ; } if ( m_fastout ) { final ScratchPad temp = new ScratchPad ( m_dest_wide , m_dest_high ) ; temp . getContext ( ) . drawImage ( m_jsimg , m_clip_xpos , m_clip_ypos , m_clip_wide , m_clip_high , 0 , 0 , m_dest_wide , m_dest_high ) ; return temp . getContext ( ) . getImageData ( 0 , 0 , m_dest_wide , m_dest_high ) ; } else { return m_filterImage . getContext ( ) . getImageData ( 0 , 0 , m_dest_wide , m_dest_high ) ; }
|
public class RegistriesInner { /** * Creates a new build based on the request parameters and add it to the build queue .
* @ param resourceGroupName The name of the resource group to which the container registry belongs .
* @ param registryName The name of the container registry .
* @ param buildRequest The parameters of a build that needs to queued .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the BuildInner object */
public Observable < BuildInner > beginQueueBuildAsync ( String resourceGroupName , String registryName , QueueBuildRequest buildRequest ) { } }
|
return beginQueueBuildWithServiceResponseAsync ( resourceGroupName , registryName , buildRequest ) . map ( new Func1 < ServiceResponse < BuildInner > , BuildInner > ( ) { @ Override public BuildInner call ( ServiceResponse < BuildInner > response ) { return response . body ( ) ; } } ) ;
|
public class SpiServiceLoader { /** * Create a new instance of the found Service . < br / >
* Verifies that the found ServiceImpl implements Service .
* @ param < T >
* @ param serviceType The Service interface
* @ param className The name of the implementation class
* @ param loader The ClassLoader to load the ServiceImpl from
* @ return A new instance of the ServiceImpl
* @ throws Exception If problems creating a new instance */
private < T > T createInstance ( final Class < T > implClass ) { } }
|
{ // Get the constructor to use in making the new instance
final Constructor < ? extends T > ctor ; try { ctor = SecurityActions . getConstructor ( implClass , new Class < ? > [ ] { } ) ; } catch ( final NoSuchMethodException nsme ) { throw new RuntimeException ( implClass + " must contain a public no args contructor" ) ; } // Create a new instance using the backing model
final T instance ; try { instance = ctor . newInstance ( ) ; } // Handle all construction errors equally
catch ( final Exception e ) { throw new RuntimeException ( "Could not create new service instance" , e ) ; } // Return
return implClass . cast ( instance ) ; }
|
public class ExcelDateUtil { /** * Given an Excel date with either 1900 or 1904 date windowing , converts it
* to a java . util . Date .
* @ param excelDate
* The Excel date .
* @ param use1904windowing
* true if date uses 1904 windowing , or false if using 1900 date
* windowing .
* @ return Java representation of the date without any time .
* @ see java . util . TimeZone */
public static Calendar getJavaCalendar ( final double excelDate , final boolean use1904windowing ) { } }
|
if ( isValidExcelDate ( excelDate ) ) { int startYear = EXCEL_BASE_YEAR ; int dayAdjust = - 1 ; // Excel thinks 2/29/1900 is a valid date , which
// it isn ' t
final int wholeDays = ( int ) Math . floor ( excelDate ) ; if ( use1904windowing ) { startYear = EXCEL_WINDOWING_1904 ; dayAdjust = 1 ; // 1904 date windowing uses 1/2/1904 as the
// first day
} else if ( wholeDays < EXCEL_FUDGE_19000229 ) { // Date is prior to 3/1/1900 , so adjust because Excel thinks
// 2/29/1900 exists
// If Excel date = = 2/29/1900 , will become 3/1/1900 in Java
// representation
dayAdjust = 0 ; } final GregorianCalendar calendar = new GregorianCalendar ( startYear , 0 , wholeDays + dayAdjust ) ; final int millisecondsInDay = ( int ) ( ( excelDate - Math . floor ( excelDate ) ) * DAY_MILLISECONDS + HALF_MILLISEC ) ; calendar . set ( Calendar . MILLISECOND , millisecondsInDay ) ; return calendar ; } else { return null ; }
|
public class GeneratedDi18nDaoImpl { /** * query - by method for field updatedDate
* @ param updatedDate the specified attribute
* @ return an Iterable of Di18ns for the specified updatedDate */
public Iterable < Di18n > queryByUpdatedDate ( java . util . Date updatedDate ) { } }
|
return queryByField ( null , Di18nMapper . Field . UPDATEDDATE . getFieldName ( ) , updatedDate ) ;
|
public class BeatFinder { /** * Send a sync command to all registered listeners .
* @ param command the byte which identifies the type of sync command we received */
private void deliverSyncCommand ( byte command ) { } }
|
for ( final SyncListener listener : getSyncListeners ( ) ) { try { switch ( command ) { case 0x01 : listener . becomeMaster ( ) ; case 0x10 : listener . setSyncMode ( true ) ; break ; case 0x20 : listener . setSyncMode ( false ) ; break ; } } catch ( Throwable t ) { logger . warn ( "Problem delivering sync command to listener" , t ) ; } }
|
public class MobicentsSipServletsEmbeddedImpl { /** * / * ( non - Javadoc )
* @ see org . jboss . arquillian . container . mobicents . servlet . sip . embedded _ 1 . MobicentsSipServletsEmbedded # addConnector ( org . apache . catalina . connector . Connector ) */
@ Override public synchronized void addConnector ( Connector connector ) { } }
|
if ( log . isDebugEnabled ( ) ) { log . debug ( "Adding connector (" + connector . getInfo ( ) + ")" ) ; } // Make sure we have a Container to send requests to
if ( engines . length < 1 ) throw new IllegalStateException ( sm . getString ( "embedded.noEngines" ) ) ; /* * Add the connector . This will set the connector ' s container to the
* most recently added Engine */
service . addConnector ( connector ) ;
|
public class PGtokenizer { /** * This removes the lead / trailing strings from all tokens .
* @ param l Leading string to remove
* @ param t Trailing string to remove */
public void remove ( String l , String t ) { } }
|
for ( int i = 0 ; i < tokens . size ( ) ; i ++ ) { tokens . set ( i , remove ( tokens . get ( i ) , l , t ) ) ; }
|
public class NFGraph { /** * Retrieve a single connected ordinal in a given connection model , given the type and ordinal of the originating node , and the property by which this node is connected .
* @ return the connected ordinal , or - 1 if there is no such ordinal */
public int getConnection ( String connectionModel , String nodeType , int ordinal , String propertyName ) { } }
|
int connectionModelIndex = modelHolder . getModelIndex ( connectionModel ) ; return getConnection ( connectionModelIndex , nodeType , ordinal , propertyName ) ;
|
public class DatabaseService { /** * Defines parameter mappings . One parameter can be mapped to multiple new names , so a list is used instead of a map as the input to this method . */
public void setMappings ( List < String > mappings ) { } }
|
if ( mappings . size ( ) > 0 ) { @ SuppressWarnings ( "unchecked" ) Pair < String , String > [ ] renames = ( Pair < String , String > [ ] ) Array . newInstance ( Pair . class , mappings . size ( ) ) ; for ( int i = 0 ; i < _renames . length ; ++ i ) { String [ ] names = mappings . get ( i ) . split ( "[ ,]+" ) ; renames [ i ] = new Pair < String , String > ( names [ 0 ] , names [ 1 ] ) ; } _renames = renames ; }
|
public class Command { /** * Extract a DevULong data from a CORBA Any object .
* Remenber that the TANGO DevULong type is mapped to the java int type
* @ param in The CORBA Any object
* @ return The extracted boolean data
* @ exception DevFailed If the Any object does not contains a data of the
* waited type .
* Click < a href = " . . / . . / tango _ basic / idl _ html / Tango . html # DevFailed " > here < / a > to read
* < b > DevFailed < / b > exception specification */
public int extract_DevULong ( Any in ) throws DevFailed { } }
|
int data = 0 ; try { data = in . extract_ulong ( ) ; } catch ( BAD_OPERATION ex ) { throw_bad_type ( "DevULong" ) ; } return data ;
|
public class CommerceAddressPersistenceImpl { /** * Clears the cache for the commerce address .
* The { @ link EntityCache } and { @ link FinderCache } are both cleared by this method . */
@ Override public void clearCache ( CommerceAddress commerceAddress ) { } }
|
entityCache . removeResult ( CommerceAddressModelImpl . ENTITY_CACHE_ENABLED , CommerceAddressImpl . class , commerceAddress . getPrimaryKey ( ) ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ;
|
public class MemorizeTransactionProxy { /** * Wrap Statement with a proxy .
* @ param target statement handle
* @ param connectionHandle originating bonecp connection
* @ return Proxy to a statement . */
protected static Statement memorize ( final Statement target , final ConnectionHandle connectionHandle ) { } }
|
return ( Statement ) Proxy . newProxyInstance ( StatementProxy . class . getClassLoader ( ) , new Class [ ] { StatementProxy . class } , new MemorizeTransactionProxy ( target , connectionHandle ) ) ;
|
public class StateSaverImpl { /** * Save the state of the given view and the other state inside of the returned { @ link Parcelable } .
* @ param target The view containing fields annotated with { @ link State } .
* @ param state The super state of the parent class of the view . Usually it isn ' t { @ code null } .
* @ return A parcelable containing the view ' s state and its super state . */
@ NonNull /* package */
< T extends View > Parcelable saveInstanceState ( @ NonNull T target , @ Nullable Parcelable state ) { } }
|
Injector . View < T > injector = safeGet ( target , Injector . View . DEFAULT ) ; return injector . save ( target , state ) ;
|
public class GPX { /** * Create a new GPX builder with the given GPX version and creator string .
* @ param version the GPX version string
* @ param creator the GPX creator
* @ return new GPX builder
* @ throws NullPointerException if one of the arguments is { @ code null }
* @ deprecated Use { @ link # builder ( Version , String ) } instead . */
@ Deprecated public static Builder builder ( final String version , final String creator ) { } }
|
return new Builder ( Version . of ( version ) , creator ) ;
|
public class LeshanDeviceMetricsPollService { /** * Overridden */
@ Override public Object read ( String deviceId , String metric ) { } }
|
String translatedMetric = metricResolver . resolveMetric ( metric ) ; Client client = leshanServer . getClientRegistry ( ) . get ( deviceId ) ; ValueResponse leshanResponse = leshanServer . send ( client , new ReadRequest ( translatedMetric ) , 5000 ) ; if ( leshanResponse == null ) { return null ; } return ( ( LwM2mResource ) leshanResponse . getContent ( ) ) . getValue ( ) . value ;
|
public class AndPermission { /** * Has always been denied permission . */
private static boolean hasAlwaysDeniedPermission ( Source source , String ... deniedPermissions ) { } }
|
for ( String permission : deniedPermissions ) { if ( ! source . isShowRationalePermission ( permission ) ) { return true ; } } return false ;
|
public class InstanceClient { /** * Sets metadata for the specified instance to the data included in the request .
* < p > Sample code :
* < pre > < code >
* try ( InstanceClient instanceClient = InstanceClient . create ( ) ) {
* ProjectZoneInstanceName instance = ProjectZoneInstanceName . of ( " [ PROJECT ] " , " [ ZONE ] " , " [ INSTANCE ] " ) ;
* Metadata metadataResource = Metadata . newBuilder ( ) . build ( ) ;
* Operation response = instanceClient . setMetadataInstance ( instance . toString ( ) , metadataResource ) ;
* < / code > < / pre >
* @ param instance Name of the instance scoping this request .
* @ param metadataResource A metadata key / value entry .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final Operation setMetadataInstance ( String instance , Metadata metadataResource ) { } }
|
SetMetadataInstanceHttpRequest request = SetMetadataInstanceHttpRequest . newBuilder ( ) . setInstance ( instance ) . setMetadataResource ( metadataResource ) . build ( ) ; return setMetadataInstance ( request ) ;
|
public class JFeature { /** * Compares the name and type of the 2 features
* @ param f the feature to compare
* @ return true if name and type are the same , omits id */
public boolean sameFeature ( JFeature f ) { } }
|
return this . name . equals ( f . name ) && this . type . equals ( f . type ) ;
|
public class BDS { /** * Writes the BDS to the given file .
* @ param f The file to write the BDS to .
* @ see BDS # loadFromFile ( File ) */
public void writeToFile ( File f ) { } }
|
try ( FileOutputStream fos = new FileOutputStream ( f ) ) { fos . write ( write ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; }
|
public class RamlCompilerMojo { /** * { @ inheritDoc } */
@ Override public boolean fileDeleted ( File file ) throws WatchingException { } }
|
File theFile = getRamlOutputFile ( file ) ; FileUtils . deleteQuietly ( theFile ) ; return true ;
|
public class CounterShardData { /** * Create a { @ link Key Key < CounterShardData > } . Keys for this entity are not " parented " so that they can be added
* under high volume load in a given application . Note that CounterData will be in a namespace specific .
* @ param counterDataKey
* @ param shardNumber
* @ return */
public static Key < CounterShardData > key ( final Key < CounterData > counterDataKey , final int shardNumber ) { } }
|
// Preconditions checked by # constructCounterShardIdentifier
return Key . create ( CounterShardData . class , constructCounterShardIdentifier ( counterDataKey . getName ( ) , shardNumber ) ) ;
|
public class CmsDefaultXmlContentHandler { /** * Adds all needed default check rules recursively for the given schema type . < p >
* @ param rootContentDefinition the root content definition
* @ param schemaType the schema type to check
* @ param elementPath the current element path
* @ throws CmsXmlException if something goes wrong */
protected void addDefaultCheckRules ( CmsXmlContentDefinition rootContentDefinition , I_CmsXmlSchemaType schemaType , String elementPath ) throws CmsXmlException { } }
|
if ( ( schemaType != null ) && schemaType . isSimpleType ( ) ) { if ( ( schemaType . getMinOccurs ( ) == 0 ) && ( CmsXmlVfsFileValue . TYPE_NAME . equals ( schemaType . getTypeName ( ) ) || CmsXmlVarLinkValue . TYPE_NAME . equals ( schemaType . getTypeName ( ) ) ) && ! m_relationChecks . containsKey ( elementPath ) && ! m_relations . containsKey ( elementPath ) ) { // add default check rule for the element
addCheckRule ( rootContentDefinition , elementPath , null , null ) ; } } else { // recursion required
CmsXmlContentDefinition nestedContentDefinition = rootContentDefinition ; if ( schemaType != null ) { CmsXmlNestedContentDefinition nestedDefinition = ( CmsXmlNestedContentDefinition ) schemaType ; nestedContentDefinition = nestedDefinition . getNestedContentDefinition ( ) ; } Iterator < String > itElems = nestedContentDefinition . getSchemaTypes ( ) . iterator ( ) ; while ( itElems . hasNext ( ) ) { String element = itElems . next ( ) ; String path = ( schemaType != null ) ? CmsXmlUtils . concatXpath ( elementPath , element ) : element ; I_CmsXmlSchemaType nestedSchema = nestedContentDefinition . getSchemaType ( element ) ; if ( ( schemaType == null ) || ! nestedSchema . equals ( schemaType ) ) { addDefaultCheckRules ( rootContentDefinition , nestedSchema , path ) ; } } }
|
public class JSONs { /** * Read an expected double .
* @ param o the object to parse
* @ param id the key in the map that points to the double
* @ return the double
* @ throws JSONConverterException if the key does not point to a double */
public static double requiredDouble ( JSONObject o , String id ) throws JSONConverterException { } }
|
checkKeys ( o , id ) ; Object x = o . get ( id ) ; if ( ! ( x instanceof Number ) ) { throw new JSONConverterException ( "Number expected at key '" + id + "' but was '" + x . getClass ( ) + "'." ) ; } return ( ( Number ) x ) . doubleValue ( ) ;
|
public class DescribeTransformJobResult { /** * The environment variables to set in the Docker container . We support up to 16 key and values entries in the map .
* @ param environment
* The environment variables to set in the Docker container . We support up to 16 key and values entries in
* the map .
* @ return Returns a reference to this object so that method calls can be chained together . */
public DescribeTransformJobResult withEnvironment ( java . util . Map < String , String > environment ) { } }
|
setEnvironment ( environment ) ; return this ;
|
public class BugInstance { /** * Add a method annotation for the method which the given visitor is
* currently visiting . If the method has source line information , then a
* SourceLineAnnotation is added to the method .
* @ param visitor
* the BetterVisitor
* @ return this object */
@ Nonnull public BugInstance addMethod ( PreorderVisitor visitor ) { } }
|
MethodAnnotation methodAnnotation = MethodAnnotation . fromVisitedMethod ( visitor ) ; addMethod ( methodAnnotation ) ; addSourceLinesForMethod ( methodAnnotation , SourceLineAnnotation . fromVisitedMethod ( visitor ) ) ; return this ;
|
public class HttpBuilder { /** * Executes asynchronous PATCH request on the configured URI ( alias for the ` patch ( Class , Closure ) ` method ) , with additional configuration provided by
* the configuration closure . The result will be cast to the specified ` type ` .
* [ source , groovy ]
* def http = HttpBuilder . configure {
* request . uri = ' http : / / localhost : 10101'
* CompletableFuture future = http . patchAsync ( String ) {
* request . uri . path = ' / something '
* String result = future . get ( )
* The configuration ` closure ` allows additional configuration for this request based on the { @ link HttpConfig } interface .
* @ param type the type of the response content
* @ param closure the additional configuration closure ( delegated to { @ link HttpConfig } )
* @ return the { @ link CompletableFuture } for the resulting content cast to the specified type */
public < T > CompletableFuture < T > patchAsync ( final Class < T > type , @ DelegatesTo ( HttpConfig . class ) final Closure closure ) { } }
|
return CompletableFuture . supplyAsync ( ( ) -> patch ( type , closure ) , getExecutor ( ) ) ;
|
public class DataReader { /** * Recursively resolve a series of keys against a JSON object . This is used to
* drill down into a JSON object tree . */
private JsonObject resolve ( JsonObject node , String ... keys ) { } }
|
for ( String key : keys ) { JsonElement n = node . get ( key ) ; if ( n == null ) { return null ; } node = n . getAsJsonObject ( ) ; } return node ;
|
public class ID3v24Tag { /** * ' recording time ' ( TDRC ) replaces the deprecated frames ' TDAT - Date ' , ' TIME - Time ' ,
* ' TRDA - Recording dates ' and ' TYER - Year ' in 4.0 */
public String getRecordingTime ( ) { } }
|
ID3v2TextFrameData frameData = extractTextFrameData ( ID_RECTIME ) ; if ( frameData != null && frameData . getText ( ) != null ) return frameData . getText ( ) . toString ( ) ; return null ;
|
public class SrvWarehouseEntry { /** * < p > Reverse a withdrawal warehouse . < / p >
* @ param pAddParam additional param
* @ param pEntity movement
* @ throws Exception - an exception */
@ Override public final void reverseDraw ( final Map < String , Object > pAddParam , final IMakingWarehouseEntry pEntity ) throws Exception { } }
|
if ( ! pEntity . getIdDatabaseBirth ( ) . equals ( getSrvOrm ( ) . getIdDatabase ( ) ) ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "can_not_make_ws_entry_for_foreign_src" ) ; } if ( pEntity . getItsQuantity ( ) . doubleValue ( ) > 0 ) { throw new ExceptionWithCode ( ExceptionWithCode . SOMETHING_WRONG , "reversing_source_must_has_negative_quantity" ) ; } String tblNm = WarehouseEntry . class . getSimpleName ( ) . toUpperCase ( ) ; List < WarehouseEntry > wml = getSrvOrm ( ) . retrieveListWithConditions ( pAddParam , WarehouseEntry . class , "where SOURCETYPE=" + pEntity . constTypeCode ( ) + " and " + tblNm + ".IDDATABASEBIRTH=" + getSrvOrm ( ) . getIdDatabase ( ) + " and SOURCEID=" + pEntity . getReversedId ( ) + " and INVITEM=" + pEntity . getInvItem ( ) . getItsId ( ) + " and WAREHOUSESITEFROM is not null" ) ; BigDecimal quantityToLeaveRst = pEntity . getItsQuantity ( ) ; String langDef = ( String ) pAddParam . get ( "langDef" ) ; DateFormat dateFormat = DateFormat . getDateTimeInstance ( DateFormat . MEDIUM , DateFormat . SHORT , new Locale ( langDef ) ) ; for ( WarehouseEntry wms : wml ) { if ( wms . getItsQuantity ( ) . doubleValue ( ) < 0 ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "attempt_to_reverse_reversed" ) ; } WarehouseEntry wm = new WarehouseEntry ( ) ; wm . setIdDatabaseBirth ( getSrvOrm ( ) . getIdDatabase ( ) ) ; wm . setSourceId ( pEntity . getItsId ( ) ) ; wm . setSourceType ( pEntity . constTypeCode ( ) ) ; wm . setWarehouseSiteFrom ( wms . getWarehouseSiteFrom ( ) ) ; wm . setUnitOfMeasure ( wms . getUnitOfMeasure ( ) ) ; wm . setInvItem ( wms . getInvItem ( ) ) ; wm . setItsQuantity ( wms . getItsQuantity ( ) . negate ( ) ) ; quantityToLeaveRst = quantityToLeaveRst . add ( wms . getItsQuantity ( ) ) ; if ( quantityToLeaveRst . doubleValue ( ) > 0 ) { throw new ExceptionWithCode ( ExceptionWithCode . SOMETHING_WRONG , "reversing_source_has_different_quantity_against_movement_entries" ) ; } wm . setSourceOwnerId ( pEntity . getOwnerId ( ) ) ; wm . setSourceOwnerType ( pEntity . getOwnerType ( ) ) ; wm . setReversedId ( wms . getItsId ( ) ) ; wm . setDescription ( makeDescription ( pEntity , langDef , dateFormat ) + " " + getSrvI18n ( ) . getMsg ( "reversed_entry_n" , langDef ) + getSrvOrm ( ) . getIdDatabase ( ) + "-" + wms . getItsId ( ) ) ; getSrvOrm ( ) . insertEntity ( pAddParam , wm ) ; wm . setIsNew ( false ) ; makeWarehouseRest ( pAddParam , pEntity , wm . getWarehouseSiteFrom ( ) , wms . getItsQuantity ( ) ) ; wms . setReversedId ( wm . getItsId ( ) ) ; wms . setDescription ( wms . getDescription ( ) + " " + getSrvI18n ( ) . getMsg ( "reversing_entry_n" , langDef ) + getSrvOrm ( ) . getIdDatabase ( ) + "-" + wm . getItsId ( ) ) ; getSrvOrm ( ) . updateEntity ( pAddParam , wms ) ; } if ( quantityToLeaveRst . doubleValue ( ) != 0 ) { throw new ExceptionWithCode ( ExceptionWithCode . SOMETHING_WRONG , "reversing_source_has_different_quantity_against_movement_entries" ) ; }
|
public class DocBookUtilities { /** * Get the Translatable Strings from an XML Document . This method will return of Translation strings to XML DOM nodes within
* the XML Document . < br / >
* < br / >
* Note : This function has a flaw when breaking up strings if the Child Nodes contain translatable elements .
* @ param xml The XML to get the translatable strings from .
* @ param allowDuplicates If duplicate translation strings should be created in the returned list .
* @ return A list of StringToNodeCollection objects containing the translation strings and nodes . */
@ Deprecated public static List < StringToNodeCollection > getTranslatableStringsV1 ( final Document xml , final boolean allowDuplicates ) { } }
|
if ( xml == null ) return null ; final List < StringToNodeCollection > retValue = new ArrayList < StringToNodeCollection > ( ) ; final NodeList nodes = xml . getDocumentElement ( ) . getChildNodes ( ) ; for ( int i = 0 ; i < nodes . getLength ( ) ; ++ i ) { final Node node = nodes . item ( i ) ; getTranslatableStringsFromNodeV1 ( node , retValue , allowDuplicates , new XMLProperties ( ) ) ; } return retValue ;
|
public class BinaryHeapPriorityQueue { /** * Remove the last element of the heap ( last in the index array ) . */
private void removeLastEntry ( ) { } }
|
Entry < E > entry = indexToEntry . remove ( size ( ) - 1 ) ; keyToEntry . remove ( entry . key ) ;
|
public class JavaSPIExtensionLoader { public < T > Collection < T > all ( ClassLoader classLoader , Class < T > serviceClass ) { } }
|
Validate . notNull ( classLoader , "ClassLoader must be provided" ) ; Validate . notNull ( serviceClass , "ServiceClass must be provided" ) ; return createInstances ( serviceClass , load ( serviceClass , classLoader ) ) ;
|
public class CSSClassManager { /** * Update the text contents of an existing style element .
* @ param document Document element ( factory )
* @ param style Style element */
public void updateStyleElement ( Document document , Element style ) { } }
|
StringBuilder buf = new StringBuilder ( ) ; serialize ( buf ) ; Text cont = document . createTextNode ( buf . toString ( ) ) ; while ( style . hasChildNodes ( ) ) { style . removeChild ( style . getFirstChild ( ) ) ; } style . appendChild ( cont ) ;
|
public class AbstractQueuedSynchronizer { /** * Acquires in shared mode , aborting if interrupted . Implemented
* by first checking interrupt status , then invoking at least once
* { @ link # tryAcquireShared } , returning on success . Otherwise the
* thread is queued , possibly repeatedly blocking and unblocking ,
* invoking { @ link # tryAcquireShared } until success or the thread
* is interrupted .
* @ param arg the acquire argument .
* This value is conveyed to { @ link # tryAcquireShared } but is
* otherwise uninterpreted and can represent anything
* you like .
* @ throws InterruptedException if the current thread is interrupted */
public final void acquireSharedInterruptibly ( int arg ) throws InterruptedException { } }
|
if ( Thread . interrupted ( ) ) throw new InterruptedException ( ) ; if ( tryAcquireShared ( arg ) < 0 ) doAcquireSharedInterruptibly ( arg ) ;
|
public class GetProtectionStatusRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetProtectionStatusRequest getProtectionStatusRequest , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( getProtectionStatusRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getProtectionStatusRequest . getPolicyId ( ) , POLICYID_BINDING ) ; protocolMarshaller . marshall ( getProtectionStatusRequest . getMemberAccountId ( ) , MEMBERACCOUNTID_BINDING ) ; protocolMarshaller . marshall ( getProtectionStatusRequest . getStartTime ( ) , STARTTIME_BINDING ) ; protocolMarshaller . marshall ( getProtectionStatusRequest . getEndTime ( ) , ENDTIME_BINDING ) ; protocolMarshaller . marshall ( getProtectionStatusRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( getProtectionStatusRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class PreconditionUtil { /** * Asserts that two objects are equal . If they are not , an
* { @ link AssertionError } is thrown with the given message . If
* < code > expected < / code > and < code > actual < / code > are < code > null < / code > , they
* are considered equal .
* @ param message the identifying message for the { @ link AssertionError } (
* < code > null < / code > okay )
* @ param expected expected value
* @ param actual actual value */
public static void assertEquals ( String message , Object expected , Object actual ) { } }
|
verifyEquals ( expected , actual , message ) ;
|
public class IntegrationAccountsInner { /** * Gets the integration account callback URL .
* @ param resourceGroupName The resource group name .
* @ param integrationAccountName The integration account name .
* @ param parameters The callback URL parameters .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < CallbackUrlInner > getCallbackUrlAsync ( String resourceGroupName , String integrationAccountName , GetCallbackUrlParameters parameters , final ServiceCallback < CallbackUrlInner > serviceCallback ) { } }
|
return ServiceFuture . fromResponse ( getCallbackUrlWithServiceResponseAsync ( resourceGroupName , integrationAccountName , parameters ) , serviceCallback ) ;
|
public class Perfidix { /** * Setting up an existing benchmark with the given number of class - files
* @ param classes to be benched
* @ param benchmark to be set up
* @ return the same { @ link Benchmark } object with the classes
* @ throws ClassNotFoundException thrown if class was not found . */
public static Benchmark setUpBenchmark ( final String [ ] classes , final Benchmark benchmark ) throws ClassNotFoundException { } }
|
for ( final String each : classes ) { benchmark . add ( Class . forName ( each ) ) ; } return benchmark ;
|
public class FeatureOverlayQuery { /** * Perform a query based upon the map click location and build feature table data
* @ param latLng location
* @ param zoom current zoom level
* @ param mapBounds map view bounds
* @ param tolerance distance tolerance
* @ return table data on what was clicked , or null
* @ since 2.0.0 */
public FeatureTableData buildMapClickTableDataWithMapBounds ( LatLng latLng , double zoom , BoundingBox mapBounds , double tolerance ) { } }
|
return buildMapClickTableDataWithMapBounds ( latLng , zoom , mapBounds , tolerance , null ) ;
|
public class ClassLoaderUtils { /** * Load a given resources . < p / > This method will try to load the resources
* using the following methods ( in order ) :
* < ul >
* < li > From Thread . currentThread ( ) . getContextClassLoader ( )
* < li > From ClassLoaderUtil . class . getClassLoader ( )
* < li > callingClass . getClassLoader ( )
* < / ul >
* @ param resourceName The name of the resource to load
* @ param callingClass The Class object of the calling object */
@ FFDCIgnore ( { } }
|
IOException . class , IOException . class , IOException . class , IOException . class , IOException . class } ) public static List < URL > getResources ( String resourceName , Class < ? > callingClass ) { List < URL > ret = new ArrayList < > ( ) ; Enumeration < URL > urls = new Enumeration < URL > ( ) { public boolean hasMoreElements ( ) { return false ; } public URL nextElement ( ) { return null ; } } ; try { urls = getContextClassLoader ( ) . getResources ( resourceName ) ; } catch ( IOException e ) { // ignore
} if ( ! urls . hasMoreElements ( ) && resourceName . startsWith ( "/" ) ) { // certain classloaders need it without the leading /
try { urls = getContextClassLoader ( ) . getResources ( resourceName . substring ( 1 ) ) ; } catch ( IOException e ) { // ignore
} } ClassLoader cluClassloader = ClassLoaderUtils . class . getClassLoader ( ) ; if ( cluClassloader == null ) { cluClassloader = ClassLoader . getSystemClassLoader ( ) ; } if ( ! urls . hasMoreElements ( ) ) { try { urls = cluClassloader . getResources ( resourceName ) ; } catch ( IOException e ) { // ignore
} } if ( ! urls . hasMoreElements ( ) && resourceName . startsWith ( "/" ) ) { // certain classloaders need it without the leading /
try { urls = cluClassloader . getResources ( resourceName . substring ( 1 ) ) ; } catch ( IOException e ) { // ignore
} } if ( ! urls . hasMoreElements ( ) ) { ClassLoader cl = callingClass . getClassLoader ( ) ; if ( cl != null ) { try { urls = cl . getResources ( resourceName ) ; } catch ( IOException e ) { // ignore
} } } if ( ! urls . hasMoreElements ( ) ) { URL url = callingClass . getResource ( resourceName ) ; if ( url != null ) { ret . add ( url ) ; } } while ( urls . hasMoreElements ( ) ) { ret . add ( urls . nextElement ( ) ) ; } if ( ret . isEmpty ( ) && ( resourceName != null ) && ( resourceName . charAt ( 0 ) != '/' ) ) { return getResources ( '/' + resourceName , callingClass ) ; } return ret ;
|
public class Authentication { /** * Exception */
protected static boolean saveAuthentication ( URL url , String authenticationToken , boolean authenticationTokenIsPrivate , String applicationKey , int timeToLive , String privateKey , Map < String , LinkedList < ChannelPermissions > > permissions ) throws IOException { } }
|
String postBody = String . format ( "AT=%s&AK=%s&PK=%s&TTL=%s&TP=%s&PVT=%s" , authenticationToken , applicationKey , privateKey , timeToLive , permissions . size ( ) , ( authenticationTokenIsPrivate ? "1" : "0" ) ) ; // CAUSE : Inefficient use of keySet iterator instead of entrySet
// iterator
for ( Map . Entry < String , LinkedList < ChannelPermissions > > channelNamePerms : permissions . entrySet ( ) ) { LinkedList < ChannelPermissions > channelPermissions = channelNamePerms . getValue ( ) ; // CAUSE : Method concatenates strings using + in a loop
// TODO : specify a correct capacity
StringBuilder channelPermissionText = new StringBuilder ( 16 ) ; for ( ChannelPermissions channelPermission : channelPermissions ) { channelPermissionText . append ( channelPermission . getPermission ( ) ) ; } String channelPermission = String . format ( "&%s=%s" , channelNamePerms . getKey ( ) , channelPermissionText ) ; postBody = String . format ( "%s%s" , postBody , channelPermission ) ; } // CAUSE : Unused assignment
boolean isAuthenticated ; isAuthenticated = "https" . equals ( url . getProtocol ( ) ) ? secureSaveAuthentication ( url , postBody ) : unsecureSaveAuthentication ( url , postBody ) ; return isAuthenticated ;
|
public class Client { /** * Returns a cursor of single value for a set of series
* < p > The returned values ( datapoints ) can be null if there are no
* datapoints in the series or in the specified direction .
* @ param filter The filter of series to read from
* @ param timestamp The timestamp to read a value at
* @ param timezone The timezone of the returned datapoint
* @ param direction The direction to search if an exact timestamp match is not found
* @ return A cursor over the values at the specified timestamp
* @ see Cursor
* @ see SingleValue
* @ since 1.1.0 */
public Cursor < SingleValue > readSingleValue ( Filter filter , DateTime timestamp , DateTimeZone timezone , Direction direction ) { } }
|
URI uri = null ; try { URIBuilder builder = new URIBuilder ( String . format ( "/%s/single/" , API_VERSION ) ) ; addFilterToURI ( builder , filter ) ; addTimestampToURI ( builder , timestamp ) ; addTimeZoneToURI ( builder , timezone ) ; addDirectionToURI ( builder , direction ) ; uri = builder . build ( ) ; } catch ( URISyntaxException e ) { String message = String . format ( "Could not build URI with input - filter: %s" , filter ) ; throw new IllegalArgumentException ( message , e ) ; } Cursor < SingleValue > cursor = new SingleValueCursor ( uri , this ) ; return cursor ;
|
public class AbstractAmazonElasticTranscoderAsync { /** * Simplified method form for invoking the ListPipelines operation with an AsyncHandler .
* @ see # listPipelinesAsync ( ListPipelinesRequest , com . amazonaws . handlers . AsyncHandler ) */
@ Override public java . util . concurrent . Future < ListPipelinesResult > listPipelinesAsync ( com . amazonaws . handlers . AsyncHandler < ListPipelinesRequest , ListPipelinesResult > asyncHandler ) { } }
|
return listPipelinesAsync ( new ListPipelinesRequest ( ) , asyncHandler ) ;
|
public class AbstractMarkerLanguageParser { /** * Extract the validation components from the given file .
* @ param inputFile the input file .
* @ return the validation components . */
public Iterable < ValidationComponent > getStandardValidationComponents ( File inputFile ) { } }
|
final ValidationHandler handler = new ValidationHandler ( ) ; getDocumentParser ( ) . extractValidationComponents ( inputFile , handler ) ; return handler . getComponents ( ) ;
|
public class TwitterTokenServices { /** * Attemps to obtain a request token from the oauth / request _ token Twitter API . This request token can later be used to
* obtain an access token . If a request token is successfully obtained , the request is redirected to the oauth / authorize
* Twitter API to have Twitter authenticate the user and allow the user to authorize the application to access Twitter data .
* @ param request
* @ param response
* @ param callbackUrl
* URL that Twitter should redirect to with the oauth _ token and oauth _ verifier parameters once the request token is
* issued .
* @ param stateValue
* @ param config */
public void getRequestToken ( HttpServletRequest request , HttpServletResponse response , String callbackUrl , String stateValue , SocialLoginConfig config ) { } }
|
TwitterEndpointServices twitter = getTwitterEndpointServices ( ) ; twitter . setConsumerKey ( config . getClientId ( ) ) ; twitter . setConsumerSecret ( config . getClientSecret ( ) ) ; Map < String , Object > result = twitter . obtainRequestToken ( config , callbackUrl ) ; if ( result == null || result . isEmpty ( ) ) { Tr . error ( tc , "TWITTER_ERROR_OBTAINING_ENDPOINT_RESULT" , new Object [ ] { TwitterConstants . TWITTER_ENDPOINT_REQUEST_TOKEN } ) ; ErrorHandlerImpl . getInstance ( ) . handleErrorResponse ( response ) ; return ; } if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , TwitterConstants . TWITTER_ENDPOINT_REQUEST_TOKEN + " result: " + result . toString ( ) ) ; } try { if ( ! isSuccessfulResult ( result , TwitterConstants . TWITTER_ENDPOINT_REQUEST_TOKEN ) ) { ErrorHandlerImpl . getInstance ( ) . handleErrorResponse ( response ) ; return ; } // If successful , the result has already been verified to contain a non - empty oauth _ token and oauth _ token _ secret
String requestToken = ( String ) result . get ( TwitterConstants . RESPONSE_OAUTH_TOKEN ) ; // Cache request token to verify against later
setCookies ( request , response , requestToken , stateValue ) ; // Redirect to authorization endpoint with the provided request token
String authzEndpoint = config . getAuthorizationEndpoint ( ) ; try { SocialUtil . validateEndpointWithQuery ( authzEndpoint ) ; } catch ( SocialLoginException e ) { Tr . error ( tc , "FAILED_TO_REDIRECT_TO_AUTHZ_ENDPOINT" , new Object [ ] { config . getUniqueId ( ) , e . getMessage ( ) } ) ; ErrorHandlerImpl . getInstance ( ) . handleErrorResponse ( response ) ; return ; } String queryChar = ( authzEndpoint . contains ( "?" ) ) ? "&" : "?" ; response . sendRedirect ( authzEndpoint + queryChar + TwitterConstants . PARAM_OAUTH_TOKEN + "=" + requestToken ) ; } catch ( IOException e ) { Tr . error ( tc , "TWITTER_REDIRECT_IOEXCEPTION" , new Object [ ] { TwitterConstants . TWITTER_ENDPOINT_REQUEST_TOKEN , e . getLocalizedMessage ( ) } ) ; ErrorHandlerImpl . getInstance ( ) . handleErrorResponse ( response , HttpServletResponse . SC_BAD_REQUEST ) ; return ; }
|
public class RepositoryResourceImpl { /** * Find an AttachmentResource in a given set which either has the desired Locale
* or failing that , the same language as the desired locale . */
public static AttachmentSummary matchByLocale ( Collection < ? extends AttachmentSummary > attachments , AttachmentType desiredType , Locale desiredLocale ) { } }
|
Collection < AttachmentSummary > possibleMatches = new ArrayList < AttachmentSummary > ( ) ; for ( AttachmentSummary s : attachments ) { AttachmentType attType = s . getAttachment ( ) . getType ( ) ; if ( attType . equals ( desiredType ) ) { // This is either an exact match , or a candidate for a match - by - language
if ( s . getLocale ( ) . equals ( desiredLocale ) ) { return s ; } else { possibleMatches . add ( s ) ; } } } Locale baseDesiredLocale = new Locale ( desiredLocale . getLanguage ( ) ) ; for ( AttachmentSummary s : possibleMatches ) { if ( s . getLocale ( ) . equals ( baseDesiredLocale ) ) { return s ; } } // If we ' ve found no better match , can we at least provide English ?
for ( AttachmentSummary s : possibleMatches ) { if ( s . getLocale ( ) . equals ( Locale . ENGLISH ) ) { return s ; } } // Getting desperate : do we have anything that ' s language is English ?
for ( AttachmentSummary s : possibleMatches ) { if ( new Locale ( s . getLocale ( ) . getLanguage ( ) ) . equals ( Locale . ENGLISH ) ) { return s ; } } return null ;
|
public class ForEachTEI { /** * Currently implements the following rules :
* - If ' items ' is not specified , ' begin ' and ' end ' must be */
@ Override public boolean isValid ( TagData us ) { } }
|
if ( ! Util . isSpecified ( us , ITEMS ) ) { if ( ! Util . isSpecified ( us , BEGIN ) || ! ( Util . isSpecified ( us , END ) ) ) { return false ; } } return true ;
|
public class DaylightModel { /** * The element has normal valence for the specified charge .
* @ param element atomic number
* @ param charge formal charge
* @ param valence bonded electrons
* @ return acceptable for this model */
private static boolean normal ( int element , int charge , int valence ) { } }
|
switch ( element ) { case CARBON : if ( charge == - 1 || charge == + 1 ) return valence == 3 ; return charge == 0 && valence == 4 ; case NITROGEN : case PHOSPHORUS : case ARSENIC : if ( charge == - 1 ) return valence == 2 ; if ( charge == + 1 ) return valence == 4 ; return charge == 0 && ( valence == 3 || ( valence == 5 && element == NITROGEN ) ) ; case OXYGEN : if ( charge == + 1 ) return valence == 3 ; return charge == 0 && valence == 2 ; case SULPHUR : case SELENIUM : if ( charge == + 1 ) return valence == 3 ; return charge == 0 && ( valence == 2 || valence == 4 || valence == 6 ) ; } return false ;
|
public class AppEngineDatastoreSession { /** * Returns { @ code Delete } command based on App Engine Low - level Datastore
* API for the specified entity metamodel .
* This method is the entry point for deleting Command Builder API .
* @ param < E > The type of entity deleted by this { @ code Delete } .
* @ param metamodel The metamodel of the entity deleted by this
* { @ code Delete } .
* @ return The { @ code Delete } for the specified entity metamodel . */
@ Override public < E > AppEngineDelete < E > delete ( Metamodel < E > metamodel ) { } }
|
if ( metamodel == null ) { throw new IllegalArgumentException ( "'metamodel' must not be [" + metamodel + "]" ) ; } return new AppEngineDelete < E > ( metamodel , this ) ;
|
public class ActivemqFinder { /** * - - - - - provider methods */
public void launchNewProviderWizard ( ) { } }
|
SecurityContext securityContext = securityFramework . getSecurityContext ( getProxy ( ) . getNameToken ( ) ) ; ResourceDescription resourceDescription = descriptionRegistry . lookup ( PROVIDER_TEMPLATE ) ; final DefaultWindow dialog = new DefaultWindow ( Console . MESSAGES . newMessagingProvider ( ) ) ; AddResourceDialog addDialog = new AddResourceDialog ( securityContext , resourceDescription , new AddResourceDialog . Callback ( ) { @ Override public void onAdd ( ModelNode payload ) { dialog . hide ( ) ; String name = payload . get ( "name" ) . asString ( ) ; ResourceAddress fqAddress = PROVIDER_TEMPLATE . resolve ( statementContext , name ) ; payload . get ( OP ) . set ( ADD ) ; payload . get ( ADDRESS ) . set ( fqAddress ) ; dispatcher . execute ( new DMRAction ( payload ) , new SimpleCallback < DMRResponse > ( ) { @ Override public void onFailure ( Throwable caught ) { super . onFailure ( caught ) ; loadProvider ( ) ; } @ Override public void onSuccess ( DMRResponse dmrResponse ) { Console . info ( Console . MESSAGES . successfullyAddedMessagingProvider ( name ) ) ; loadProvider ( ) ; } } ) ; } @ Override public void onCancel ( ) { dialog . hide ( ) ; } } ) . addFactory ( "security-domain" , attributeDescription -> { SuggestionResource suggestionResource = new SuggestionResource ( "security-domain" , "Security domain" , true , Console . MODULES . getCapabilities ( ) . lookup ( SECURITY_DOMAIN ) ) ; return suggestionResource . buildFormItem ( ) ; } ) . include ( "security-enabled" , "security-domain" , "cluster-user" , "cluster-password" ) ; dialog . setWidth ( 640 ) ; dialog . setHeight ( 480 ) ; dialog . setWidget ( addDialog ) ; dialog . setGlassEnabled ( true ) ; dialog . center ( ) ;
|
public class Printer { /** * Print methods */
public void print ( IonValue value , Appendable out ) throws IOException { } }
|
// Copy the options so visitor won ' t see changes made while printing .
Options options ; synchronized ( this ) // So we don ' t clone in the midst of changes
{ options = myOptions . clone ( ) ; } if ( true ) { _print ( value , makeVisitor ( options , out ) ) ; } else { // Bridge to the configurable text writer . This is here for
// testing purposes . It * almost * works except for printing
// datagram as list .
boolean dg = value instanceof IonDatagram ; _Private_IonTextWriterBuilder o = _Private_IonTextWriterBuilder . standard ( ) ; o . setCharset ( IonTextWriterBuilder . ASCII ) ; if ( dg ) { if ( options . skipSystemValues ) { o . withMinimalSystemData ( ) ; } else if ( options . simplifySystemValues ) { o . setIvmMinimizing ( IvmMinimizing . DISTANT ) ; o . setLstMinimizing ( LstMinimizing . LOCALS ) ; } } o . _blob_as_string = options . blobAsString ; o . _clob_as_string = options . clobAsString ; o . _decimal_as_float = options . decimalAsFloat ; // TODO datagram as list
o . _sexp_as_list = options . sexpAsList ; o . _skip_annotations = options . skipAnnotations ; o . _string_as_json = options . stringAsJson ; o . _symbol_as_string = options . symbolAsString ; o . _timestamp_as_millis = options . timestampAsMillis ; o . _timestamp_as_string = options . timestampAsString ; o . _untyped_nulls = options . untypedNulls ; IonWriter writer = o . build ( out ) ; // TODO doesn ' t work for datagram since it skips system values
// value . writeTo ( writer ) ;
_Private_IonSystem system = ( _Private_IonSystem ) value . getSystem ( ) ; IonReader reader = system . newSystemReader ( value ) ; writer . writeValues ( reader ) ; writer . finish ( ) ; }
|
public class GroupZipper { /** * Navigates down the tree to the first child node of the current node .
* If the current node has no childs an exception will be thrown .
* @ return a new groupzipper which points to the first child node of the
* current node
* @ throws NoSuchElementException
* if the current node has no child nodes */
public GroupZipper down ( ) { } }
|
if ( ! canDown ( ) ) { throw new NoSuchElementException ( "Could not move down because this group does not have any children" ) ; } parent = new GroupZipper ( parent , node , index ) ; index = 0 ; node = node . getGroups ( ) . get ( 0 ) ; return this ;
|
public class QvmUploadDemo { /** * 获取凭证 */
public static void main ( String [ ] args ) { } }
|
// 设置账号的AK , SK
String ACCESS_KEY = "Access_Key" ; String SECRET_KEY = "Secret_Key" ; // 要上传的空间
String bucketname = "Bucket_Name" ; // 上传到七牛后保存的文件名
String key = "my-java.png" ; // 上传文件的路径
String FilePath = "/.../..." ; // 构造一个带指定的zone对象的配置类 , 华东1区域的云主机可以选择Zone . qvmZone0 ( ) , 华北2区域 ( 北京 ) 的云主机可以选择Zone . qvmZone1 ( ) , 目前其他存储区域是不支持
Configuration configuration = new Configuration ( Zone . qvmZone0 ( ) ) ; // 创建上传对象
UploadManager uploadManager = new UploadManager ( configuration ) ; // 秘钥鉴权
Auth auth = Auth . create ( ACCESS_KEY , SECRET_KEY ) ; // 简单上传 , 使用默认策略 , 只需要设置上传的空间名就可以了
String upToken = auth . uploadToken ( bucketname ) ; Response res = null ; try { // 调用上传方法
res = uploadManager . put ( FilePath , key , upToken ) ; } catch ( QiniuException e ) { e . printStackTrace ( ) ; } // 打印返回的信息
System . out . println ( res . statusCode ) ; System . out . println ( res . toString ( ) ) ;
|
public class BriefLogFormatter { /** * A Custom format implementation that is designed for brevity . */
@ Override public String format ( LogRecord record ) { } }
|
/* String loggerName = record . getLoggerName ( ) ;
if ( loggerName = = null ) {
loggerName = " root " ; */
// . append ( loggerName )
return "[" + StringUtils . repeat ( " " , 8 - record . getLevel ( ) . toString ( ) . length ( ) ) + record . getLevel ( ) + '|' + StringUtils . repeat ( " " , 12 - Thread . currentThread ( ) . getName ( ) . length ( ) ) + Thread . currentThread ( ) . getName ( ) + '|' + format . format ( new Date ( record . getMillis ( ) ) ) + "]: " + record . getMessage ( ) + ' ' + lineSep ;
|
public class SearchIndex { /** * SDK2.5 signature for back compatibility */
public ManagedEntity findByUuid ( Datacenter datacenter , String uuid , boolean vmOnly ) throws RuntimeFault , RemoteException { } }
|
return findByUuid ( datacenter , uuid , vmOnly , null ) ;
|
public class AWSOrganizationsClient { /** * Retrieves information about the organization that the user ' s account belongs to .
* This operation can be called from any account in the organization .
* < note >
* Even if a policy type is shown as available in the organization , it can be disabled separately at the root level
* with < a > DisablePolicyType < / a > . Use < a > ListRoots < / a > to see the status of policy types for a specified root .
* < / note >
* @ param describeOrganizationRequest
* @ return Result of the DescribeOrganization operation returned by the service .
* @ throws AccessDeniedException
* You don ' t have permissions to perform the requested operation . The user or role that is making the
* request must have at least one IAM permissions policy attached that grants the required permissions . For
* more information , see < a href = " https : / / docs . aws . amazon . com / IAM / latest / UserGuide / access . html " > Access
* Management < / a > in the < i > IAM User Guide < / i > .
* @ throws AWSOrganizationsNotInUseException
* Your account isn ' t a member of an organization . To make this request , you must use the credentials of an
* account that belongs to an organization .
* @ throws ConcurrentModificationException
* The target of the operation is currently being modified by a different request . Try again later .
* @ throws ServiceException
* AWS Organizations can ' t complete your request because of an internal service error . Try again later .
* @ throws TooManyRequestsException
* You ' ve sent too many requests in too short a period of time . The limit helps protect against
* denial - of - service attacks . Try again later . < / p >
* For information on limits that affect Organizations , see < a
* href = " https : / / docs . aws . amazon . com / organizations / latest / userguide / orgs _ reference _ limits . html " > Limits of
* AWS Organizations < / a > in the < i > AWS Organizations User Guide < / i > .
* @ sample AWSOrganizations . DescribeOrganization
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / organizations - 2016-11-28 / DescribeOrganization "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public DescribeOrganizationResult describeOrganization ( DescribeOrganizationRequest request ) { } }
|
request = beforeClientExecution ( request ) ; return executeDescribeOrganization ( request ) ;
|
public class Timer { /** * Schedules the specified task for repeated < i > fixed - rate execution < / i > ,
* beginning after the specified delay . Subsequent executions take place
* at approximately regular intervals , separated by the specified period .
* < p > In fixed - rate execution , each execution is scheduled relative to the
* scheduled execution time of the initial execution . If an execution is
* delayed for any reason ( such as garbage collection or other background
* activity ) , two or more executions will occur in rapid succession to
* " catch up . " In the long run , the frequency of execution will be
* exactly the reciprocal of the specified period ( assuming the system
* clock underlying < tt > Object . wait ( long ) < / tt > is accurate ) .
* < p > Fixed - rate execution is appropriate for recurring activities that
* are sensitive to < i > absolute < / i > time , such as ringing a chime every
* hour on the hour , or running scheduled maintenance every day at a
* particular time . It is also appropriate for recurring activities
* where the total time to perform a fixed number of executions is
* important , such as a countdown timer that ticks once every second for
* ten seconds . Finally , fixed - rate execution is appropriate for
* scheduling multiple repeating timer tasks that must remain synchronized
* with respect to one another .
* @ param task task to be scheduled .
* @ param delay delay in milliseconds before task is to be executed .
* @ param period time in milliseconds between successive task executions .
* @ throws IllegalArgumentException if { @ code delay < 0 } , or
* { @ code delay + System . currentTimeMillis ( ) < 0 } , or
* { @ code period < = 0}
* @ throws IllegalStateException if task was already scheduled or
* cancelled , timer was cancelled , or timer thread terminated .
* @ throws NullPointerException if { @ code task } is null */
public void scheduleAtFixedRate ( TimerTask task , long delay , long period ) { } }
|
if ( delay < 0 ) throw new IllegalArgumentException ( "Negative delay." ) ; if ( period <= 0 ) throw new IllegalArgumentException ( "Non-positive period." ) ; sched ( task , System . currentTimeMillis ( ) + delay , period ) ;
|
public class QueryInterceptor { /** * Remove entries from all indexes by key . */
void removeFromIndexes ( TransactionContext transactionContext , Object key ) { } }
|
Stream < IndexedTypeIdentifier > typeIdentifiers = getKnownClasses ( ) . stream ( ) . filter ( searchFactoryHandler :: hasIndex ) . map ( PojoIndexedTypeIdentifier :: new ) ; Set < Work > deleteWorks = typeIdentifiers . map ( e -> searchWorkCreator . createEntityWork ( keyToString ( key ) , e , WorkType . DELETE ) ) . collect ( Collectors . toSet ( ) ) ; performSearchWorks ( deleteWorks , transactionContext ) ;
|
public class CommonDialogWindow { /** * Adds the component manually to the allComponents - List and adds a
* ValueChangeListener to it . Necessary in Update Distribution Type as the
* CheckBox concerned is an ItemProperty . . .
* @ param component
* AbstractField */
public void updateAllComponents ( final AbstractField < ? > component ) { } }
|
allComponents . add ( component ) ; component . addValueChangeListener ( new ChangeListener ( component ) ) ;
|
public class InfraAlertConditionService { /** * Returns the infrastructure alert condition with the given id .
* @ param conditionId The id of the alert condition to return
* @ return The alert condition */
public Optional < InfraAlertCondition > show ( long conditionId ) { } }
|
return HTTP . GET ( String . format ( "/v2/alerts/conditions/%d" , conditionId ) , null , null , INFRA_ALERT_CONDITION ) ;
|
public class Utils { /** * Obtains a parameter with specified name from from query string . The query should be in format
* param = value & param = value . . .
* @ param query Queery in " url " format .
* @ param paramName Parameter name .
* @ return Parameter value , or null . */
public static String getParameterValueFromQuery ( String query , String paramName ) { } }
|
String [ ] components = query . split ( "&" ) ; for ( String keyValuePair : components ) { String [ ] pairComponents = keyValuePair . split ( "=" ) ; if ( pairComponents . length == 2 ) { try { String key = URLDecoder . decode ( pairComponents [ 0 ] , "utf-8" ) ; if ( key . compareTo ( paramName ) == 0 ) { return URLDecoder . decode ( pairComponents [ 1 ] , "utf-8" ) ; } } catch ( UnsupportedEncodingException e ) { logger . error ( "getParameterValueFromQuery failed with exception: " + e . getLocalizedMessage ( ) , e ) ; } } } return null ;
|
public class ConfigurationTypeConverter { /** * A helper converting method .
* Converts string to a class of given type
* @ param value
* String value to be converted
* @ param to
* Type of desired value
* @ param < T >
* Type of returned value
* @ return Value converted to the appropriate type */
public < T > T convert ( String value , Class < T > to ) { } }
|
if ( Strings . isEmpty ( value ) && ! ( String . class . equals ( to ) || String [ ] . class . equals ( to ) ) ) { return null ; } if ( String . class . equals ( to ) ) { return to . cast ( value ) ; } else if ( Integer . class . equals ( to ) ) { return to . cast ( Integer . valueOf ( value ) ) ; } else if ( Double . class . equals ( to ) ) { return to . cast ( Double . valueOf ( value ) ) ; } else if ( Long . class . equals ( to ) ) { return to . cast ( Long . valueOf ( value ) ) ; } else if ( Boolean . class . equals ( to ) ) { return to . cast ( Boolean . valueOf ( value ) ) ; } else if ( URL . class . equals ( to ) ) { try { return to . cast ( new URI ( value ) . toURL ( ) ) ; } catch ( MalformedURLException e ) { throw new IllegalArgumentException ( "Unable to convert value " + value + " to URL" , e ) ; } catch ( URISyntaxException e ) { throw new IllegalArgumentException ( "Unable to convert value " + value + " to URL" , e ) ; } } else if ( URI . class . equals ( to ) ) { try { return to . cast ( new URI ( value ) ) ; } catch ( URISyntaxException e ) { throw new IllegalArgumentException ( "Unable to convert value " + value + " to URL" , e ) ; } } else { String trimmedValue = extractEnumName ( value ) ; if ( to . isEnum ( ) ) { return ( T ) Enum . valueOf ( ( Class < Enum > ) to , trimmedValue . toUpperCase ( ) ) ; } else if ( String [ ] . class . equals ( to ) ) { final String [ ] convertedArray = value . split ( "," ) ; if ( convertedArray . length == 0 ) { return to . cast ( new String [ 0 ] ) ; } trimElements ( convertedArray ) ; if ( convertedArray . length == 1 && hasOnlyBlanks ( convertedArray ) ) { return to . cast ( new String [ 0 ] ) ; } return to . cast ( convertedArray ) ; } else if ( Charset . class . equals ( to ) ) { return to . cast ( Charset . forName ( trimmedValue . toUpperCase ( ) ) ) ; } else if ( Class . class . equals ( to ) ) { try { Object clazz = Class . forName ( value ) ; return to . cast ( clazz ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Unable to find class [" + value + "]." , e ) ; } } else // Try to create instance via reflection
{ try { Object instance = Class . forName ( value ) . newInstance ( ) ; return to . cast ( instance ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Unable to convert value [" + value + "] to a class [" + to . getName ( ) + "]." , e ) ; } } }
|
public class Http { /** * Sends a POST request with a file and returns the response .
* @ param endpoint The endpoint to send the request to .
* @ param input The file data to upload
* @ param responseClass The class to deserialise the Json response to . Can be null if no response message is expected .
* @ param fields Any name - value pairs to serialise
* @ param < T > The type to deserialise the response to .
* @ return A { @ link Response } containing the deserialised body , if any .
* @ throws IOException If an error occurs .
* @ see MultipartEntityBuilder */
public < T > Response < T > postFile ( Endpoint endpoint , InputStream input , Class < T > responseClass , NameValuePair ... fields ) throws IOException { } }
|
// Create the request
HttpPost post = new HttpPost ( endpoint . url ( ) ) ; post . setHeaders ( combineHeaders ( ) ) ; // Add fields as text pairs
MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder . create ( ) ; for ( NameValuePair field : fields ) { multipartEntityBuilder . addTextBody ( field . getName ( ) , field . getValue ( ) ) ; } // Add file as binary
Path tempFile = Files . createTempFile ( "upload" , ".dat" ) ; try ( OutputStream output = Files . newOutputStream ( tempFile ) ) { IOUtils . copy ( input , output ) ; } FileBody bin = new FileBody ( tempFile . toFile ( ) ) ; multipartEntityBuilder . addPart ( "file" , bin ) ; // Set the body
post . setEntity ( multipartEntityBuilder . build ( ) ) ; // Send the request and process the response
try ( CloseableHttpResponse response = httpClient ( ) . execute ( post ) ) { T body = deserialiseResponseMessage ( response , responseClass ) ; return new Response < > ( response . getStatusLine ( ) , body ) ; }
|
public class Json { /** * Convert a JsonNode to a Java value
* @ param json Json value to convert .
* @ param clazz Expected Java value type .
* @ param < T > type of return object
* @ return casted value of given json object */
public static < T > T fromJson ( final String json , final Class < T > clazz ) { } }
|
return fromJson ( parse ( json ) , clazz ) ;
|
public class DtlsSrtpServer { /** * Gets the fingerprint of the Certificate associated to the server .
* @ return The fingerprint of the server certificate . Returns an empty
* String if the server does not contain a certificate . */
public String generateFingerprint ( String hashFunction ) { } }
|
try { this . hashFunction = hashFunction ; org . bouncycastle . crypto . tls . Certificate chain = TlsUtils . loadCertificateChain ( certificateResources ) ; Certificate certificate = chain . getCertificateAt ( 0 ) ; return TlsUtils . fingerprint ( this . hashFunction , certificate ) ; } catch ( IOException e ) { LOGGER . error ( "Could not get local fingerprint: " + e . getMessage ( ) ) ; return "" ; }
|
public class TransactionImpl { /** * Enlist the resouce with the transaction associated with the target
* TransactionImpl object .
* This is the implementation version of the method and does take in the
* XA resource class name and info objects required during recovery . If
* these fields are provided ( ie are not passed in as nulls ) the resource
* will be logged and recovered as required . If these fields are null ,
* the resource must a one phase capable resource or an exception will
* be thrown .
* @ return < i > true < / i > if the resource was enlisted successfully ; otherwise < i > false < / i > .
* @ param xaRes the XAResource object associated with XAConnection
* @ exception RollbackException
* @ exception IllegalStateException
* @ exception SystemException */
public boolean enlistResource ( XAResource xaRes , int recoveryIndex ) throws RollbackException , IllegalStateException , SystemException { } }
|
return enlistResource ( xaRes , recoveryIndex , XAResource . TMNOFLAGS ) ;
|
public class GinjectorFragmentOutputter { /** * Writes a method describing the getter for the given key , along with any
* other code necessary to support it . Produces a list of helper methods that
* still need to be written . */
void writeBindingGetter ( Key < ? > key , Binding binding , GinScope scope , List < InjectorMethod > helperMethodsOutput ) { } }
|
Context bindingContext = binding . getContext ( ) ; SourceSnippetBuilder getterBuilder = new SourceSnippetBuilder ( ) ; SourceSnippet creationStatements ; String getter = nameGenerator . getGetterMethodName ( key ) ; String typeName ; try { typeName = ReflectUtil . getSourceName ( key . getTypeLiteral ( ) ) ; creationStatements = binding . getCreationStatements ( nameGenerator , helperMethodsOutput ) ; } catch ( NoSourceNameException e ) { errorManager . logError ( "Error trying to write getter for [%s] -> [%s];" + " binding declaration: %s" , e , key , binding , bindingContext ) ; return ; } // Name of the field that we might need .
String field = nameGenerator . getSingletonFieldName ( key ) ; switch ( scope ) { case EAGER_SINGLETON : initializeEagerSingletonsBody . append ( "// Eager singleton bound at:\n" ) ; appendBindingContextCommentToMethod ( bindingContext , initializeEagerSingletonsBody ) ; initializeEagerSingletonsBody . append ( getter ) . append ( "();\n" ) ; // ! break
// CHECKSTYLE _ OFF
case SINGLETON : // CHECKSTYLE _ OFF
writer . println ( "private " + typeName + " " + field + " = null;" ) ; writer . println ( ) ; getterBuilder . append ( String . format ( "\nif (%s == null) {\n" , field ) ) . append ( creationStatements ) . append ( "\n" ) . append ( String . format ( " %s = result;\n" , field ) ) . append ( "}\n" ) . append ( String . format ( "return %s;\n" , field ) ) ; break ; case NO_SCOPE : sourceWriteUtil . writeBindingContextJavadoc ( writer , bindingContext , key ) ; getterBuilder . append ( creationStatements ) . append ( "\n" ) . append ( "return result;\n" ) ; break ; default : throw new IllegalStateException ( ) ; } outputMethod ( SourceSnippets . asMethod ( false , String . format ( "public %s %s()" , typeName , getter ) , fragmentPackageName . toString ( ) , getterBuilder . build ( ) ) ) ;
|
public class lbmonitor { /** * Use this API to disable lbmonitor resources of given names . */
public static base_responses disable ( nitro_service client , String monitorname [ ] ) throws Exception { } }
|
base_responses result = null ; if ( monitorname != null && monitorname . length > 0 ) { lbmonitor disableresources [ ] = new lbmonitor [ monitorname . length ] ; for ( int i = 0 ; i < monitorname . length ; i ++ ) { disableresources [ i ] = new lbmonitor ( ) ; disableresources [ i ] . monitorname = monitorname [ i ] ; } result = perform_operation_bulk_request ( client , disableresources , "disable" ) ; } return result ;
|
public class Wxs { /** * 根据提交参数 , 生成签名
* @ param map
* 要签名的集合
* @ param key
* 商户秘钥
* @ return 签名
* @ see < a href =
* " https : / / pay . weixin . qq . com / wiki / doc / api / jsapi . php ? chapter = 4_3 " >
* 微信商户平台签名算法 < / a > */
public static String genPaySign ( Map < String , Object > map , String key , String signType ) { } }
|
String [ ] nms = map . keySet ( ) . toArray ( new String [ map . size ( ) ] ) ; Arrays . sort ( nms ) ; StringBuilder sb = new StringBuilder ( ) ; signType = signType == null ? "MD5" : signType . toUpperCase ( ) ; boolean isMD5 = "MD5" . equals ( signType ) ; for ( String nm : nms ) { Object v = map . get ( nm ) ; if ( null == v ) continue ; // JSSDK 支付签名时间戳 , 注意微信jssdk中的所有使用timestamp字段均为小写 。
// 但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
if ( isMD5 && "timestamp" . equals ( nm ) ) { nm = "timeStamp" ; } String s = v . toString ( ) ; if ( Strings . isBlank ( s ) ) continue ; sb . append ( nm ) . append ( '=' ) . append ( s ) . append ( '&' ) ; } sb . append ( "key=" ) . append ( key ) ; return Lang . digest ( signType , sb ) . toUpperCase ( ) ;
|
public class EventImpl { /** * Remove any existing value for the provided EventLocal .
* @ param < T >
* @ param key
* @ return T , existing object being removed , null if none present */
@ SuppressWarnings ( "unchecked" ) public < T > T remove ( EventLocal < T > key ) { } }
|
EventLocalMap < EventLocal < ? > , Object > map = getMap ( key ) ; if ( null != map ) { return ( T ) map . remove ( key ) ; } return null ;
|
public class JedisClientPool { /** * { @ inheritDoc } */
@ Override public JedisRedisClient borrowObject ( ) throws Exception { } }
|
JedisRedisClient redisClient = ( JedisRedisClient ) super . borrowObject ( ) ; if ( redisClient != null ) { redisClient . setRedisClientPool ( this ) ; } return redisClient ;
|
public class TextObject { /** * Append the target text for language detection .
* This method read the text from specified input reader .
* If the total size of target text exceeds the limit size ,
* the rest is ignored .
* @ param reader the input reader ( BufferedReader as usual )
* @ throws java . io . IOException Can ' t read the reader . */
public TextObject append ( Reader reader ) throws IOException { } }
|
char [ ] buf = new char [ 1024 ] ; while ( reader . ready ( ) && ( maxTextLength == 0 || stringBuilder . length ( ) < maxTextLength ) ) { int length = reader . read ( buf ) ; append ( String . valueOf ( buf , 0 , length ) ) ; } return this ;
|
public class DefaultSentryClientFactory { /** * HTTP proxy port for Sentry connections .
* @ param dsn Sentry server DSN which may contain options .
* @ return HTTP proxy port for Sentry connections . */
protected int getProxyPort ( Dsn dsn ) { } }
|
return Util . parseInteger ( Lookup . lookup ( HTTP_PROXY_PORT_OPTION , dsn ) , HTTP_PROXY_PORT_DEFAULT ) ;
|
public class Modules { /** * Return the names of all classes in the given module . */
public static Class < ? > [ ] getClasses ( Class < ? > module ) { } }
|
HashSet < Class < ? > > result = new HashSet < > ( ) ; ClassLoader classLoader = Modules . class . getClassLoader ( ) ; for ( ClassModel info : Modules . getModuleModel ( module ) . getAllClassDependencies ( ) ) { try { result . add ( classLoader . loadClass ( info . getQualifiedName ( ) ) ) ; } catch ( ClassNotFoundException e ) { Modules . logger . error ( "Error loading class " + info . getQualifiedName ( ) , e ) ; } } return result . toArray ( new Class < ? > [ ] { } ) ;
|
public class InputMapTemplate { /** * Instantiates the input map and installs it into the node via { @ link Nodes # addInputMap ( Node , InputMap ) } */
public static < S extends Node , E extends Event > void installOverride ( InputMapTemplate < S , E > imt , S node ) { } }
|
Nodes . addInputMap ( node , imt . instantiate ( node ) ) ;
|
public class Protempa { /** * Executes a query .
* Protempa determines which propositions to retrieve from the underlying
* data sources and compute as the union of the proposition ids specified in
* the supplied { @ link Query } and the proposition ids returned from the
* results handler ' s { @ link QueryResultsHandler # getPropositionIdsNeeded ( ) }
* method .
* @ param query a { @ link Query } . Cannot be < code > null < / code > .
* @ param destination a destination . Cannot be < code > null < / code > .
* @ throws QueryException if an error occurred during query . */
public void execute ( Query query , Destination destination ) throws QueryException { } }
|
if ( query == null ) { throw new IllegalArgumentException ( "query cannot be null" ) ; } if ( destination == null ) { throw new IllegalArgumentException ( "resultsHandler cannot be null" ) ; } LOGGER . log ( Level . INFO , "Executing query {0}" , query . getName ( ) ) ; this . abstractionFinder . doFind ( query , destination ) ; LOGGER . log ( Level . INFO , "Query {0} execution complete" , query . getName ( ) ) ;
|
public class CmsVfsSitemapService { /** * Creates new content elements if required by the model page . < p >
* @ param cms the cms context
* @ param page the page
* @ param sitePath the resource site path
* @ throws CmsException when unable to create the content elements */
private void createNewContainerElements ( CmsObject cms , CmsXmlContainerPage page , String sitePath ) throws CmsException { } }
|
CmsADEConfigData configData = OpenCms . getADEManager ( ) . lookupConfiguration ( cms , cms . addSiteRoot ( sitePath ) ) ; Locale contentLocale = OpenCms . getLocaleManager ( ) . getDefaultLocale ( cms , CmsResource . getFolderPath ( sitePath ) ) ; CmsObject cloneCms = OpenCms . initCmsObject ( cms ) ; cloneCms . getRequestContext ( ) . setLocale ( contentLocale ) ; CmsContainerPageBean pageBean = page . getContainerPage ( cms ) ; boolean needsChanges = false ; List < CmsContainerBean > updatedContainers = new ArrayList < CmsContainerBean > ( ) ; for ( CmsContainerBean container : pageBean . getContainers ( ) . values ( ) ) { List < CmsContainerElementBean > updatedElements = new ArrayList < CmsContainerElementBean > ( ) ; for ( CmsContainerElementBean element : container . getElements ( ) ) { if ( element . isCreateNew ( ) && ! element . isGroupContainer ( cms ) && ! element . isInheritedContainer ( cms ) ) { needsChanges = true ; String typeName = OpenCms . getResourceManager ( ) . getResourceType ( element . getResource ( ) ) . getTypeName ( ) ; CmsResourceTypeConfig typeConfig = configData . getResourceType ( typeName ) ; if ( typeConfig == null ) { throw new IllegalArgumentException ( "Can not copy template model element '" + element . getResource ( ) . getRootPath ( ) + "' because the resource type '" + typeName + "' is not available in this sitemap." ) ; } CmsResource newResource = typeConfig . createNewElement ( cloneCms , element . getResource ( ) , CmsResource . getParentFolder ( cms . getRequestContext ( ) . addSiteRoot ( sitePath ) ) ) ; CmsContainerElementBean newBean = new CmsContainerElementBean ( newResource . getStructureId ( ) , element . getFormatterId ( ) , element . getIndividualSettings ( ) , false ) ; updatedElements . add ( newBean ) ; } else { updatedElements . add ( element ) ; } } CmsContainerBean updatedContainer = new CmsContainerBean ( container . getName ( ) , container . getType ( ) , container . getParentInstanceId ( ) , container . isRootContainer ( ) , container . getMaxElements ( ) , updatedElements ) ; updatedContainers . add ( updatedContainer ) ; } if ( needsChanges ) { CmsContainerPageBean updatedPage = new CmsContainerPageBean ( updatedContainers ) ; page . writeContainerPage ( cms , updatedPage ) ; }
|
public class DescribeNatGatewaysRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < DescribeNatGatewaysRequest > getDryRunRequest ( ) { } }
|
Request < DescribeNatGatewaysRequest > request = new DescribeNatGatewaysRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ;
|
public class DefaultMonetaryAmountsSingletonSpi { /** * ( non - Javadoc )
* @ see javax . money . spi . MonetaryAmountsSpi # getDefaultAmountType ( ) */
@ Override public Class < ? extends MonetaryAmount > getDefaultAmountType ( ) { } }
|
if ( Objects . isNull ( configuredDefaultAmountType ) ) { for ( MonetaryAmountFactoryProviderSpi < ? > f : Bootstrap . getServices ( MonetaryAmountFactoryProviderSpi . class ) ) { if ( f . getQueryInclusionPolicy ( ) == MonetaryAmountFactoryProviderSpi . QueryInclusionPolicy . ALWAYS ) { configuredDefaultAmountType = f . getAmountType ( ) ; break ; } } } return Optional . ofNullable ( configuredDefaultAmountType ) . orElseThrow ( ( ) -> new MonetaryException ( "No MonetaryAmountFactoryProviderSpi registered." ) ) ;
|
public class MultiPolygon { /** * Return the sum of all the points of all the polygons in this MultiPolygon . */
public int getNumPoints ( ) { } }
|
if ( isEmpty ( ) ) { return 0 ; } int total = 0 ; for ( Polygon polygon : polygons ) { total += polygon . getNumPoints ( ) ; } return total ;
|
public class SegmentManager { /** * Returns the last segment in the log .
* @ throws IllegalStateException if the segment manager is not open */
public synchronized Segment lastSegment ( ) { } }
|
assertOpen ( ) ; Map . Entry < Long , Segment > segment = segments . lastEntry ( ) ; return segment != null ? segment . getValue ( ) : null ;
|
public class CmsAreaSelectPanel { /** * Setting a new top / height value for the selection . < p >
* @ param secondY the cursor Y offset to the selection area */
private void positionY ( int secondY ) { } }
|
if ( secondY < m_firstY ) { setSelectPositionY ( secondY , m_firstY - secondY ) ; } else { setSelectHeight ( secondY - m_firstY ) ; }
|
public class ResourceIndexImpl { /** * { @ inheritDoc } */
public TripleIterator findTriples ( String queryLang , String tupleQuery , String tripleTemplate , int limit , boolean distinct ) throws TrippiException { } }
|
return _writer . findTriples ( queryLang , tupleQuery , tripleTemplate , limit , distinct ) ;
|
public class ComparatorCompat { /** * Returns a comparator that uses a function that extracts
* a { @ code long } sort key to be compared .
* @ param < T > the type of the objects compared by the comparator
* @ param keyExtractor the function that extracts the sort key
* @ return a comparator
* @ throws NullPointerException if { @ code keyExtractor } is null */
@ NotNull public static < T > ComparatorCompat < T > comparingLong ( @ NotNull final ToLongFunction < ? super T > keyExtractor ) { } }
|
Objects . requireNonNull ( keyExtractor ) ; return new ComparatorCompat < T > ( new Comparator < T > ( ) { @ Override public int compare ( T t1 , T t2 ) { final long l1 = keyExtractor . applyAsLong ( t1 ) ; final long l2 = keyExtractor . applyAsLong ( t2 ) ; return Objects . compareLong ( l1 , l2 ) ; } } ) ;
|
public class JPEGImageReader { /** * Metadata */
@ Override public IIOMetadata getImageMetadata ( int imageIndex ) throws IOException { } }
|
// checkBounds needed , as we catch the IndexOutOfBoundsException below .
checkBounds ( imageIndex ) ; initHeader ( imageIndex ) ; IIOMetadata imageMetadata ; if ( isLossless ( ) ) { return new JPEGImage10Metadata ( segments ) ; } else { try { imageMetadata = delegate . getImageMetadata ( 0 ) ; } catch ( IndexOutOfBoundsException knownIssue ) { // TMI - 101 : com . sun . imageio . plugins . jpeg . JPEGBuffer doesn ' t do proper sanity check of input data .
throw new IIOException ( "Corrupt JPEG data: Bad segment length" , knownIssue ) ; } catch ( NegativeArraySizeException knownIssue ) { // Most likely from com . sun . imageio . plugins . jpeg . SOSMarkerSegment
throw new IIOException ( "Corrupt JPEG data: Bad component count" , knownIssue ) ; } if ( imageMetadata != null && Arrays . asList ( imageMetadata . getMetadataFormatNames ( ) ) . contains ( JPEGImage10MetadataCleaner . JAVAX_IMAGEIO_JPEG_IMAGE_1_0 ) ) { if ( metadataCleaner == null ) { metadataCleaner = new JPEGImage10MetadataCleaner ( this ) ; } return metadataCleaner . cleanMetadata ( imageMetadata ) ; } } return imageMetadata ;
|
public class ConfigHelper { /** * 解析DataMedia中的namespace和name , 支持offer [ 1-128 ] 分库的定义 */
public static ModeValue parseMode ( String value ) { } }
|
PatternMatcher matcher = new Perl5Matcher ( ) ; if ( matcher . matches ( value , patterns . get ( MODE_PATTERN ) ) ) { MatchResult matchResult = matcher . getMatch ( ) ; String prefix = matchResult . group ( 1 ) ; String startStr = matchResult . group ( 3 ) ; String ednStr = matchResult . group ( 4 ) ; int start = Integer . valueOf ( startStr ) ; int end = Integer . valueOf ( ednStr ) ; String postfix = matchResult . group ( 5 ) ; List < String > values = new ArrayList < String > ( ) ; for ( int i = start ; i <= end ; i ++ ) { StringBuilder builder = new StringBuilder ( value . length ( ) ) ; String str = String . valueOf ( i ) ; // 处理0001类型
if ( startStr . length ( ) == ednStr . length ( ) && startStr . startsWith ( "0" ) ) { str = StringUtils . leftPad ( String . valueOf ( i ) , startStr . length ( ) , '0' ) ; } builder . append ( prefix ) . append ( str ) . append ( postfix ) ; values . add ( builder . toString ( ) ) ; } return new ModeValue ( Mode . MULTI , values ) ; } else if ( isWildCard ( value ) ) { // 通配符支持
return new ModeValue ( Mode . WILDCARD , Arrays . asList ( value ) ) ; } else { return new ModeValue ( Mode . SINGLE , Arrays . asList ( value ) ) ; }
|
public class StandardDdlParser { /** * { @ inheritDoc }
* @ see org . modeshape . sequencer . ddl . DdlParser # score ( java . lang . String , java . lang . String ,
* org . modeshape . sequencer . ddl . DdlParserScorer ) */
@ Override public Object score ( String ddl , String fileName , DdlParserScorer scorer ) throws ParsingException { } }
|
CheckArg . isNotNull ( ddl , "ddl" ) ; CheckArg . isNotNull ( scorer , "scorer" ) ; if ( fileName != null ) { // Score the filename using the identifier only . . .
scorer . scoreText ( fileName , 2 , getIdentifyingKeywords ( ) ) ; } // Create the state of this parser . . .
problems . clear ( ) ; boolean includeComments = true ; DdlTokenStream tokens = new DdlTokenStream ( ddl , DdlTokenStream . ddlTokenizer ( includeComments ) , false ) ; initializeTokenStream ( tokens ) ; tokens . start ( ) ; testPrint ( "\n== >> StandardDdlParser.parse() PARSING STARTED: " ) ; // Consume the first block of comments . . .
while ( tokens . matches ( DdlTokenizer . COMMENT ) ) { // Consume the comment . . .
String comment = tokens . consume ( ) ; scorer . scoreText ( comment , 2 , getIdentifyingKeywords ( ) ) ; } // Compute the score for the rest of this content . . .
computeScore ( tokens , scorer ) ; // Return the tokens so parse ( . . . ) won ' t have to re - tokenize . . .
return tokens ;
|
public class LineDataObjectPositionMigrationImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } }
|
switch ( featureID ) { case AfplibPackage . LINE_DATA_OBJECT_POSITION_MIGRATION__TEMP_ORIENT : return TEMP_ORIENT_EDEFAULT == null ? tempOrient != null : ! TEMP_ORIENT_EDEFAULT . equals ( tempOrient ) ; } return super . eIsSet ( featureID ) ;
|
public class Token { /** * This method is deprecated . Please use { @ link # isTokenValid ( byte [ ] , String , String ) } instead
* Check if a string is a valid token
* @ param secret the secret to decrypt the string
* @ param oid the ID supposed to be encapsulated in the token
* @ param token the token string
* @ return { @ code true } if the token is valid */
@ Deprecated @ SuppressWarnings ( "unused" ) public static boolean isTokenValid ( String secret , String oid , String token ) { } }
|
return isTokenValid ( secret . getBytes ( Charsets . UTF_8 ) , oid , token ) ;
|
public class Gauge { /** * * * * * * Misc * * * * * */
private synchronized void createBlinkTask ( ) { } }
|
blinkTask = new Callable < Void > ( ) { @ Override public Void call ( ) throws Exception { try { Platform . runLater ( ( ) -> setLedOn ( ! isLedOn ( ) ) ) ; } finally { if ( ! Thread . currentThread ( ) . isInterrupted ( ) ) { // Schedule the same Callable with the current updateInterval
blinkFuture = blinkService . schedule ( this , LED_BLINK_INTERVAL , TimeUnit . MILLISECONDS ) ; } } return null ; } } ;
|
public class Branch { /** * < p > Retrieves rewards for the current session , with a callback to perform a predefined
* action following successful report of state change . You ' ll then need to call getCredits
* in the callback to update the credit totals in your UX . < / p >
* @ param callback A { @ link BranchReferralStateChangedListener } callback instance that will
* trigger actions defined therein upon a referral state change . */
public void loadRewards ( BranchReferralStateChangedListener callback ) { } }
|
ServerRequest req = new ServerRequestGetRewards ( context_ , callback ) ; if ( ! req . constructError_ && ! req . handleErrors ( context_ ) ) { handleNewRequest ( req ) ; }
|
public class AnnotationUtil { /** * * * Note * * this method is deprecated . Please use { @ link Annotation # annotationType } instead
* Returns the class of an annotation instance
* @ param annotation the annotation instance
* @ param < T > the generic type of the annotation
* @ return the real annotation class */
@ Deprecated public static < T extends Annotation > Class < T > classOf ( Annotation annotation ) { } }
|
return ( Class < T > ) annotation . annotationType ( ) ;
|
public class SimpleExpression { /** * Create a { @ code this is null } expression
* @ return this is null */
public BooleanExpression isNull ( ) { } }
|
if ( isnull == null ) { isnull = Expressions . booleanOperation ( Ops . IS_NULL , mixin ) ; } return isnull ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.