signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class ExceptionUtil { /** * 使用运行时异常包装编译异常 * @ param throwable 异常 * @ return 运行时异常 */ public static RuntimeException wrapRuntime ( Throwable throwable ) { } }
if ( throwable instanceof RuntimeException ) { return ( RuntimeException ) throwable ; } if ( throwable instanceof Error ) { throw ( Error ) throwable ; } return new RuntimeException ( throwable ) ;
public class AbstractSimpleDAO { /** * This method must be called every time something changed in the DAO . It * triggers the writing to a file if auto - save is active . This method must be * called within a write - lock as it is not locked ! */ @ MustBeLocked ( ELockType . WRITE ) protected final void markAsChang...
// Just remember that something changed internalSetPendingChanges ( true ) ; if ( internalIsAutoSaveEnabled ( ) ) { // Auto save if ( _writeToFile ( ) . isSuccess ( ) ) internalSetPendingChanges ( false ) ; else { if ( LOGGER . isErrorEnabled ( ) ) LOGGER . error ( "The DAO of class " + getClass ( ) . getName ( ) + " s...
public class ListDatastoresResult { /** * A list of " DatastoreSummary " objects . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setDatastoreSummaries ( java . util . Collection ) } or { @ link # withDatastoreSummaries ( java . util . Collection ) } if * ...
if ( this . datastoreSummaries == null ) { setDatastoreSummaries ( new java . util . ArrayList < DatastoreSummary > ( datastoreSummaries . length ) ) ; } for ( DatastoreSummary ele : datastoreSummaries ) { this . datastoreSummaries . add ( ele ) ; } return this ;
public class CommandFactory { /** * This is used to initialise a player . * @ param teamName The team the player belongs to . * @ param isGoalie If the player is a goalie . Note : Only one goalie per team . */ public void addPlayerInitCommand ( String teamName , boolean isGoalie ) { } }
StringBuilder buf = new StringBuilder ( ) ; buf . append ( "(init " ) ; buf . append ( teamName ) ; buf . append ( " (version " ) ; if ( isGoalie ) { buf . append ( serverVersion ) ; buf . append ( ") (goalie))" ) ; } else { buf . append ( serverVersion ) ; buf . append ( "))" ) ; } fifo . add ( fifo . size ( ) , buf ....
public class Cache { /** * 查找所有符合给定模式 pattern 的 key 。 * KEYS * 匹配数据库中所有 key 。 * KEYS h ? llo 匹配 hello , hallo 和 hxllo 等 。 * KEYS h * llo 匹配 hllo 和 heeeeello 等 。 * KEYS h [ ae ] llo 匹配 hello 和 hallo , 但不匹配 hillo 。 * 特殊符号用 \ 隔开 */ public Set < String > keys ( String pattern ) { } }
Jedis jedis = getJedis ( ) ; try { return jedis . keys ( pattern ) ; } finally { close ( jedis ) ; }
public class AccountsInner { /** * Lists the Data Lake Store accounts within a specific resource group . The response includes a link to the next page of results , if any . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if paramet...
return listByResourceGroupNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < DataLakeStoreAccountBasicInner > > , Page < DataLakeStoreAccountBasicInner > > ( ) { @ Override public Page < DataLakeStoreAccountBasicInner > call ( ServiceResponse < Page < DataLakeStoreAccountBasicInn...
public class Zips { /** * 压缩 * @ param sources * 源 ( 文件或目录 ) 可以是多个文件和多个文件夹 * @ param target * 目标 ( 只能是目录 ) * @ param compressFileName * 压缩后的文件名称 ( 如果为Null , 则使用源的名称 ) * @ throws Exception */ public static void zip ( File [ ] sources , File target , String compressFileName ) throws IOException { } }
$ . notEmpty ( sources ) ; $ . notNull ( target ) ; if ( ! target . isDirectory ( ) ) { throw new IllegalArgumentException ( "The target can be a directory" ) ; } // 压缩后文件的名称 compressFileName = $ . notEmpty ( compressFileName ) ? compressFileName : sources [ 0 ] . getName ( ) + ".zip" ; FileOutputStream fileOut = new F...
public class EquirectangularTools_F32 { /** * Convert from latitude - longitude coordinates into equirectangular coordinates * @ param lat Latitude * @ param lon Longitude * @ param rect ( Output ) equirectangular coordinate */ public void latlonToEqui ( float lat , float lon , Point2D_F32 rect ) { } }
rect . x = UtilAngle . wrapZeroToOne ( lon / GrlConstants . F_PI2 + 0.5f ) * width ; rect . y = UtilAngle . reflectZeroToOne ( lat / GrlConstants . F_PI + 0.5f ) * ( height - 1 ) ;
public class Security { /** * https : / / www . owasp . org / index . php / XML _ External _ Entity _ ( XXE ) _ Prevention _ Cheat _ Sheet # JAXP _ DocumentBuilderFactory . 2C _ SAXParserFactory _ and _ DOM4J */ public static void secureSaxParser ( SAXParserFactory factory ) throws ParserConfigurationException , SAXNot...
String FEATURE = null ; // This is the PRIMARY defense . If DTDs ( doctypes ) are disallowed , almost all XML entity attacks are prevented // Xerces 2 only - http : / / xerces . apache . org / xerces2 - j / features . html # disallow - doctype - decl FEATURE = "http://apache.org/xml/features/disallow-doctype-decl" ; fa...
public class WorkflowsInner { /** * Validates the workflow . * @ param resourceGroupName The resource group name . * @ param workflowName The workflow name . * @ param validate The workflow . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgu...
return ServiceFuture . fromResponse ( validateWorkflowWithServiceResponseAsync ( resourceGroupName , workflowName , validate ) , serviceCallback ) ;
public class PathFileObject { /** * Create a PathFileObject whose binary name can be inferred from the * relative path to a sibling . */ static PathFileObject createSiblingPathFileObject ( JavacPathFileManager fileManager , final Path path , final String relativePath ) { } }
return new PathFileObject ( fileManager , path ) { @ Override String inferBinaryName ( Iterable < ? extends Path > paths ) { return toBinaryName ( relativePath , "/" ) ; } } ;
public class SerializationUtils { /** * Serialize and encode object byte [ ] . * @ param cipher the cipher * @ param object the object * @ return the byte [ ] */ public static byte [ ] serializeAndEncodeObject ( final CipherExecutor cipher , final Serializable object ) { } }
return serializeAndEncodeObject ( cipher , object , ArrayUtils . EMPTY_OBJECT_ARRAY ) ;
public class Bean { /** * Overwrite / replace the current references with the provided reference . * @ param propertyName name of the property as defined by the bean ' s schema . * @ param values override */ public void setReferences ( final String propertyName , final List < BeanId > values ) { } }
Preconditions . checkNotNull ( propertyName ) ; if ( values == null || values . size ( ) == 0 ) { references . put ( propertyName , null ) ; return ; } checkCircularReference ( values . toArray ( new BeanId [ values . size ( ) ] ) ) ; references . put ( propertyName , values ) ;
public class GeometryUtils { /** * Compute two arbitrary vectors perpendicular to the given normalized vector < code > ( x , y , z ) < / code > , and store them in < code > dest1 < / code > and < code > dest2 < / code > , * respectively . * The computed vectors will themselves be perpendicular to each another and n...
float magX = z * z + y * y ; float magY = z * z + x * x ; float magZ = y * y + x * x ; float mag ; if ( magX > magY && magX > magZ ) { dest1 . x = 0 ; dest1 . y = z ; dest1 . z = - y ; mag = magX ; } else if ( magY > magZ ) { dest1 . x = z ; dest1 . y = 0 ; dest1 . z = x ; mag = magY ; } else { dest1 . x = y ; dest1 . ...
public class ExtendedPalette { /** * factory method for the removeAll component * @ return removeAll component */ protected Component newRemoveAllComponent ( ) { } }
return new PaletteButton ( "removeAllButton" ) { private static final long serialVersionUID = 1L ; protected void onComponentTag ( ComponentTag tag ) { super . onComponentTag ( tag ) ; tag . getAttributes ( ) . put ( "onclick" , getRemoveAllOnClickJS ( ) ) ; } } ;
public class JQMPage { /** * Forcefully recalculates ( if defined , and just once ) page content height * ( needed when content area size is changed , because there is no good way to get resize * notification for DOM elements ) . */ public void recalcContentHeightPercent ( ) { } }
if ( stopPartsPositioning ) return ; if ( ! isVisible ( ) ) return ; Element contentElt = content . getElement ( ) ; if ( contentHeightPercent > 0 ) { final JQMHeader header = getHeader ( ) ; final JQMFooter footer = getFooter ( ) ; int headerH = header == null || isFixedToolbarsHidden ( ) ? 0 : header . getOffsetHeigh...
public class XmlParser { /** * Parse the content of an element . * < pre > * [ 43 ] content : : = ( element | CharData | Reference * | CDSect | PI | Comment ) * * [ 67 ] Reference : : = EntityRef | CharRef * < / pre > * NOTE : consumes ETtag . */ private void parseContent ( ) throws Exception { } }
char c ; while ( true ) { // consume characters ( or ignorable whitspace ) until delimiter parseCharData ( ) ; // Handle delimiters c = readCh ( ) ; switch ( c ) { case '&' : // Found " & " c = readCh ( ) ; if ( c == '#' ) { parseCharRef ( ) ; } else { unread ( c ) ; parseEntityRef ( true ) ; } isDirtyCurrentElement = ...
public class SofaRegistrySubscribeCallback { /** * 增加监听器 , 一个dataId增加多的ConsumerConfig的listener * @ param dataId 配置Id * @ param consumerConfig 服务调用者信息 * @ param listener 服务列表监听器 */ void addProviderInfoListener ( String dataId , ConsumerConfig consumerConfig , ProviderInfoListener listener ) { } }
providerInfoListeners . put ( consumerConfig , listener ) ; // 同一个key重复订阅多次 , 提醒用户需要检查一下是否是代码问题 if ( LOGGER . isWarnEnabled ( consumerConfig . getAppName ( ) ) && providerInfoListeners . size ( ) > 5 ) { LOGGER . warnWithApp ( consumerConfig . getAppName ( ) , "Duplicate to add provider listener of {} " + "more than 5 ...
public class ComputeNodesImpl { /** * Enables task scheduling on the specified compute node . * You can enable task scheduling on a node only if its current scheduling state is disabled . * @ param poolId The ID of the pool that contains the compute node . * @ param nodeId The ID of the compute node on which you ...
enableSchedulingWithServiceResponseAsync ( poolId , nodeId , computeNodeEnableSchedulingOptions ) . toBlocking ( ) . single ( ) . body ( ) ;
public class LongTupleIterables { /** * Returns an iterable returning an iterator that returns * { @ link MutableLongTuple } s up to the given maximum values , * in colexicographical order . < br > * < br > * Copies of the given tuples will be stored internally . < br > * < br > * Also see < a href = " . . ...
return iterable ( Order . COLEXICOGRAPHICAL , LongTuples . zero ( max . getSize ( ) ) , max ) ;
public class KeyGenerator { /** * Initializes this key generator for a certain keysize , using a * user - provided source of randomness . * @ param keysize the keysize . This is an algorithm - specific metric , * specified in number of bits . * @ param random the source of randomness for this key generator * ...
if ( serviceIterator == null ) { spi . engineInit ( keysize , random ) ; return ; } RuntimeException failure = null ; KeyGeneratorSpi mySpi = spi ; do { try { mySpi . engineInit ( keysize , random ) ; initType = I_SIZE ; initKeySize = keysize ; initParams = null ; initRandom = random ; return ; } catch ( RuntimeExcepti...
public class MaintenanceWindowLayout { /** * Get list of all time zone offsets supported . */ private static List < String > getAllTimeZones ( ) { } }
final List < String > lst = ZoneId . getAvailableZoneIds ( ) . stream ( ) . map ( id -> ZonedDateTime . now ( ZoneId . of ( id ) ) . getOffset ( ) . getId ( ) . replace ( "Z" , "+00:00" ) ) . distinct ( ) . collect ( Collectors . toList ( ) ) ; lst . sort ( null ) ; return lst ;
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public String convertLineDataObjectPositionMigrationTempOrientToString ( EDataType eDataType , Object instanceValue ) { } }
return instanceValue == null ? null : instanceValue . toString ( ) ;
public class SoapClient { /** * 执行Webservice请求 , 既发送SOAP内容 * @ return 返回结果 */ public SOAPMessage sendForMessage ( ) { } }
final HttpResponse res = sendForResponse ( ) ; final MimeHeaders headers = new MimeHeaders ( ) ; for ( Entry < String , List < String > > entry : res . headers ( ) . entrySet ( ) ) { if ( StrUtil . isNotEmpty ( entry . getKey ( ) ) ) { headers . setHeader ( entry . getKey ( ) , CollUtil . get ( entry . getValue ( ) , 0...
public class BigtableTable { /** * { @ inheritDoc } */ @ Override public boolean checkAndMutate ( final byte [ ] row , final byte [ ] family , final byte [ ] qualifier , final CompareOperator compareOp , final byte [ ] value , final RowMutations rm ) throws IOException { } }
return super . checkAndMutate ( row , family , qualifier , toCompareOp ( compareOp ) , value , rm ) ;
public class ConfigClient { /** * Creates a new exclusion in a specified parent resource . Only log entries belonging to that * resource can be excluded . You can have up to 10 exclusions in a resource . * < p > Sample code : * < pre > < code > * try ( ConfigClient configClient = ConfigClient . create ( ) ) { ...
CreateExclusionRequest request = CreateExclusionRequest . newBuilder ( ) . setParent ( parent ) . setExclusion ( exclusion ) . build ( ) ; return createExclusion ( request ) ;
public class IOUtils { /** * Serialized gzipped java object to an ObjectOutputStream . The stream remains * open . * @ param o * the java object * @ param out * the output stream */ public static void writeGzipObjectToStream ( final Object o , OutputStream out ) { } }
out = new BufferedOutputStream ( out ) ; try { out = new GZIPOutputStream ( out , true ) ; final ObjectOutputStream oos = new ObjectOutputStream ( out ) ; oos . writeObject ( o ) ; oos . flush ( ) ; } catch ( final IOException e ) { e . printStackTrace ( ) ; }
public class FileBasedCollection { /** * Create a Rome Atom entry based on a Roller entry . Content is escaped . Link is stored as * rel = alternate link . */ private Entry loadAtomEntry ( final InputStream in ) { } }
try { return Atom10Parser . parseEntry ( new BufferedReader ( new InputStreamReader ( in , "UTF-8" ) ) , null , Locale . US ) ; } catch ( final Exception e ) { e . printStackTrace ( ) ; return null ; }
public class StringConverter { /** * Counts Character c in String s * @ param s Java string * @ param c character to count * @ return int count */ static int count ( final String s , final char c ) { } }
int pos = 0 ; int count = 0 ; if ( s != null ) { while ( ( pos = s . indexOf ( c , pos ) ) > - 1 ) { count ++ ; pos ++ ; } } return count ;
public class DbTenantQueryImpl { /** * results / / / / / */ @ Override public long executeCount ( CommandContext commandContext ) { } }
checkQueryOk ( ) ; DbReadOnlyIdentityServiceProvider identityProvider = getIdentityProvider ( commandContext ) ; return identityProvider . findTenantCountByQueryCriteria ( this ) ;
public class CallOptionsBenchmark { /** * Setup . */ @ Setup public void setUp ( ) throws Exception { } }
customOptions = new ArrayList < > ( customOptionsCount ) ; for ( int i = 0 ; i < customOptionsCount ; i ++ ) { customOptions . add ( CallOptions . Key . createWithDefault ( "name " + i , "defaultvalue" ) ) ; } allOpts = CallOptions . DEFAULT ; for ( int i = 0 ; i < customOptionsCount ; i ++ ) { allOpts = allOpts . with...
public class ProcessUtils { /** * Null - safe method to determine whether the given { @ link Process } is still running . * @ param process { @ link Process } object to evaluate if running . * @ return a boolean value indicating whether the given { @ link Process } is still running . * @ see java . lang . Process...
try { return ( process != null && process . exitValue ( ) == Double . NaN ) ; } catch ( IllegalThreadStateException ignore ) { return true ; }
public class BaseTable { /** * Create a new empty table using the definition in the record . * @ exception DBException Open errors passed from SQL . * @ return true if successful . */ public boolean loadInitialData ( ) throws DBException { } }
BaseTable table = this ; Record record = table . getRecord ( ) ; Task task = null ; if ( Record . findRecordOwner ( record ) != null ) task = Record . findRecordOwner ( record ) . getTask ( ) ; if ( task == null ) return false ; while ( ( ( record . getDatabaseType ( ) & DBConstants . SHARED_TABLE ) != 0 ) && ( ( recor...
public class SqlValidatorImpl { /** * Validates updates against the constraint of a modifiable view . * @ param validatorTable A { @ link SqlValidatorTable } that may wrap a * ModifiableViewTable * @ param update The UPDATE parse tree node * @ param targetRowType The target type */ private void checkConstraint ...
final ModifiableViewTable modifiableViewTable = validatorTable . unwrap ( ModifiableViewTable . class ) ; if ( modifiableViewTable != null ) { final Table table = modifiableViewTable . unwrap ( Table . class ) ; final RelDataType tableRowType = table . getRowType ( typeFactory ) ; final Map < Integer , RexNode > projec...
public class ClassFactory { /** * TODO : move media type specific into a new class that Reader , Writer factory derives from */ protected T get ( Class < ? > type , Class < ? extends T > byDefinition , InjectionProvider provider , RoutingContext routeContext , MediaType [ ] mediaTypes ) throws ClassFactoryException , C...
Class < ? extends T > clazz = byDefinition ; // No class defined . . . try by type if ( clazz == null ) { clazz = get ( type ) ; } // try with media type . . . if ( clazz == null && mediaTypes != null && mediaTypes . length > 0 ) { for ( MediaType mediaType : mediaTypes ) { clazz = get ( mediaType ) ; if ( clazz != nul...
public class ExampleColorHistogramLookup { /** * HSV stores color information in Hue and Saturation while intensity is in Value . This computes a 2D histogram * from hue and saturation only , which makes it lighting independent . */ public static List < double [ ] > coupledHueSat ( List < String > images ) { } }
List < double [ ] > points = new ArrayList < > ( ) ; Planar < GrayF32 > rgb = new Planar < > ( GrayF32 . class , 1 , 1 , 3 ) ; Planar < GrayF32 > hsv = new Planar < > ( GrayF32 . class , 1 , 1 , 3 ) ; for ( String path : images ) { BufferedImage buffered = UtilImageIO . loadImage ( path ) ; if ( buffered == null ) thro...
public class ByteBufUtil { /** * Returns the reader index of needle in haystack , or - 1 if needle is not in haystack . */ public static int indexOf ( ByteBuf needle , ByteBuf haystack ) { } }
// TODO : maybe use Boyer Moore for efficiency . int attempts = haystack . readableBytes ( ) - needle . readableBytes ( ) + 1 ; for ( int i = 0 ; i < attempts ; i ++ ) { if ( equals ( needle , needle . readerIndex ( ) , haystack , haystack . readerIndex ( ) + i , needle . readableBytes ( ) ) ) { return haystack . reade...
public class ScreenRecordingUploadOptions { /** * Builds a map , which is ready to be passed to the subordinated * Appium API . * @ return arguments mapping . */ public Map < String , Object > build ( ) { } }
final ImmutableMap . Builder < String , Object > builder = ImmutableMap . builder ( ) ; ofNullable ( remotePath ) . map ( x -> builder . put ( "remotePath" , x ) ) ; ofNullable ( user ) . map ( x -> builder . put ( "user" , x ) ) ; ofNullable ( pass ) . map ( x -> builder . put ( "pass" , x ) ) ; ofNullable ( method ) ...
public class AbstractFachwert { /** * Liefert die einzelnen Attribute eines Fachwertes als Map . Bei einem * einzelnen Wert wird als Default - Implementierung der Klassenname und * die toString ( ) - Implementierung herangezogen . * @ return Attribute als Map */ @ Override public Map < String , Object > toMap ( )...
Map < String , Object > map = new HashMap < > ( ) ; map . put ( this . getClass ( ) . getSimpleName ( ) . toLowerCase ( ) , toString ( ) ) ; return map ;
public class AbstractJSON { /** * Fires a start of object event . */ protected static void fireObjectStartEvent ( JsonConfig jsonConfig ) { } }
if ( jsonConfig . isEventTriggeringEnabled ( ) ) { for ( Iterator listeners = jsonConfig . getJsonEventListeners ( ) . iterator ( ) ; listeners . hasNext ( ) ; ) { JsonEventListener listener = ( JsonEventListener ) listeners . next ( ) ; try { listener . onObjectStart ( ) ; } catch ( RuntimeException e ) { log . warn (...
public class FilterFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link Filter } { @ code > } } */ @ XmlElementDecl ( namespace = "" , name = "filter" ) public JAXBElement < Filter > createFilter ( Filter value ) { } }
return new JAXBElement < Filter > ( _Filter_QNAME , Filter . class , null , value ) ;
public class AutoReconnectGateway { /** * Get the session . If the session still null or not in bound state , then IO exception will be thrown . * @ return the valid session . * @ throws IOException if there is no valid session or session creation is invalid . */ private SMPPSession getSession ( ) throws IOExceptio...
if ( session == null ) { LOGGER . info ( "Initiate session for the first time to {}:{}" , remoteIpAddress , remotePort ) ; session = newSession ( ) ; } else if ( ! session . getSessionState ( ) . isBound ( ) ) { throw new IOException ( "We have no valid session yet" ) ; } return session ;
public class LogServlet { /** * This method helps to display More log information of the node machine . * @ param fileName * It is log file name available in node machine current directory Logs folder , it is used to identify * the current file to display in the web page . * @ param url * It is node machine u...
FileBackedStringBuffer buffer = new FileBackedStringBuffer ( ) ; int index = retrieveIndexValueFromFileName ( fileName ) ; index ++ ; File logFileName = retrieveFileFromLogsFolder ( Integer . toString ( index ) ) ; if ( logFileName == null ) { return "" ; } // TODO put this html code in a template buffer . append ( "<f...
public class CmsContainerpageController { /** * Enables the favorites editing drag and drop controller . < p > * @ param enable if < code > true < / code > favorites editing will enabled , otherwise disabled * @ param dndController the favorites editing drag and drop controller */ public void enableFavoriteEditing ...
if ( m_dndHandler . isDragging ( ) ) { // never switch drag and drop controllers while dragging return ; } if ( enable ) { m_dndHandler . setController ( dndController ) ; } else { m_dndHandler . setController ( m_cntDndController ) ; }
public class ESJPCompiler { /** * All stored compiled ESJP ' s classes in the eFaps database are stored in * the mapping { @ link # class2id } . If a ESJP ' s program is compiled and * stored with { @ link ESJPCompiler . StoreObject # write ( ) } , the class is * removed . After the compile , { @ link ESJPCompile...
try { final QueryBuilder queryBldr = new QueryBuilder ( this . classType ) ; final MultiPrintQuery multi = queryBldr . getPrint ( ) ; multi . addAttribute ( "Name" ) ; multi . executeWithoutAccessCheck ( ) ; while ( multi . next ( ) ) { final String name = multi . < String > getAttribute ( "Name" ) ; final Long id = mu...
public class UnsafeOperations { /** * Performs a deep copy of the object . With a deep copy all references from the object are also copied . * The identity of referenced objects is preserved , so , for example , if the object graph contains two * references to the same object , the cloned object will preserve this ...
return deepCopy ( obj , new IdentityHashMap < Object , Object > ( 10 ) ) ;
public class EventImpl { /** * { @ inheritDoc } */ public void setProperty ( ReservedKey key , Object value ) { } }
this . properties . put ( key . getName ( ) , value ) ;
public class ThreadUtils { /** * Logs a stack trace for all threads currently running in the JVM , similar to jstack . */ public static void logAllThreads ( ) { } }
StringBuilder sb = new StringBuilder ( "Dumping all threads:\n" ) ; for ( Thread t : Thread . getAllStackTraces ( ) . keySet ( ) ) { sb . append ( formatStackTrace ( t ) ) ; } LOG . info ( sb . toString ( ) ) ;
public class CertificateValidityMarshaller { /** * Marshall the given parameter object . */ public void marshall ( CertificateValidity certificateValidity , ProtocolMarshaller protocolMarshaller ) { } }
if ( certificateValidity == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( certificateValidity . getNotBefore ( ) , NOTBEFORE_BINDING ) ; protocolMarshaller . marshall ( certificateValidity . getNotAfter ( ) , NOTAFTER_BINDING ) ; } catch (...
public class AbstractClassFileWriter { /** * Writes the class file to disk in the given directory . * @ param targetDir The target directory * @ param classWriter The current class writer * @ param className The class name * @ throws IOException if there is a problem writing the class to disk */ protected void ...
if ( targetDir != null ) { String fileName = className . replace ( '.' , '/' ) + ".class" ; File targetFile = new File ( targetDir , fileName ) ; targetFile . getParentFile ( ) . mkdirs ( ) ; try ( OutputStream outputStream = Files . newOutputStream ( targetFile . toPath ( ) ) ) { writeClassToDisk ( outputStream , clas...
public class Table { /** * Applies the operation in { @ code doable } to every row in the table */ public void doWithRows ( Consumer < Row > doable ) { } }
Row row = new Row ( this ) ; while ( row . hasNext ( ) ) { doable . accept ( row . next ( ) ) ; }
public class SimpleVersionedSerialization { /** * Serializes the version and datum into a byte array . The first four bytes will be occupied by * the version ( as returned by { @ link SimpleVersionedSerializer # getVersion ( ) } ) , * written in < i > big - endian < / i > encoding . The remaining bytes will be the ...
checkNotNull ( serializer , "serializer" ) ; checkNotNull ( datum , "datum" ) ; final byte [ ] data = serializer . serialize ( datum ) ; final byte [ ] versionAndData = new byte [ data . length + 8 ] ; final int version = serializer . getVersion ( ) ; versionAndData [ 0 ] = ( byte ) ( version >> 24 ) ; versionAndData [...
public class CmsCalendarWidget { /** * Creates the time in milliseconds from the given parameter . < p > * @ param messages the messages that contain the time format definitions * @ param dateString the String representation of the date * @ param useTime true if the time should be parsed , too , otherwise false ...
long dateLong = 0 ; // substitute some chars because calendar syntax ! = DateFormat syntax String dateFormat = messages . key ( org . opencms . workplace . Messages . GUI_CALENDAR_DATE_FORMAT_0 ) ; if ( useTime ) { dateFormat += " " + messages . key ( org . opencms . workplace . Messages . GUI_CALENDAR_TIME_FORMAT_0 ) ...
public class CommerceVirtualOrderItemPersistenceImpl { /** * Returns the commerce virtual order item where commerceOrderItemId = & # 63 ; or returns < code > null < / code > if it could not be found , optionally using the finder cache . * @ param commerceOrderItemId the commerce order item ID * @ param retrieveFrom...
Object [ ] finderArgs = new Object [ ] { commerceOrderItemId } ; Object result = null ; if ( retrieveFromCache ) { result = finderCache . getResult ( FINDER_PATH_FETCH_BY_COMMERCEORDERITEMID , finderArgs , this ) ; } if ( result instanceof CommerceVirtualOrderItem ) { CommerceVirtualOrderItem commerceVirtualOrderItem =...
public class CheckSignInApi { /** * 处理signInResult回调 * @ param result 回调的signInResult实例 */ private void disposeCheckSignInResult ( SignInResult result ) { } }
if ( result == null ) { HMSAgentLog . e ( "result is null" ) ; onCheckSignInResult ( HMSAgent . AgentResultCode . RESULT_IS_NULL , null ) ; return ; } Status status = result . getStatus ( ) ; if ( status == null ) { HMSAgentLog . e ( "status is null" ) ; onCheckSignInResult ( HMSAgent . AgentResultCode . STATUS_IS_NULL...
public class AtomicBiInteger { /** * Atomically sets the hi and lo values to the given updated values only if * the current hi and lo values { @ code = = } the expected hi and lo values . * @ param expectHi the expected hi value * @ param hi the new hi value * @ param expectLo the expected lo value * @ param ...
long encoded = encode ( expectHi , expectLo ) ; long update = encode ( hi , lo ) ; return compareAndSet ( encoded , update ) ;
public class Payments { /** * 根据tradeNumber查询退款记录 * @ param tradeNumber * @ return */ public RefundQuery refundQueryByTradeNumber ( String tradeNumber ) { } }
RefundQueryRequestWrapper refundQueryRequestWrapper = new RefundQueryRequestWrapper ( ) ; refundQueryRequestWrapper . setTradeNumber ( tradeNumber ) ; return refundQuery ( refundQueryRequestWrapper ) ;
public class IoTDataManager { /** * Get the manger instance responsible for the given connection . * @ param connection the XMPP connection . * @ return a manager instance . */ public static synchronized IoTDataManager getInstanceFor ( XMPPConnection connection ) { } }
IoTDataManager manager = INSTANCES . get ( connection ) ; if ( manager == null ) { manager = new IoTDataManager ( connection ) ; INSTANCES . put ( connection , manager ) ; } return manager ;
public class WhileyFileParser { /** * Parse a reference type , which is of the form : * < pre > * ReferenceType : : = ' & ' Type * | ' & ' Lifetime ' : ' Type * Lifetime : : = Identifier | ' this ' | ' * ' * < / pre > * @ return */ private Type parseReferenceType ( EnclosingScope scope ) { } }
int start = index ; match ( Ampersand ) ; // Try to parse an annotated lifetime int backtrack = index ; Identifier lifetimeIdentifier = parseOptionalLifetimeIdentifier ( scope , false ) ; if ( lifetimeIdentifier != null ) { // We cannot allow a newline after the colon , as it would // unintentionally match a return typ...
public class Piece { /** * Read a piece block from the underlying byte storage . * This is the public method for reading this piece ' s data , and it will * only succeed if the piece is complete and valid on disk , thus ensuring * any data that comes out of this function is valid piece data we can send * to oth...
if ( ! this . valid ) { throw new IllegalStateException ( "Attempting to read an " + "known-to-be invalid piece!" ) ; } return this . _read ( offset , length , block ) ;
public class SerializationUtils { /** * Deserialize a byte array back to an object . * This method uses Kryo lib . * @ param data * @ param clazz * @ return */ public static < T > T fromByteArrayKryo ( byte [ ] data , Class < T > clazz ) { } }
return fromByteArrayKryo ( data , clazz , null ) ;
public class EnumHelper { /** * Get the enum value with the passed ID * @ param < ENUMTYPE > * The enum type * @ param aClass * The enum class * @ param nID * The ID to search * @ return < code > null < / code > if no enum item with the given ID is present . */ @ Nullable public static < ENUMTYPE extends ...
return getFromIDOrDefault ( aClass , nID , null ) ;
public class Jdk14Logger { /** * Log a message and exception with trace log level . */ public void trace ( Object message , Throwable exception ) { } }
log ( Level . FINEST , String . valueOf ( message ) , exception ) ;
public class SubscriptionService { /** * registers with the EMSP with passed as argument the endpoints of this * EMSP are stored in the database , as well as the definitive token * @ param tokenProvider */ @ Transactional public void register ( Subscription subscription ) { } }
Endpoint versionsEndpoint = subscription . getEndpoint ( ModuleIdentifier . VERSIONS ) ; if ( versionsEndpoint == null ) { return ; } LOG . info ( "Registering, get versions from endpoint " + versionsEndpoint . getUrl ( ) ) ; Version version = findHighestMutualVersion ( getVersions ( versionsEndpoint . getUrl ( ) , sub...
public class PTBConstituent { /** * getter for misc - gets Miscellaneous * @ generated * @ return value of the feature */ public String getMisc ( ) { } }
if ( PTBConstituent_Type . featOkTst && ( ( PTBConstituent_Type ) jcasType ) . casFeat_misc == null ) jcasType . jcas . throwFeatMissing ( "misc" , "de.julielab.jules.types.PTBConstituent" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( PTBConstituent_Type ) jcasType ) . casFeatCode_misc ) ;
public class AWSWAFRegionalClient { /** * Returns the < a > RuleGroup < / a > that is specified by the < code > RuleGroupId < / code > that you included in the * < code > GetRuleGroup < / code > request . * To view the rules in a rule group , use < a > ListActivatedRulesInRuleGroup < / a > . * @ param getRuleGrou...
request = beforeClientExecution ( request ) ; return executeGetRuleGroup ( request ) ;
public class InboxWrapper { /** * Adds a query callback to handle a later message . * @ param id the unique query identifier * @ param result the application ' s callback for the result */ @ Override public QueryRefAmp addQuery ( String address , ResultChain < ? > result , ClassLoader loader ) { } }
return delegate ( ) . addQuery ( address , result , loader ) ;
public class WSURI { /** * Convert to WebSocket < code > ws < / code > or < code > wss < / code > scheme URIs * Converting < code > http < / code > and < code > https < / code > URIs to their WebSocket equivalent * @ param inputUri the input URI * @ return the WebSocket scheme URI for the input URI . * @ throws...
Objects . requireNonNull ( inputUri , "Input URI must not be null" ) ; String httpScheme = inputUri . getScheme ( ) ; if ( "ws" . equalsIgnoreCase ( httpScheme ) || "wss" . equalsIgnoreCase ( httpScheme ) ) { // keep as - is return inputUri ; } if ( "http" . equalsIgnoreCase ( httpScheme ) ) { // convert to ws return n...
public class TransactionInput { /** * For a connected transaction , runs the script against the connected pubkey and verifies they are correct . * @ throws ScriptException if the script did not verify . * @ throws VerificationException If the outpoint doesn ' t match the given output . */ public void verify ( ) thr...
final Transaction fromTx = getOutpoint ( ) . fromTx ; long spendingIndex = getOutpoint ( ) . getIndex ( ) ; checkNotNull ( fromTx , "Not connected" ) ; final TransactionOutput output = fromTx . getOutput ( ( int ) spendingIndex ) ; verify ( output ) ;
public class BatchLocationServiceImpl { /** * Note : This method compares the jobexecution ' s REST url with this server ' s REST url . * If they are different , and the jobexecution ' s REST url is equal to the * BatchRestUrlUnavailable constant , that means the jobexecution was created * prior to batchManagemen...
return jobExecution . getServerId ( ) == null || jobExecution . getRestUrl ( ) == null // If server ID or rest URL were never set , we can treat as local || getBatchRestUrl ( ) . equals ( jobExecution . getRestUrl ( ) ) || ( BatchRestUrlUnavailable . equals ( jobExecution . getRestUrl ( ) ) && getServerId ( ) . equals ...
public class AbstractResourceBundleCli { /** * Determines if the given { @ code bundleClass } is { @ link NlsBundleOptions # productive ( ) productive } . * @ param bundleClass is the { @ link Class } to test . * @ return { @ code true } if { @ link NlsBundleOptions # productive ( ) productive } , { @ code false } ...
NlsBundleOptions options = bundleClass . getAnnotation ( NlsBundleOptions . class ) ; if ( options != null ) { return options . productive ( ) ; } return true ;
public class FileMask { /** * Adds a filetype " dot " extension to filter against . * Par example : le code suivant crera un filtre qui filtrera * tout les fichier a l ' exception des " . jpg " et " . tif " : * FileMasque filter = new FileMasque ( ) ; * filter . addExtension ( " jpg " ) ; * filter . addExtens...
if ( filters == null ) { filters = new Hashtable < > ( 5 ) ; } filters . put ( extension . toLowerCase ( ) , this ) ; fullDescription = null ;
public class SimpleWebServlet { /** * Use the notifyStatus ( String event ) method in order to trigger an update at the client ' s page when needed for any new request . * Here will be used for Bye or new Call requests . */ protected void notifyStatus ( String event ) { } }
BlockingQueue < String > eventsQueue = ( LinkedBlockingQueue < String > ) getServletContext ( ) . getAttribute ( "eventsQueue" ) ; // if ( eventsQueue = = null ) eventsQueue = new LinkedBlockingQueue < String > ( ) ; // getServletContext ( ) . setAttribute ( " eventsQueue " , eventsQueue ) ; try { eventsQueue . put ( e...
public class Servlets { /** * 设置 ETag Header 。 * @ param response * 响应 * @ param etag * 内容的ETag */ public static void setEtag ( final HttpServletResponse response , final String etag ) { } }
response . setHeader ( HttpHeaders . ETAG , etag ) ;
public class Expressions { /** * Create a new Template expression * @ param cl type of expression * @ param template template * @ param args template parameters * @ return template expression */ public static < T extends Comparable < ? > > DateTimeTemplate < T > dateTimeTemplate ( Class < ? extends T > cl , Tem...
return dateTimeTemplate ( cl , template , ImmutableList . copyOf ( args ) ) ;
public class GetVoiceConnectorOriginationRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( GetVoiceConnectorOriginationRequest getVoiceConnectorOriginationRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( getVoiceConnectorOriginationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getVoiceConnectorOriginationRequest . getVoiceConnectorId ( ) , VOICECONNECTORID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException (...
public class Cursor { /** * A cursor is initially positioned before its first row ; the first call to * next makes the first row the current row ; the second call makes the * second row the current row , etc . * < P > If an input stream from the previous row is open , it is implicitly * closed . The ResultSet '...
// if we closed everything up after the last call to next ( ) , // table will be null here and we should bail immediately if ( _table == null ) { return null ; } if ( _result == null ) { if ( _qbeObject != null ) { PreparedStatement qbeStmt = _conn . prepareStatement ( _query ) ; _table . bindQueryVariables ( qbeStmt ,...
public class AwsAsgUtil { /** * Gets the task that updates the ASG information periodically . * @ return TimerTask that updates the ASG information periodically . */ private TimerTask getASGUpdateTask ( ) { } }
return new TimerTask ( ) { @ Override public void run ( ) { try { if ( ! serverConfig . shouldUseAwsAsgApi ( ) ) { // Disabled via the config , no - op . return ; } // First get the active ASG names Set < CacheKey > cacheKeys = getCacheKeys ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Trying to refresh...
public class AttributeListImpl { /** * Get the type of an attribute ( by position ) . * @ param i The position of the attribute in the list . * @ return The attribute type as a string ( " NMTOKEN " for an * enumeration , and " CDATA " if no declaration was * read ) , or null if there is no attribute at * that...
if ( i < 0 || i >= types . size ( ) ) { return null ; } return types . get ( i ) ;
public class JavaDocText { /** * This method removes the additional astrisks from the java doc . * @ param javaDoc the string builder containing the javadoc . */ private void stripAsterisk ( final StringBuilder javaDoc ) { } }
int index = javaDoc . indexOf ( "*" ) ; while ( index != - 1 ) { javaDoc . replace ( index , index + 1 , "" ) ; index = javaDoc . indexOf ( "*" ) ; }
public class Calc { /** * Center the atoms at the Centroid , if the centroid is already know . * @ param atomSet * a set of Atoms * @ return an Atom representing the Centroid of the set of atoms * @ throws StructureException */ public static final Atom [ ] centerAtoms ( Atom [ ] atomSet , Atom centroid ) throws...
Atom shiftVector = getCenterVector ( atomSet , centroid ) ; Atom [ ] newAtoms = new AtomImpl [ atomSet . length ] ; for ( int i = 0 ; i < atomSet . length ; i ++ ) { Atom a = atomSet [ i ] ; Atom n = add ( a , shiftVector ) ; newAtoms [ i ] = n ; } return newAtoms ;
public class Util { /** * Converts a string into 128 - bit AES key . * @ since 1.308 */ @ Nonnull public static SecretKey toAes128Key ( @ Nonnull String s ) { } }
try { // turn secretKey into 256 bit hash MessageDigest digest = MessageDigest . getInstance ( "SHA-256" ) ; digest . reset ( ) ; digest . update ( s . getBytes ( StandardCharsets . UTF_8 ) ) ; // Due to the stupid US export restriction JDK only ships 128bit version . return new SecretKeySpec ( digest . digest ( ) , 0 ...
public class Tuple16 { /** * Skip 5 degrees from this tuple . */ public final Tuple11 < T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 > skip5 ( ) { } }
return new Tuple11 < > ( v6 , v7 , v8 , v9 , v10 , v11 , v12 , v13 , v14 , v15 , v16 ) ;
public class BuilderCommonMemberFormatter { /** * Get mutable values . This returns message builders for messages , collection * builders for collections , and the normal immutable value for everything * else . * @ param message The message to get mutable getters for . * @ param field The field to generate gett...
if ( field . field ( ) . getDescriptor ( ) instanceof PPrimitive || field . type ( ) == PType . ENUM ) { // The other fields will have ordinary non - mutable getters . appendGetter ( field ) ; return ; } BlockCommentBuilder comment = new BlockCommentBuilder ( writer ) ; comment . commentRaw ( "Get the builder for the c...
public class SqlAgentFactoryImpl { /** * { @ inheritDoc } * @ see jp . co . future . uroborosql . SqlAgentFactory # getDefaultInsertsType ( ) */ @ Override public InsertsType getDefaultInsertsType ( ) { } }
return InsertsType . valueOf ( getDefaultProps ( ) . getOrDefault ( PROPS_KEY_DEFAULT_INSERTS_TYPE , InsertsType . BULK . toString ( ) ) ) ;
public class PropertiesUtils { /** * Loads a comma - separated list of strings from Properties . Commas may be quoted if needed , e . g . : * property1 = value1 , value2 , " a quoted value " , ' another quoted value ' * getStringArray ( props , " property1 " ) should return the same thing as * new String [ ] { " ...
String [ ] results = MetaClass . cast ( props . getProperty ( key ) , String [ ] . class ) ; if ( results == null ) { results = new String [ ] { } ; } return results ;
public class InternalSARLLexer { /** * $ ANTLR start " T _ _ 128" */ public final void mT__128 ( ) throws RecognitionException { } }
try { int _type = T__128 ; int _channel = DEFAULT_TOKEN_CHANNEL ; // InternalSARL . g : 114:8 : ( ' if ' ) // InternalSARL . g : 114:10 : ' if ' { match ( "if" ) ; } state . type = _type ; state . channel = _channel ; } finally { }
public class EnterpriseConnectionMatcher { /** * Tries to find a valid domain with the given input . * @ param email to search the Domain for . * @ return a Connection if found , null otherwise . */ @ Nullable public OAuthConnection parse ( String email ) { } }
String domain = extractDomain ( email ) ; if ( domain == null ) { return null ; } domain = domain . toLowerCase ( ) ; for ( OAuthConnection c : connections ) { String mainDomain = domainForConnection ( c ) ; if ( domain . equalsIgnoreCase ( mainDomain ) ) { return c ; } List < String > aliases = c . valueForKey ( DOMAI...
public class SnackbarWrapper { /** * Adds multiple callbacks to the Snackbar for various events . * @ param callbacks The callbacks to be added . * @ return This instance . */ @ NonNull @ SuppressWarnings ( "WeakerAccess" ) public SnackbarWrapper addCallbacks ( List < Callback > callbacks ) { } }
int callbacksSize = callbacks . size ( ) ; for ( int i = 0 ; i < callbacksSize ; i ++ ) { addCallback ( callbacks . get ( i ) ) ; } return this ;
public class WorkQueueManager { /** * Main worker thread routine . * @ param req * @ param ioe */ void workerRun ( TCPBaseRequestContext req , IOException ioe ) { } }
if ( null == req || req . getTCPConnLink ( ) . isClosed ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Ignoring IO on closed socket: " + req ) ; } return ; } try { if ( ioe == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { T...
public class TagNameFactoryImpl { /** * { @ inheritDoc } */ @ Override public String getTagDisplayValue ( final String path , final String value ) { } }
final FieldPath fieldPath = getFieldPath ( path ) ; return fieldDisplayNameGenerator . generateDisplayValue ( fieldPath , value , FieldType . STRING ) ;
public class RandomVideoCollectionGenerator { /** * Initialize VIDEO _ INFO data . */ private void initializeVideoInfo ( ) { } }
VIDEO_INFO . put ( "The Big Bang Theory" , "http://thetvdb.com/banners/_cache/posters/80379-9.jpg" ) ; VIDEO_INFO . put ( "Breaking Bad" , "http://thetvdb.com/banners/_cache/posters/81189-22.jpg" ) ; VIDEO_INFO . put ( "Arrow" , "http://thetvdb.com/banners/_cache/posters/257655-15.jpg" ) ; VIDEO_INFO . put ( "Game of T...
public class responderglobal_binding { /** * Use this API to fetch a responderglobal _ binding resource . */ public static responderglobal_binding get ( nitro_service service ) throws Exception { } }
responderglobal_binding obj = new responderglobal_binding ( ) ; responderglobal_binding response = ( responderglobal_binding ) obj . get_resource ( service ) ; return response ;
public class SignalUtil { /** * Logs a warning message . If the elapsed time is greater than * { @ link # SIGNAL _ LOG _ QUIESCE _ TIMEOUT _ MINUTES } then the log message will indicate that wait * logging for the thread is being quiesced , and a value of true is returned . Otherwise , false * is returned . * @...
long elapsed = ( System . currentTimeMillis ( ) - start ) / 1000 ; boolean quiesced = false ; if ( elapsed <= SIGNAL_LOG_QUIESCE_TIMEOUT_MINUTES * 60 ) { ArrayList < Object > args = new ArrayList < Object > ( ) ; args . add ( Thread . currentThread ( ) . getId ( ) ) ; args . add ( elapsed ) ; args . add ( waitObj ) ; i...
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcMeasureValue ( ) { } }
if ( ifcMeasureValueEClass == null ) { ifcMeasureValueEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 962 ) ; } return ifcMeasureValueEClass ;
public class RangeStreamer { /** * For testing purposes */ Multimap < String , Map . Entry < InetAddress , Collection < Range < Token > > > > toFetch ( ) { } }
return toFetch ;
public class SharedPreferenceUtils { /** * Put the value in given shared preference * @ param key * the name of the preference to save * @ param value * the value to save */ public void put ( String key , Object value ) { } }
if ( value . getClass ( ) . equals ( String . class ) ) { putString ( key , value . toString ( ) ) ; } else if ( value . getClass ( ) . equals ( Integer . class ) ) { putInt ( key , ( Integer ) value ) ; } else if ( value . getClass ( ) . equals ( Float . class ) ) { putFloat ( key , ( Float ) value ) ; } else if ( val...
public class TcpWorker { /** * Creates the tcpClient with proper handler . * @ return the bound request builder * @ throws HttpRequestCreateException * the http request create exception */ public ClientBootstrap bootStrapTcpClient ( ) throws HttpRequestCreateException { } }
ClientBootstrap tcpClient = null ; try { // Configure the client . tcpClient = new ClientBootstrap ( tcpMeta . getChannelFactory ( ) ) ; // Configure the pipeline factory . tcpClient . setPipelineFactory ( new MyPipelineFactory ( TcpUdpSshPingResourceStore . getInstance ( ) . getTimer ( ) , this , tcpMeta . getTcpIdleT...
public class ParallelMapIterate { /** * A parallel form of forEachKeyValue . * @ see MapIterate # forEachKeyValue ( Map , Procedure2) * @ see ParallelIterate */ public static < K , V > void forEachKeyValue ( Map < K , V > map , Procedure2 < ? super K , ? super V > procedure2 ) { } }
ParallelMapIterate . forEachKeyValue ( map , procedure2 , 2 , map . size ( ) ) ;
public class JournalHelper { /** * Capture the full stack trace of an Exception , and return it in a String . */ public static String captureStackTrace ( Throwable e ) { } }
StringWriter buffer = new StringWriter ( ) ; e . printStackTrace ( new PrintWriter ( buffer ) ) ; return buffer . toString ( ) ;