idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
7,300
@ Nonnull public JSMethod method ( @ Nonnull @ Nonempty final String sName ) { final JSMethod aMethod = new JSMethod ( this , sName ) ; m_aMethods . add ( aMethod ) ; return aMethod ; }
Add a method to the list of method members of this JS class instance .
52
15
7,301
@ Nonnull public JSPackage openModal ( @ Nullable final EBootstrapModalOptionBackdrop aBackdrop , @ Nullable final Boolean aKeyboard , @ Nullable final Boolean aFocus , @ Nullable final Boolean aShow , @ Nullable final String sRemotePath ) { final JSPackage ret = new JSPackage ( ) ; final JSAssocArray aOptions = new JSAssocArray ( ) ; if ( aBackdrop != null ) aOptions . add ( "backdrop" , aBackdrop . getJSExpression ( ) ) ; if ( aFocus != null ) aOptions . add ( "focus" , aFocus . booleanValue ( ) ) ; if ( aKeyboard != null ) aOptions . add ( "keyboard" , aKeyboard . booleanValue ( ) ) ; if ( aShow != null ) aOptions . add ( "show" , aShow . booleanValue ( ) ) ; ret . add ( jsModal ( ) . arg ( aOptions ) ) ; if ( StringHelper . hasText ( sRemotePath ) ) { // Load content into modal ret . add ( JQuery . idRef ( _getContentID ( ) ) . load ( sRemotePath ) ) ; } return ret ; }
Activates your content as a modal . Accepts an optional options object .
272
16
7,302
@ Nullable @ OverrideOnDemand protected ICommonsSet < String > onShowSelectedObjectCustomAttrs ( @ Nonnull final WPECTYPE aWPEC , @ Nonnull final DATATYPE aSelectedObject , @ Nonnull final Map < String , String > aCustomAttrs , @ Nonnull final BootstrapViewForm aViewForm ) { return null ; }
Callback for manually extracting custom attributes . This method is called independently if custom attributes are present or not .
83
20
7,303
@ OverrideOnDemand @ Nullable protected ICommonsMap < String , String > validateCustomInputParameters ( @ Nonnull final WPECTYPE aWPEC , @ Nullable final DATATYPE aSelectedObject , @ Nonnull final FormErrorList aFormErrors , @ Nonnull final EWebPageFormAction eFormAction ) { return null ; }
Validate custom data of the input field .
79
9
7,304
public void addUploadedFile ( @ Nonnull @ Nonempty final String sFieldName , @ Nonnull final TemporaryUserDataObject aUDO ) { ValueEnforcer . notEmpty ( sFieldName , "FieldName" ) ; ValueEnforcer . notNull ( aUDO , "UDO" ) ; m_aRWLock . writeLocked ( ( ) -> { // Remove an eventually existing old UDO with the same filename - avoid // bloating the list final TemporaryUserDataObject aOldUDO = m_aMap . remove ( sFieldName ) ; if ( aOldUDO != null ) _deleteUDO ( aOldUDO ) ; // Add the new one m_aMap . put ( sFieldName , aUDO ) ; } ) ; }
Add an uploaded file . Existing UDOs with the same field name are overwritten and the underlying file is deleted . By default an uploaded file is not confirmed and will be deleted when the session expires . By confirming the uploaded image it is safe for later reuse .
166
53
7,305
@ Nonnull @ ReturnsMutableCopy public ICommonsOrderedMap < String , UserDataObject > confirmUploadedFiles ( @ Nullable final String ... aFieldNames ) { final ICommonsOrderedMap < String , UserDataObject > ret = new CommonsLinkedHashMap <> ( ) ; if ( aFieldNames != null ) { m_aRWLock . writeLocked ( ( ) -> { for ( final String sFieldName : aFieldNames ) { // Remove an eventually existing old UDO final TemporaryUserDataObject aUDO = m_aMap . remove ( sFieldName ) ; if ( aUDO != null ) { LOGGER . info ( "Confirmed uploaded file " + aUDO ) ; // Convert from temporary to real UDO ret . put ( sFieldName , new UserDataObject ( aUDO . getPath ( ) ) ) ; } } } ) ; } return ret ; }
Confirm the uploaded files with the passed field names .
198
11
7,306
@ Nullable public UserDataObject confirmUploadedFile ( @ Nullable final String sFieldName ) { return m_aRWLock . writeLocked ( ( ) -> { if ( StringHelper . hasText ( sFieldName ) ) { // Remove an eventually existing old UDO final TemporaryUserDataObject aUDO = m_aMap . remove ( sFieldName ) ; if ( aUDO != null ) { LOGGER . info ( "Confirmed uploaded file " + aUDO ) ; // Convert from temporary to real UDO return new UserDataObject ( aUDO . getPath ( ) ) ; } } return null ; } ) ; }
Confirm a single uploaded file with the passed field name .
139
12
7,307
@ Nonnull @ ReturnsMutableCopy public ICommonsList < String > cancelUploadedFiles ( @ Nullable final String ... aFieldNames ) { final ICommonsList < String > ret = new CommonsArrayList <> ( ) ; if ( ArrayHelper . isNotEmpty ( aFieldNames ) ) { m_aRWLock . writeLocked ( ( ) -> { for ( final String sFieldName : aFieldNames ) { final TemporaryUserDataObject aUDO = m_aMap . remove ( sFieldName ) ; if ( aUDO != null ) { _deleteUDO ( aUDO ) ; ret . add ( sFieldName ) ; } } } ) ; } return ret ; }
Remove all uploaded files and delete the underlying UDO objects . This is usually called when the operation is cancelled without saving .
152
24
7,308
@ Nullable public TemporaryUserDataObject getUploadedFile ( @ Nullable final String sFieldName ) { if ( StringHelper . hasNoText ( sFieldName ) ) return null ; return m_aRWLock . readLocked ( ( ) -> m_aMap . get ( sFieldName ) ) ; }
Get the user data object matching the specified field name .
68
11
7,309
@ OverrideOnDemand protected void modifyFirstControlIfLabelIsPresent ( @ Nonnull final IHCElementWithChildren < ? > aLabel , @ Nonnull final IHCControl < ? > aFirstControl ) { // Set the default placeholder (if none is present) if ( aFirstControl instanceof IHCInput < ? > ) { final IHCInput < ? > aEdit = ( IHCInput < ? > ) aFirstControl ; final EHCInputType eType = aEdit . getType ( ) ; if ( eType != null && eType . hasPlaceholder ( ) && ! aEdit . hasPlaceholder ( ) ) aEdit . setPlaceholder ( _getPlaceholderText ( aLabel ) ) ; } else if ( aFirstControl instanceof IHCTextArea < ? > ) { final IHCTextArea < ? > aTextArea = ( IHCTextArea < ? > ) aFirstControl ; if ( ! aTextArea . hasPlaceholder ( ) ) aTextArea . setPlaceholder ( _getPlaceholderText ( aLabel ) ) ; } }
Modify the first control that is inserted . This method is only called when a label is present .
236
20
7,310
@ Nonnull public IHasJSCode getJSUpdateCode ( @ Nonnull final IJSExpression aJSDataVar ) { final JSPackage ret = new JSPackage ( ) ; // Cleanup old chart ret . invoke ( JSExpr . ref ( getJSChartVar ( ) ) , "destroy" ) ; // Use new chart ret . assign ( JSExpr . ref ( getJSChartVar ( ) ) , new JSDefinedClass ( "Chart" ) . _new ( ) . arg ( JSExpr . ref ( getCanvasID ( ) ) . invoke ( "getContext" ) . arg ( "2d" ) ) . invoke ( m_aChart . getJSMethodName ( ) ) . arg ( aJSDataVar ) . arg ( getJSOptions ( ) ) ) ; return ret ; }
Update the chart with new datasets . This destroys the old chart .
180
13
7,311
public static void unregisterJSIncludeFromThisRequest ( @ Nonnull final IJSPathProvider aJSPathProvider ) { final JSResourceSet aSet = _getPerRequestSet ( false ) ; if ( aSet != null ) aSet . removeItem ( aJSPathProvider ) ; }
Unregister a existing JS item only from this request
65
10
7,312
public static byte [ ] readFile ( File file ) throws IOException { // Open file RandomAccessFile f = new RandomAccessFile ( file , "r" ) ; try { // Get and check length long longlength = f . length ( ) ; int length = ( int ) longlength ; if ( length != longlength ) { throw new IOException ( "File size >= 2 GB" ) ; } // Read file and return data byte [ ] data = new byte [ length ] ; f . readFully ( data ) ; return data ; } finally { // Close file f . close ( ) ; } }
Loads bytes of the given file .
127
8
7,313
public static void writeFile ( File file , byte [ ] bytes ) throws IOException { FileOutputStream fos = null ; try { fos = new FileOutputStream ( file ) ; fos . write ( bytes ) ; } finally { if ( fos != null ) { fos . close ( ) ; } } }
Write bytes to the given file .
68
7
7,314
public static boolean isSecondNewerThanFirst ( File first , File second ) { boolean isSecondNewerThanFirst = false ; // If file does not exist, it cannot be newer. if ( second . exists ( ) ) { long firstLastModified = first . lastModified ( ) ; long secondLastModified = second . lastModified ( ) ; // 0L is returned if there was any error, so we check if both last // modification stamps are != 0L. if ( firstLastModified != 0L && secondLastModified != 0L ) { isSecondNewerThanFirst = secondLastModified > firstLastModified ; } } return isSecondNewerThanFirst ; }
Checks if tool jar is newer than JUnit jar . If tool jar is newer return true ; false otherwise .
152
23
7,315
public static byte [ ] loadBytes ( URL url ) { byte [ ] bytes = null ; try { bytes = loadBytes ( url . openStream ( ) ) ; } catch ( IOException ex ) { // ex.printStackTrace(); } return bytes ; }
Load bytes from the given url .
55
7
7,316
@ Nullable public WebSiteResourceBundleSerialized getResourceBundleOfID ( @ Nullable final String sBundleID ) { if ( StringHelper . hasNoText ( sBundleID ) ) return null ; return m_aRWLock . readLocked ( ( ) -> m_aMapToBundle . get ( sBundleID ) ) ; }
Get the serialized resource bundle with the passed ID .
79
11
7,317
public boolean containsResourceBundleOfID ( @ Nullable final String sBundleID ) { if ( StringHelper . hasNoText ( sBundleID ) ) return false ; return m_aRWLock . readLocked ( ( ) -> m_aMapToBundle . containsKey ( sBundleID ) ) ; }
Check if the passed resource bundle ID is contained .
71
10
7,318
protected static void throwMojoExecutionException ( Object mojo , String message , Exception cause ) throws Exception { Class < ? > clz = mojo . getClass ( ) . getClassLoader ( ) . loadClass ( MavenNames . MOJO_EXECUTION_EXCEPTION_BIN ) ; Constructor < ? > con = clz . getConstructor ( String . class , Exception . class ) ; Exception ex = ( Exception ) con . newInstance ( message , cause ) ; throw ex ; }
Throws MojoExecutionException .
109
8
7,319
protected static String invokeAndGetString ( String methodName , Object mojo ) throws Exception { return ( String ) invokeGetMethod ( methodName , mojo ) ; }
Gets String field value from the given mojo based on the given method name .
35
17
7,320
protected static boolean invokeAndGetBoolean ( String methodName , Object mojo ) throws Exception { return ( Boolean ) invokeGetMethod ( methodName , mojo ) ; }
Gets boolean field value from the given mojo based on the given method name .
36
17
7,321
@ SuppressWarnings ( "unchecked" ) protected static List < String > invokeAndGetList ( String methodName , Object mojo ) throws Exception { return ( List < String > ) invokeGetMethod ( methodName , mojo ) ; }
Gets List field value from the given mojo based on the given method name .
53
17
7,322
protected static void setField ( String fieldName , Object mojo , Object value ) throws Exception { Field field = null ; try { field = mojo . getClass ( ) . getDeclaredField ( fieldName ) ; } catch ( NoSuchFieldException ex ) { // Ignore exception and try superclass. field = mojo . getClass ( ) . getSuperclass ( ) . getDeclaredField ( fieldName ) ; } field . setAccessible ( true ) ; field . set ( mojo , value ) ; }
Sets the given field to the given value . This is an alternative to invoking a set method .
110
20
7,323
protected static Object getField ( String fieldName , Object mojo ) throws Exception { Field field = null ; try { field = mojo . getClass ( ) . getDeclaredField ( fieldName ) ; } catch ( NoSuchFieldException ex ) { // Ignore exception and try superclass. field = mojo . getClass ( ) . getSuperclass ( ) . getDeclaredField ( fieldName ) ; } field . setAccessible ( true ) ; return field . get ( mojo ) ; }
Gets the value of the field . This is an alternative to invoking a get method .
106
18
7,324
public static boolean loadAgent ( URL agentJarURL ) throws Exception { File toolsJarFile = findToolsJar ( ) ; Class < ? > vmClass = null ; if ( toolsJarFile == null || ! toolsJarFile . exists ( ) ) { // likely Java 9+ (when tools.jar is not available). Java // 9 also requires that // -Djvm.options=jdk.attach.allowAttachSelf=true is set. vmClass = ClassLoader . getSystemClassLoader ( ) . loadClass ( "com.sun.tools.attach.VirtualMachine" ) ; } else { vmClass = loadVirtualMachine ( toolsJarFile ) ; } if ( vmClass == null ) { return false ; } attachAgent ( vmClass , agentJarURL ) ; return true ; }
Loads agent from the given URL .
166
8
7,325
private static void attachAgent ( Class < ? > vmClass , URL agentJarURL ) throws Exception { String pid = getPID ( ) ; String agentAbsolutePath = new File ( agentJarURL . toURI ( ) . getSchemeSpecificPart ( ) ) . getAbsolutePath ( ) ; Object vm = getAttachMethod ( vmClass ) . invoke ( null , new Object [ ] { pid } ) ; getLoadAgentMethod ( vmClass ) . invoke ( vm , new Object [ ] { agentAbsolutePath } ) ; getDetachMethod ( vmClass ) . invoke ( vm ) ; }
Attaches jar where this class belongs to the current VirtualMachine as an agent .
128
16
7,326
private static Method getAttachMethod ( Class < ? > vmClass ) throws SecurityException , NoSuchMethodException { return vmClass . getMethod ( "attach" , new Class < ? > [ ] { String . class } ) ; }
Finds attach method in VirtualMachine .
49
8
7,327
private static Method getLoadAgentMethod ( Class < ? > vmClass ) throws SecurityException , NoSuchMethodException { return vmClass . getMethod ( "loadAgent" , new Class [ ] { String . class } ) ; }
Finds loadAgent method in VirtualMachine .
48
9
7,328
private static String getPID ( ) { String vmName = ManagementFactory . getRuntimeMXBean ( ) . getName ( ) ; return vmName . substring ( 0 , vmName . indexOf ( "@" ) ) ; }
Returns process id . Note that Java does not guarantee any format for id so this is just a common heuristic .
50
23
7,329
private static File findToolsJar ( ) { String javaHome = System . getProperty ( "java.home" ) ; File javaHomeFile = new File ( javaHome ) ; File toolsJarFile = new File ( javaHomeFile , "lib" + File . separator + TOOLS_JAR_NAME ) ; if ( ! toolsJarFile . exists ( ) ) { toolsJarFile = new File ( System . getenv ( "java_home" ) , "lib" + File . separator + TOOLS_JAR_NAME ) ; } if ( ! toolsJarFile . exists ( ) && javaHomeFile . getAbsolutePath ( ) . endsWith ( File . separator + "jre" ) ) { javaHomeFile = javaHomeFile . getParentFile ( ) ; toolsJarFile = new File ( javaHomeFile , "lib" + File . separator + TOOLS_JAR_NAME ) ; } if ( ! toolsJarFile . exists ( ) && isMac ( ) && javaHomeFile . getAbsolutePath ( ) . endsWith ( File . separator + "Home" ) ) { javaHomeFile = javaHomeFile . getParentFile ( ) ; toolsJarFile = new File ( javaHomeFile , "Classes" + File . separator + CLASSES_JAR_NAME ) ; } return toolsJarFile ; }
Finds tools . jar in JDK .
293
9
7,330
public Token lookahead ( ) { Token current = token ; if ( current . next == null ) { current . next = token_source . getNextToken ( ) ; } return current . next ; }
look ahead 1 token
42
4
7,331
protected List < JDToken > whiteSpace ( Token token ) { final List < JDToken > wss = new ArrayList < JDToken > ( ) ; Token ws = token . specialToken ; while ( ws != null ) { switch ( ws . kind ) { case WS : wss . add ( _JDWhiteSpace ( ws . image ) ) ; break ; default : // anything else is not whitespace and not our problem. } ws = ws . specialToken ; } Collections . reverse ( wss ) ; return wss ; }
Return all the comments attached to the specified token
120
9
7,332
public static boolean hasOperator ( @ Nullable final IJSExpression aExpr ) { return aExpr instanceof JSOpUnary || aExpr instanceof JSOpBinary || aExpr instanceof JSOpTernary ; }
Determine whether the top level of an expression involves an operator .
56
14
7,333
@ Nonnull public static JSOpBinary band ( @ Nonnull final IJSExpression aLeft , @ Nonnull final IJSExpression aRight ) { return new JSOpBinary ( aLeft , "&" , aRight ) ; }
Binary - and
55
4
7,334
@ Nonnull public static JSOpBinary bor ( @ Nonnull final IJSExpression aLeft , @ Nonnull final IJSExpression aRight ) { return new JSOpBinary ( aLeft , "|" , aRight ) ; }
Binary - or
56
4
7,335
@ Nonnull public static IJSExpression cand ( @ Nonnull final IJSExpression aLeft , @ Nonnull final IJSExpression aRight ) { // Some optimizations if ( aLeft == JSExpr . TRUE ) return aRight ; if ( aRight == JSExpr . TRUE ) return aLeft ; if ( aLeft == JSExpr . FALSE || aRight == JSExpr . FALSE ) return JSExpr . FALSE ; return new JSOpBinary ( aLeft , "&&" , aRight ) ; }
Logical - and
114
4
7,336
@ Nonnull public static JSOpBinary xor ( @ Nonnull final IJSExpression aLeft , @ Nonnull final IJSExpression aRight ) { return new JSOpBinary ( aLeft , "^" , aRight ) ; }
Exclusive - or
56
4
7,337
@ Nonnull public static JSOpBinary ene ( @ Nonnull final IJSExpression aLeft , @ Nonnull final IJSExpression aRight ) { return new JSOpBinary ( aLeft , "!==" , aRight ) ; }
exactly not equal
57
4
7,338
@ OverrideOnDemand @ Nullable protected String determineMimeType ( @ Nonnull final String sFilename , @ Nonnull final IReadableResource aResource ) { return MimeTypeInfoManager . getDefaultInstance ( ) . getPrimaryMimeTypeStringForFilename ( sFilename ) ; }
Determine the MIME type of the resource to deliver .
62
13
7,339
@ Nullable public static ICommonsList < IHCNode > createPasswordConstraintTip ( @ Nonnull final Locale aDisplayLocale ) { final ICommonsList < String > aTexts = GlobalPasswordSettings . getPasswordConstraintList ( ) . getAllPasswordConstraintDescriptions ( aDisplayLocale ) ; if ( aTexts . isEmpty ( ) ) return null ; return HCExtHelper . list2divList ( aTexts ) ; }
Create a tooltip with all the requirements for a password
105
10
7,340
@ Nonnull @ Nonempty public String onStartJob ( @ Nonnull final ILongRunningJob aJob , @ Nullable final String sStartingUserID ) { ValueEnforcer . notNull ( aJob , "Job" ) ; // Create a new unique in-memory ID final String sJobID = GlobalIDFactory . getNewStringID ( ) ; final LongRunningJobData aJobData = new LongRunningJobData ( sJobID , aJob . getJobDescription ( ) , sStartingUserID ) ; m_aRWLock . writeLocked ( ( ) -> m_aRunningJobs . put ( sJobID , aJobData ) ) ; return sJobID ; }
Start a long running job
147
5
7,341
public void onEndJob ( @ Nullable final String sJobID , @ Nonnull final ESuccess eExecSucess , @ Nonnull final LongRunningJobResult aResult ) { ValueEnforcer . notNull ( eExecSucess , "ExecSuccess" ) ; ValueEnforcer . notNull ( aResult , "Result" ) ; // Remove from running job list final LongRunningJobData aJobData = m_aRWLock . writeLocked ( ( ) -> { final LongRunningJobData ret = m_aRunningJobs . remove ( sJobID ) ; if ( ret == null ) throw new IllegalArgumentException ( "Illegal job ID '" + sJobID + "' passed!" ) ; // End the job - inside the writeLock ret . onJobEnd ( eExecSucess , aResult ) ; return ret ; } ) ; // Remember it m_aResultMgr . addResult ( aJobData ) ; }
End a job .
200
4
7,342
public static void unregisterMetaElementFromThisRequest ( @ Nullable final String sMetaElementName ) { final MetaElementList aSet = _getPerRequestSet ( false ) ; if ( aSet != null ) aSet . removeMetaElement ( sMetaElementName ) ; }
Unregister an existing meta element only from this request
59
10
7,343
@ OverrideOnDemand @ OverridingMethodsMustInvokeSuper protected void fillHead ( @ Nonnull final ISimpleWebExecutionContext aSWEC , @ Nonnull final HCHtml aHtml ) { final IRequestWebScopeWithoutResponse aRequestScope = aSWEC . getRequestScope ( ) ; final HCHead aHead = aHtml . head ( ) ; // Add all meta elements addMetaElements ( aRequestScope , aHead ) ; }
Fill the HTML HEAD element .
101
6
7,344
@ Nonnull public final EChange setType ( @ Nonnull final EBootstrapPanelType eType ) { ValueEnforcer . notNull ( eType , "Type" ) ; if ( eType . equals ( m_eType ) ) return EChange . UNCHANGED ; removeClass ( m_eType ) ; addClass ( eType ) ; m_eType = eType ; return EChange . CHANGED ; }
Set the type .
93
4
7,345
@ Nonnull public TypeaheadDataset setLimit ( @ Nonnegative final int nLimit ) { ValueEnforcer . isGT0 ( nLimit , "Limit" ) ; m_nLimit = nLimit ; return this ; }
The max number of suggestions from the dataset to display for a given query . Defaults to 5 .
49
20
7,346
@ Nonnull public TypeaheadDataset setPrefetch ( @ Nullable final ISimpleURL aURL ) { return setPrefetch ( aURL == null ? null : new TypeaheadPrefetch ( aURL ) ) ; }
Can be a URL to a JSON file containing an array of datums or if more configurability is needed a prefetch options object .
49
28
7,347
@ Nonnull public final IMPLTYPE scaleBestMatching ( @ Nonnegative final int nMaxWidth , @ Nonnegative final int nMaxHeight ) { if ( m_aExtent != null ) m_aExtent = m_aExtent . getBestMatchingSize ( nMaxWidth , nMaxHeight ) ; return thisAsT ( ) ; }
Scales the image so that neither with nor height are exceeded keeping the aspect ratio .
77
17
7,348
@ Nonnegative public int checkInternalMappings ( @ Nonnull final IMenuTree aMenuTree , @ Nonnull final Consumer < GoMappingItem > aErrorCallback ) { ValueEnforcer . notNull ( aMenuTree , "MenuTree" ) ; ValueEnforcer . notNull ( aErrorCallback , "ErrorCallback" ) ; final IRequestParameterManager aRPM = RequestParameterManager . getInstance ( ) ; int nCount = 0 ; int nErrors = 0 ; m_aRWLock . readLock ( ) . lock ( ) ; try { for ( final GoMappingItem aItem : m_aMap . values ( ) ) if ( aItem . isInternal ( ) ) { // Get value of "menu item" parameter and check for existence final String sParamValue = aRPM . getMenuItemFromURL ( aItem . getTargetURLReadonly ( ) , aMenuTree ) ; if ( sParamValue != null ) { ++ nCount ; if ( aMenuTree . getItemWithID ( sParamValue ) == null ) { ++ nErrors ; aErrorCallback . accept ( aItem ) ; } } } } finally { m_aRWLock . readLock ( ) . unlock ( ) ; } if ( nErrors == 0 ) LOGGER . info ( "Successfully checked " + nCount + " internal go-mappings for consistency" ) ; else LOGGER . warn ( "Checked " + nCount + " internal go-mappings for consistency and found " + nErrors + " errors!" ) ; return nErrors ; }
Check whether all internal go links that point to a page use existing menu item IDs
338
16
7,349
@ Nullable public static String getGuestUserDisplayName ( @ Nonnull final Locale aDisplayLocale ) { ValueEnforcer . notNull ( aDisplayLocale , "DisplayLocale" ) ; return ESecurityUIText . GUEST . getDisplayText ( aDisplayLocale ) ; }
Get the display name of the guest user in the specified locale .
64
13
7,350
@ Nullable public static String getUserDisplayName ( @ Nullable final String sUserID , @ Nonnull final Locale aDisplayLocale ) { if ( StringHelper . hasNoText ( sUserID ) ) return getGuestUserDisplayName ( aDisplayLocale ) ; final IUser aUser = PhotonSecurityManager . getUserMgr ( ) . getUserOfID ( sUserID ) ; return aUser == null ? sUserID : getUserDisplayName ( aUser , aDisplayLocale ) ; }
Get the display name of the user .
112
8
7,351
public static byte [ ] serialize ( Challenge challenge , byte [ ] hmacSecret ) { MiniMessagePack . Packer packer = new MiniMessagePack . Packer ( ) ; packer . pack ( VERSION ) ; packer . pack ( CHALLENGE_MAGIC ) ; packer . pack ( challenge . getUniqueData ( ) ) ; packer . pack ( challenge . getValidFromTimestamp ( ) ) ; packer . pack ( challenge . getValidToTimestamp ( ) ) ; packer . pack ( challenge . getFingerprint ( ) . getBytes ( ) ) ; packer . pack ( challenge . getServerName ( ) ) ; packer . pack ( challenge . getUserName ( ) ) ; byte [ ] bytes = packer . getBytes ( ) ; byte [ ] mac = getAuthenticationCode ( hmacSecret , bytes ) ; packer . pack ( mac ) ; return packer . getBytes ( ) ; }
Serialize a challenge into it s binary representation
203
9
7,352
public static byte [ ] serialize ( Response response ) { MiniMessagePack . Packer packer = new MiniMessagePack . Packer ( ) ; packer . pack ( VERSION ) ; packer . pack ( RESPONSE_MAGIC ) ; packer . pack ( response . getPayload ( ) ) ; packer . pack ( response . getSignature ( ) ) ; return packer . getBytes ( ) ; }
Serialize a Response into binary representation
91
7
7,353
private static byte [ ] getAuthenticationCode ( byte [ ] secret , byte [ ] data , int length ) { try { SecretKey secretKey = new SecretKeySpec ( secret , MAC_ALGORITHM ) ; Mac mac = Mac . getInstance ( MAC_ALGORITHM ) ; mac . init ( secretKey ) ; mac . update ( data , 0 , length ) ; return mac . doFinal ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
Calculate and return a keyed hash message authentication code HMAC as specified in RFC2104 using SHA256 as hash function .
108
27
7,354
public static String serializeEncodedRequest ( String username ) { MiniMessagePack . Packer packer = new MiniMessagePack . Packer ( ) ; packer . pack ( 1 ) ; packer . pack ( ' ' ) ; packer . pack ( username ) ; return ASCIICodec . encode ( packer . getBytes ( ) ) ; }
Create a request string from a username . Request is too trivial for it to make it into a class of it s own a this stage .
76
28
7,355
public static String deserializeRequest ( String request ) throws IllegalArgumentException , ProtocolVersionException { MiniMessagePack . Unpacker unpacker = new MiniMessagePack . Unpacker ( ASCIICodec . decode ( request ) ) ; try { parseVersionMagic ( REQUEST_MAGIC , unpacker ) ; return unpacker . unpackString ( ) ; } catch ( DeserializationException e ) { throw new IllegalArgumentException ( e . getMessage ( ) ) ; } }
Deserialize an ASCII encoded request messages and return the username string it encodes . Also verifies that the type magic value matches and that the version equals 1 .
108
33
7,356
private static boolean constantTimeEquals ( byte [ ] a , byte [ ] b ) { if ( a . length != b . length ) { return false ; } int result = 0 ; for ( int i = 0 ; i < a . length ; i ++ ) { result |= a [ i ] ^ b [ i ] ; } return result == 0 ; }
Checks if byte arrays a and be are equal in an algorithm that runs in constant time provided that their lengths are equal .
76
25
7,357
public static void setFallbackLocale ( @ Nonnull final Locale aFallbackLocale ) { ValueEnforcer . notNull ( aFallbackLocale , "FallbackLocale" ) ; s_aRWLock . writeLocked ( ( ) -> s_aFallbackLocale = aFallbackLocale ) ; }
Set the fallback locale in case none could be determined .
72
12
7,358
public static void setStorageFileProvider ( @ Nonnull final IFunction < InternalErrorMetadata , File > aStorageFileProvider ) { ValueEnforcer . notNull ( aStorageFileProvider , "StorageFileProvider" ) ; s_aStorageFileProvider = aStorageFileProvider ; }
Set the provider that defines how to build the filename to save internal error files .
60
16
7,359
public static void setDefaultStorageFileProvider ( ) { setStorageFileProvider ( aMetadata -> { final LocalDateTime aNow = PDTFactory . getCurrentLocalDateTime ( ) ; final String sFilename = StringHelper . getConcatenatedOnDemand ( PDTIOHelper . getLocalDateTimeForFilename ( aNow ) , "-" , aMetadata . getErrorID ( ) ) + ".xml" ; return WebFileIO . getDataIO ( ) . getFile ( "internal-errors/" + aNow . getYear ( ) + "/" + StringHelper . getLeadingZero ( aNow . getMonthValue ( ) , 2 ) + "/" + sFilename ) ; } ) ; }
Set the default storage file provider . In case you played around and want to restore the default behavior .
151
20
7,360
@ Nonnull public static TriggerKey schedule ( @ Nonnull final IScheduleBuilder < ? extends ITrigger > aScheduleBuilder , @ Nonnegative final long nThresholdBytes ) { ValueEnforcer . notNull ( aScheduleBuilder , "ScheduleBuilder" ) ; ValueEnforcer . isGE0 ( nThresholdBytes , "ThresholdBytes" ) ; final ICommonsMap < String , Object > aJobDataMap = new CommonsHashMap <> ( ) ; aJobDataMap . put ( JOB_DATA_ATTR_THRESHOLD_BYTES , Long . valueOf ( nThresholdBytes ) ) ; return GlobalQuartzScheduler . getInstance ( ) . scheduleJob ( CheckDiskUsableSpaceJob . class . getName ( ) , JDK8TriggerBuilder . newTrigger ( ) . startNow ( ) . withSchedule ( aScheduleBuilder ) , CheckDiskUsableSpaceJob . class , aJobDataMap ) ; }
Call this method to schedule the check disk usage job to run .
210
13
7,361
@ Override public List < StringSource > createSources ( String sourceFileName ) { return Util . list ( new StringSource ( sourceFileName , source ) ) ; }
Create a list with a single StringSource - the sourceFileName will be used as the srcInfo in the resulting Source
37
24
7,362
@ Nullable public static HC_Target getFromName ( @ Nonnull final String sName , @ Nullable final HC_Target aDefault ) { if ( BLANK . getAttrValue ( ) . equalsIgnoreCase ( sName ) ) return BLANK ; if ( SELF . getAttrValue ( ) . equalsIgnoreCase ( sName ) ) return SELF ; if ( PARENT . getAttrValue ( ) . equalsIgnoreCase ( sName ) ) return PARENT ; if ( TOP . getAttrValue ( ) . equalsIgnoreCase ( sName ) ) return TOP ; return aDefault ; }
Try to find one of the default targets by name . The name comparison is performed case insensitive .
134
19
7,363
@ Nullable public IUser createPredefinedUser ( @ Nonnull @ Nonempty final String sID , @ Nonnull @ Nonempty final String sLoginName , @ Nullable final String sEmailAddress , @ Nonnull final String sPlainTextPassword , @ Nullable final String sFirstName , @ Nullable final String sLastName , @ Nullable final String sDescription , @ Nullable final Locale aDesiredLocale , @ Nullable final Map < String , String > aCustomAttrs , final boolean bDisabled ) { ValueEnforcer . notEmpty ( sLoginName , "LoginName" ) ; ValueEnforcer . notNull ( sPlainTextPassword , "PlainTextPassword" ) ; if ( getUserOfLoginName ( sLoginName ) != null ) { // Another user with this login name already exists AuditHelper . onAuditCreateFailure ( User . OT , "login-name-already-in-use" , sLoginName , "predefined-user" ) ; return null ; } // Create user final User aUser = new User ( sID , sLoginName , sEmailAddress , GlobalPasswordSettings . createUserDefaultPasswordHash ( new PasswordSalt ( ) , sPlainTextPassword ) , sFirstName , sLastName , sDescription , aDesiredLocale , aCustomAttrs , bDisabled ) ; m_aRWLock . writeLocked ( ( ) -> { internalCreateItem ( aUser ) ; } ) ; AuditHelper . onAuditCreateSuccess ( User . OT , aUser . getID ( ) , "predefined-user" , sLoginName , sEmailAddress , sFirstName , sLastName , sDescription , aDesiredLocale , aCustomAttrs , Boolean . valueOf ( bDisabled ) ) ; // Execute callback as the very last action m_aCallbacks . forEach ( aCB -> aCB . onUserCreated ( aUser , true ) ) ; return aUser ; }
Create a predefined user .
425
6
7,364
@ Nullable public IUser getUserOfLoginName ( @ Nullable final String sLoginName ) { if ( StringHelper . hasNoText ( sLoginName ) ) return null ; return findFirst ( x -> x . getLoginName ( ) . equals ( sLoginName ) ) ; }
Get the user with the specified login name
62
8
7,365
@ Nonnull public EChange deleteUser ( @ Nullable final String sUserID ) { final User aUser = getOfID ( sUserID ) ; if ( aUser == null ) { AuditHelper . onAuditDeleteFailure ( User . OT , "no-such-user-id" , sUserID ) ; return EChange . UNCHANGED ; } m_aRWLock . writeLock ( ) . lock ( ) ; try { if ( BusinessObjectHelper . setDeletionNow ( aUser ) . isUnchanged ( ) ) { AuditHelper . onAuditDeleteFailure ( User . OT , "already-deleted" , sUserID ) ; return EChange . UNCHANGED ; } internalMarkItemDeleted ( aUser ) ; } finally { m_aRWLock . writeLock ( ) . unlock ( ) ; } AuditHelper . onAuditDeleteSuccess ( User . OT , sUserID ) ; // Execute callback as the very last action m_aCallbacks . forEach ( aCB -> aCB . onUserDeleted ( aUser ) ) ; return EChange . CHANGED ; }
Delete the user with the specified ID .
245
8
7,366
@ Nonnull public EChange undeleteUser ( @ Nullable final String sUserID ) { final User aUser = getOfID ( sUserID ) ; if ( aUser == null ) { AuditHelper . onAuditUndeleteFailure ( User . OT , sUserID , "no-such-user-id" ) ; return EChange . UNCHANGED ; } m_aRWLock . writeLock ( ) . lock ( ) ; try { if ( BusinessObjectHelper . setUndeletionNow ( aUser ) . isUnchanged ( ) ) return EChange . UNCHANGED ; internalMarkItemUndeleted ( aUser ) ; } finally { m_aRWLock . writeLock ( ) . unlock ( ) ; } AuditHelper . onAuditUndeleteSuccess ( User . OT , sUserID ) ; // Execute callback as the very last action m_aCallbacks . forEach ( aCB -> aCB . onUserUndeleted ( aUser ) ) ; return EChange . CHANGED ; }
Undelete the user with the specified ID .
225
10
7,367
@ Nonnull public EChange disableUser ( @ Nullable final String sUserID ) { final User aUser = getOfID ( sUserID ) ; if ( aUser == null ) { AuditHelper . onAuditModifyFailure ( User . OT , sUserID , "no-such-user-id" , "disable" ) ; return EChange . UNCHANGED ; } m_aRWLock . writeLock ( ) . lock ( ) ; try { if ( aUser . setDisabled ( true ) . isUnchanged ( ) ) return EChange . UNCHANGED ; internalUpdateItem ( aUser ) ; } finally { m_aRWLock . writeLock ( ) . unlock ( ) ; } AuditHelper . onAuditModifySuccess ( User . OT , "disable" , sUserID ) ; // Execute callback as the very last action m_aCallbacks . forEach ( aCB -> aCB . onUserEnabled ( aUser , false ) ) ; return EChange . CHANGED ; }
disable the user with the specified ID .
222
8
7,368
public boolean areUserIDAndPasswordValid ( @ Nullable final String sUserID , @ Nullable final String sPlainTextPassword ) { // No password is not allowed if ( sPlainTextPassword == null ) return false ; // Is there such a user? final IUser aUser = getOfID ( sUserID ) ; if ( aUser == null ) return false ; // Now compare the hashes final String sPasswordHashAlgorithm = aUser . getPasswordHash ( ) . getAlgorithmName ( ) ; final IPasswordSalt aSalt = aUser . getPasswordHash ( ) . getSalt ( ) ; final PasswordHash aPasswordHash = GlobalPasswordSettings . createUserPasswordHash ( sPasswordHashAlgorithm , aSalt , sPlainTextPassword ) ; return aUser . getPasswordHash ( ) . equals ( aPasswordHash ) ; }
Check if the passed combination of user ID and password matches .
182
12
7,369
public static boolean isOutOfBandNode ( @ Nonnull final IHCNode aHCNode ) { ValueEnforcer . notNull ( aHCNode , "HCNode" ) ; // Is the @OutOfBandNode annotation present? if ( s_aOOBNAnnotationCache . hasAnnotation ( aHCNode ) ) return true ; // If it is a wrapped node, look into it if ( HCHelper . isWrappedNode ( aHCNode ) ) return isOutOfBandNode ( HCHelper . getUnwrappedNode ( aHCNode ) ) ; // Not an out of band node return false ; }
Check if the passed node is an out - of - band node .
135
14
7,370
public static void recursiveExtractAndRemoveOutOfBandNodes ( @ Nonnull final IHCNode aParentElement , @ Nonnull final List < IHCNode > aTargetList ) { ValueEnforcer . notNull ( aParentElement , "ParentElement" ) ; ValueEnforcer . notNull ( aTargetList , "TargetList" ) ; // Using HCUtils.iterateTree would be too tedious here _recursiveExtractAndRemoveOutOfBandNodes ( aParentElement , aTargetList , 0 ) ; }
Extract all out - of - band child nodes for the passed element . Must be called after the element is finished! All out - of - band nodes are detached from their parent so that the original node can be reused . Wrapped nodes where the inner node is an out of band node are also considered and removed .
113
64
7,371
@ Nonnull @ CodingStyleguideUnaware public JSBlock _continue ( @ Nullable final JSLabel aLabel ) { addStatement ( new JSContinue ( aLabel ) ) ; return this ; }
Create a continue statement and add it to this block
45
10
7,372
@ Nonnull public final APIDescriptor addRequiredHeader ( @ Nullable final String sHeaderName ) { if ( StringHelper . hasText ( sHeaderName ) ) m_aRequiredHeaders . add ( sHeaderName ) ; return this ; }
Add a required HTTP header . If this HTTP header is not present invocation will not be possible .
55
19
7,373
@ Nonnull public final APIDescriptor addRequiredHeaders ( @ Nullable final String ... aHeaderNames ) { if ( aHeaderNames != null ) for ( final String sHeaderName : aHeaderNames ) addRequiredHeader ( sHeaderName ) ; return this ; }
Add one or more required HTTP headers . If one of these HTTP headers are not present invocation will not be possible .
59
23
7,374
@ Nonnull public final APIDescriptor addRequiredParam ( @ Nullable final String sParamName ) { if ( StringHelper . hasText ( sParamName ) ) m_aRequiredParams . add ( sParamName ) ; return this ; }
Add a required request parameter . If this request parameter is not present invocation will not be possible .
55
19
7,375
@ Nonnull public final APIDescriptor addRequiredParams ( @ Nullable final String ... aParamNames ) { if ( aParamNames != null ) for ( final String sParamName : aParamNames ) addRequiredParam ( sParamName ) ; return this ; }
Add one or more required request parameters . If one of these request parameters are not present invocation will not be possible .
59
23
7,376
@ Override @ Nonnull public JQueryInvocation jqinvoke ( @ Nonnull @ Nonempty final String sMethod ) { return new JQueryInvocation ( this , sMethod ) ; }
Invoke an arbitrary function on this jQuery object .
41
10
7,377
@ Nonnull public static HCLink createCSSLink ( @ Nonnull final ISimpleURL aCSSURL ) { return new HCLink ( ) . setRel ( EHCLinkType . STYLESHEET ) . setType ( CMimeType . TEXT_CSS ) . setHref ( aCSSURL ) ; }
Shortcut to create a &lt ; link&gt ; element specific to CSS
71
16
7,378
public static JADT standardConfigDriver ( ) { logger . fine ( "Using standard configuration." ) ; final SourceFactory sourceFactory = new FileSourceFactory ( ) ; final ClassBodyEmitter classBodyEmitter = new StandardClassBodyEmitter ( ) ; final ConstructorEmitter constructorEmitter = new StandardConstructorEmitter ( classBodyEmitter ) ; final DataTypeEmitter dataTypeEmitter = new StandardDataTypeEmitter ( classBodyEmitter , constructorEmitter ) ; final DocEmitter docEmitter = new StandardDocEmitter ( dataTypeEmitter ) ; final Parser parser = new StandardParser ( new JavaCCParserImplFactory ( ) ) ; final Checker checker = new StandardChecker ( ) ; final SinkFactoryFactory factoryFactory = new FileSinkFactoryFactory ( ) ; return new JADT ( sourceFactory , parser , checker , docEmitter , factoryFactory ) ; }
Convenient factory method to create a complete standard configuration
195
10
7,379
public void parseAndEmit ( String [ ] args ) { logger . finest ( "Checking command line arguments." ) ; if ( args . length != 2 ) { final String version = new Version ( ) . getVersion ( ) ; logger . info ( "jADT version " + version + "." ) ; logger . info ( "Not enough arguments provided to jADT" ) ; logger . info ( "usage: java sfdc.adt.JADT [source file or directory with .jadt files] [output directory]" ) ; throw new IllegalArgumentException ( "\njADT version " + version + "\nusage: java sfdc.adt.JADT [source file or directory with .jadt files] [output directory]" ) ; } final String srcPath = args [ 0 ] ; final String destDirName = args [ 1 ] ; parseAndEmit ( srcPath , destDirName ) ; }
Do the jADT thing based on an array of String args . There must be 2 and the must be the source file and destination directory
202
28
7,380
public void parseAndEmit ( String srcPath , final String destDir ) { final String version = new Version ( ) . getVersion ( ) ; logger . info ( "jADT version " + version + "." ) ; logger . info ( "Will read from source " + srcPath ) ; logger . info ( "Will write to destDir " + destDir ) ; final List < ? extends Source > sources = sourceFactory . createSources ( srcPath ) ; for ( Source source : sources ) { final List < UserError > errors = new ArrayList < UserError > ( ) ; final ParseResult result = parser . parse ( source ) ; for ( SyntaxError error : result . errors ) { errors . add ( UserError . _Syntactic ( error ) ) ; } final List < SemanticError > semanticErrors = checker . check ( result . doc ) ; for ( SemanticError error : semanticErrors ) { errors . add ( UserError . _Semantic ( error ) ) ; } if ( ! errors . isEmpty ( ) ) { throw new JADTUserErrorsException ( errors ) ; } emitter . emit ( factoryFactory . createSinkFactory ( destDir ) , result . doc ) ; } }
Do the jADT thing given the srceFileName and destination directory
264
15
7,381
public static JADT createDummyJADT ( List < SyntaxError > syntaxErrors , List < SemanticError > semanticErrors , String testSrcInfo , SinkFactoryFactory factory ) { final SourceFactory sourceFactory = new StringSourceFactory ( TEST_STRING ) ; final Doc doc = new Doc ( TEST_SRC_INFO , Pkg . _Pkg ( NO_COMMENTS , "pkg" ) , Util . < Imprt > list ( ) , Util . < DataType > list ( ) ) ; final ParseResult parseResult = new ParseResult ( doc , syntaxErrors ) ; final DocEmitter docEmitter = new DummyDocEmitter ( doc , TEST_CLASS_NAME ) ; final Parser parser = new DummyParser ( parseResult , testSrcInfo , TEST_STRING ) ; final Checker checker = new DummyChecker ( semanticErrors ) ; final JADT jadt = new JADT ( sourceFactory , parser , checker , docEmitter , factory ) ; return jadt ; }
Create a dummy configged jADT based on the provided syntaxErrors semanticErrors testSrcInfo and sink factory Useful for testing
235
28
7,382
private boolean hasHashChanged ( Set < RegData > regData ) { for ( RegData el : regData ) { if ( hasHashChanged ( mHasher , el ) ) { return true ; } } return false ; }
Check if any element of the given set has changed .
48
11
7,383
protected final boolean hasHashChanged ( Hasher hasher , RegData regDatum ) { String urlExternalForm = regDatum . getURLExternalForm ( ) ; // Check hash. String newHash = hasher . hashURL ( urlExternalForm ) ; boolean anyDiff = ! newHash . equals ( regDatum . getHash ( ) ) ; return anyDiff ; }
Check if the given datum has changed using the given hasher .
81
14
7,384
@ Nonnull public TypeaheadRemote setCache ( @ Nonnull final ETriState eCache ) { m_eCache = ValueEnforcer . notNull ( eCache , "Cache" ) ; return this ; }
Determines whether or not the browser will cache responses . See the jQuery . ajax docs for more info .
45
24
7,385
@ Nonnull public PhotonGlobalState setDefaultApplicationID ( @ Nullable final String sDefaultApplicationID ) { m_aRWLock . writeLocked ( ( ) -> { if ( ! EqualsHelper . equals ( m_sDefaultApplicationID , sDefaultApplicationID ) ) { m_sDefaultApplicationID = sDefaultApplicationID ; if ( LOGGER . isInfoEnabled ( ) ) LOGGER . info ( "Default application ID set to '" + sDefaultApplicationID + "'" ) ; } } ) ; return this ; }
Set the default application ID of an application servlet .
115
11
7,386
@ Nonnull public HCNodeList createSelectedFileEdit ( @ Nullable final String sPlaceholder ) { final HCEdit aEdit = new HCEdit ( ) . setPlaceholder ( sPlaceholder ) . setReadOnly ( true ) ; final HCScriptInline aScript = new HCScriptInline ( JQuery . idRef ( m_aEdit ) . on ( "change" , new JSAnonymousFunction ( JQuery . idRef ( aEdit ) . val ( JSExpr . THIS . ref ( "value" ) ) ) ) ) ; return new HCNodeList ( ) . addChildren ( aEdit , aScript ) ; }
Create a read only edit that contains the value of the selected file . It can be placed anywhere in the DOM .
138
23
7,387
@ Nonnull public FineUploader5DeleteFile setEndpoint ( @ Nonnull final ISimpleURL aEndpoint ) { ValueEnforcer . notNull ( aEndpoint , "Endpoint" ) ; m_aDeleteFileEndpoint = aEndpoint ; return this ; }
The endpoint to which delete file requests are sent .
60
10
7,388
@ Nonnull public FineUploader5DeleteFile setMethod ( @ Nonnull final EHttpMethod eMethod ) { ValueEnforcer . notNull ( eMethod , "Method" ) ; m_eDeleteFileMethod = eMethod ; return this ; }
Set the method to use for delete requests . Accepts POST or DELETE .
53
17
7,389
public List < JavaComment > javaDocOnly ( final List < JavaComment > originals ) { final List < JavaComment > results = new ArrayList < JavaComment > ( originals . size ( ) ) ; for ( JavaComment comment : originals ) { comment . _switch ( new JavaComment . SwitchBlockWithDefault ( ) { @ Override public void _case ( JavaDocComment x ) { results . add ( x ) ; } @ Override protected void _default ( JavaComment x ) { // do nothing, we only want to add javadocs } } ) ; } return results ; }
Turns a list of JavaComment into list of comments that only has javadoc comments
125
19
7,390
public List < JavaComment > stripTags ( final Set < String > tagNames , List < JavaComment > originals ) { final List < JavaComment > results = new ArrayList < JavaComment > ( originals . size ( ) ) ; for ( JavaComment original : originals ) { results . add ( original . match ( new JavaComment . MatchBlock < JavaComment > ( ) { @ Override public JavaComment _case ( JavaDocComment x ) { final List < JDTagSection > newTagSections = new ArrayList < JDTagSection > ( x . tagSections . size ( ) ) ; for ( JDTagSection tagSection : x . tagSections ) { if ( ! tagNames . contains ( tagSection . name ) ) { newTagSections . add ( tagSection ) ; } } return _JavaDocComment ( x . start , x . generalSection , newTagSections , x . end ) ; } @ Override public JavaComment _case ( JavaBlockComment x ) { return x ; } @ Override public JavaComment _case ( JavaEOLComment x ) { return x ; } } ) ) ; } return results ; }
Produce a copy of a list of comments where all javadoc comments have had the specified tags removed . Non javadoc comments are left alone .
250
33
7,391
public List < JavaComment > paramDoc ( final String paramName , List < JavaComment > originals ) { final List < JavaComment > results = new ArrayList < JavaComment > ( originals . size ( ) ) ; for ( JavaComment original : originals ) { original . _switch ( new JavaComment . SwitchBlock ( ) { @ Override public void _case ( JavaDocComment x ) { paramDocSections ( paramName , x . tagSections , results ) ; } @ Override public void _case ( JavaBlockComment x ) { // skip } @ Override public void _case ( JavaEOLComment x ) { // skip } } ) ; } return results ; }
Produce a copy of a list of JavaDoc comments by pulling specified parameter tags out of an orignal list of comments . Block and EOL comments are skipped . JavaDoc comments are stripped down to only have the content of the specified param tag
145
50
7,392
void set ( final int intVal ) { this . type = ClassWriter . INT ; this . intVal = intVal ; this . hashCode = 0x7FFFFFFF & ( type + intVal ) ; }
Sets this item to an integer item .
46
9
7,393
void set ( final long longVal ) { this . type = ClassWriter . LONG ; this . longVal = longVal ; this . hashCode = 0x7FFFFFFF & ( type + ( int ) longVal ) ; }
Sets this item to a long item .
49
9
7,394
void set ( final float floatVal ) { this . type = ClassWriter . FLOAT ; this . intVal = Float . floatToRawIntBits ( floatVal ) ; this . hashCode = 0x7FFFFFFF & ( type + ( int ) floatVal ) ; }
Sets this item to a float item .
61
9
7,395
void set ( final double doubleVal ) { this . type = ClassWriter . DOUBLE ; this . longVal = Double . doubleToRawLongBits ( doubleVal ) ; this . hashCode = 0x7FFFFFFF & ( type + ( int ) doubleVal ) ; }
Sets this item to a double item .
61
9
7,396
void set ( String name , String desc , int bsmIndex ) { this . type = ClassWriter . INDY ; this . longVal = bsmIndex ; this . strVal1 = name ; this . strVal2 = desc ; this . hashCode = 0x7FFFFFFF & ( ClassWriter . INDY + bsmIndex * strVal1 . hashCode ( ) * strVal2 . hashCode ( ) ) ; }
Sets the item to an InvokeDynamic item .
93
11
7,397
void set ( int position , int hashCode ) { this . type = ClassWriter . BSM ; this . intVal = position ; this . hashCode = hashCode ; }
Sets the item to a BootstrapMethod item .
37
11
7,398
public synchronized boolean isClassAffected ( String className ) { if ( isOnMustRunList ( className ) ) { return true ; } boolean isAffected = true ; String fullMethodName = className + "." + CLASS_EXT ; Set < RegData > regData = mStorer . load ( mRootDir , className , CLASS_EXT ) ; isAffected = isAffected ( regData ) ; recordTestAffectedOutcome ( fullMethodName , isAffected ) ; return isAffected ; }
Checks if class is affected since the last run .
119
11
7,399
private boolean isExcluded ( String fullMethodName ) { if ( mExcludes != null ) { for ( String s : mExcludes ) { if ( fullMethodName . startsWith ( s ) ) { return true ; } } } return false ; }
Checks if user requested that the given name is always run . True if this name has to be always run false otherwise .
54
25