idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
10,800
@ SuppressWarnings ( "unchecked" ) public static < T > T cleanse ( T list , T element ) { if ( list == null || list == element ) { return null ; } else if ( list instanceof Pair ) { Pair < T , T > pair = ( Pair < T , T > ) list ; if ( pair . first == element ) { return pair . second ; } else if ( pair . second == eleme...
Cleanses an isomorphic list of a particular element . Only one thread should be updating the list at a time .
10,801
@ SuppressWarnings ( "unchecked" ) public static < T > boolean includes ( T list , T element ) { if ( list == null ) { return false ; } else if ( list == element ) { return true ; } else if ( list instanceof Pair ) { Pair < T , T > pair = ( Pair < T , T > ) list ; if ( pair . first == element || pair . second == elemen...
Tests whether an isomorphic list includes a particular element .
10,802
@ SuppressWarnings ( "unchecked" ) public static < T > int count ( T list ) { if ( list == null ) { return 0 ; } else if ( list instanceof Pair ) { return 1 + count ( ( ( Pair < T , T > ) list ) . second ) ; } else { return 1 ; } }
Counts the number of elements in an isomorphic list .
10,803
@ SuppressWarnings ( "unchecked" ) public static < T > int traverse ( T list , Functor < ? , T > func ) { if ( list == null ) { return 0 ; } else if ( list instanceof Pair ) { Pair < T , T > pair = ( Pair < T , T > ) list ; func . invoke ( pair . first ) ; return 1 + traverse ( pair . second , func ) ; } else { func . ...
Traverses an isomorphic list using a Functor . The return values from the functor are discarded .
10,804
public JSONBuilder quote ( String value ) { _sb . append ( '"' ) ; for ( int i = 0 ; i < value . length ( ) ; ++ i ) { char c = value . charAt ( i ) ; switch ( c ) { case '"' : _sb . append ( "\\\"" ) ; break ; case '\\' : _sb . append ( "\\\\" ) ; break ; default : if ( c < 0x20 ) { _sb . append ( CTRLCHARS [ c ] ) ; ...
Quotes properly a string and appends it to the JSON stream .
10,805
public JSONBuilder serialize ( Object value ) { if ( value == null ) { _sb . append ( "null" ) ; } else { Class < ? > t = value . getClass ( ) ; if ( t . isArray ( ) ) { _sb . append ( '[' ) ; boolean hasElements = false ; for ( int i = 0 , ii = Array . getLength ( value ) ; i < ii ; ++ i ) { serialize ( Array . get ( ...
Serializes an object and appends it to the stream .
10,806
protected String createExceptionMessage ( final String message , final Object ... messageParameters ) { if ( ArrayUtils . isEmpty ( messageParameters ) ) { return message ; } else { return String . format ( message , messageParameters ) ; } }
Create a string message by string format .
10,807
public static ApruveResponse < PaymentRequest > get ( String paymentRequestId ) { return ApruveClient . getInstance ( ) . get ( PAYMENT_REQUESTS_PATH + paymentRequestId , PaymentRequest . class ) ; }
Fetches the PaymentRequest with the given ID from Apruve .
10,808
public String toSecureHash ( ) { String apiKey = ApruveClient . getInstance ( ) . getApiKey ( ) ; String shaInput = apiKey + toValueString ( ) ; return ShaUtil . getDigest ( shaInput ) ; }
For use by merchants and depends on proper initialization of ApruveClient . Returns the secure hash for a PaymentRequest suitable for use with the property of apruve . js JavaScript library on a merchant checkout page . Use this to populate the value of apruve . secureHash .
10,809
public AnnotationValue defaultValue ( ) { return ( sym . defaultValue == null ) ? null : new AnnotationValueImpl ( env , sym . defaultValue ) ; }
Returns the default value of this element . Returns null if this element has no default .
10,810
public void sessionReady ( boolean isReady ) { if ( isReady ) { speedSlider . setValue ( session . getClockPeriod ( ) ) ; } startAction . setEnabled ( isReady ) ; speedSlider . setEnabled ( isReady ) ; stepAction . setEnabled ( isReady ) ; reloadAction . setEnabled ( isReady ) ; }
Changes the UI depending on whether the session is ready or not
10,811
public synchronized void mark ( final int limit ) { try { in . mark ( limit ) ; } catch ( IOException ioe ) { throw new RuntimeException ( ioe . getMessage ( ) ) ; } }
Marks the read limit of the StringReader .
10,812
public synchronized void reset ( ) throws IOException { if ( in == null ) { throw new IOException ( "Stream Closed" ) ; } slack = null ; in . reset ( ) ; }
Resets the StringReader .
10,813
public synchronized void close ( ) throws IOException { if ( in != null ) in . close ( ) ; slack = null ; in = null ; }
Closes the Stringreader .
10,814
public Collection < String > getValues ( String property ) { Multimap < Optional < String > , String > values = properties . get ( property ) ; if ( values == null ) { return Collections . emptyList ( ) ; } return values . values ( ) ; }
Get all literal values for the property passed by parameter
10,815
public String getValue ( String property , String language ) { Multimap < Optional < String > , String > values = properties . get ( property ) ; if ( values == null ) { return null ; } Iterator < String > it = values . get ( Optional . of ( language ) ) . iterator ( ) ; return it . hasNext ( ) ? it . next ( ) : null ;...
Get a literal value for a property and language passed by parameters
10,816
public String getFirstPropertyValue ( String property ) { Iterator < String > it = getValues ( property ) . iterator ( ) ; return it . hasNext ( ) ? it . next ( ) : null ; }
Return the first value associated to the property passed by parameter
10,817
public DConnection findByAccessToken ( java . lang . String accessToken ) { return queryUniqueByField ( null , DConnectionMapper . Field . ACCESSTOKEN . getFieldName ( ) , accessToken ) ; }
find - by method for unique field accessToken
10,818
public Iterable < DConnection > queryByExpireTime ( java . util . Date expireTime ) { return queryByField ( null , DConnectionMapper . Field . EXPIRETIME . getFieldName ( ) , expireTime ) ; }
query - by method for field expireTime
10,819
public Iterable < DConnection > queryByImageUrl ( java . lang . String imageUrl ) { return queryByField ( null , DConnectionMapper . Field . IMAGEURL . getFieldName ( ) , imageUrl ) ; }
query - by method for field imageUrl
10,820
public Iterable < DConnection > queryByProfileUrl ( java . lang . String profileUrl ) { return queryByField ( null , DConnectionMapper . Field . PROFILEURL . getFieldName ( ) , profileUrl ) ; }
query - by method for field profileUrl
10,821
public Iterable < DConnection > queryByProviderId ( java . lang . String providerId ) { return queryByField ( null , DConnectionMapper . Field . PROVIDERID . getFieldName ( ) , providerId ) ; }
query - by method for field providerId
10,822
public Iterable < DConnection > queryByProviderUserId ( java . lang . String providerUserId ) { return queryByField ( null , DConnectionMapper . Field . PROVIDERUSERID . getFieldName ( ) , providerUserId ) ; }
query - by method for field providerUserId
10,823
public DConnection findByRefreshToken ( java . lang . String refreshToken ) { return queryUniqueByField ( null , DConnectionMapper . Field . REFRESHTOKEN . getFieldName ( ) , refreshToken ) ; }
find - by method for unique field refreshToken
10,824
public Iterable < DConnection > queryBySecret ( java . lang . String secret ) { return queryByField ( null , DConnectionMapper . Field . SECRET . getFieldName ( ) , secret ) ; }
query - by method for field secret
10,825
public Iterable < DConnection > queryByUserId ( java . lang . Long userId ) { return queryByField ( null , DConnectionMapper . Field . USERID . getFieldName ( ) , userId ) ; }
query - by method for field userId
10,826
public Iterable < DConnection > queryByUserRoles ( java . lang . String userRoles ) { return queryByField ( null , DConnectionMapper . Field . USERROLES . getFieldName ( ) , userRoles ) ; }
query - by method for field userRoles
10,827
public void add ( Collection < Label > labels ) { for ( Label label : labels ) this . labels . put ( label . getKey ( ) , label ) ; }
Adds the label list to the labels for the account .
10,828
public final void sendGlobal ( String handler , String data ) { try { connection . sendMessage ( "{\"id\":-1,\"type\":\"global\",\"handler\":" + Json . escapeString ( handler ) + ",\"data\":" + data + "}" ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }
This function is mainly made for plug - in use it sends data to global user handler for example to perform some tasks that aren t related directly to widgets . Global handler is a javascript function in array named global under key that is passed to this function as handler parameter . As first argument the javascript ...
10,829
public void replaceWith ( final ThriftEnvelope thriftEnvelope ) { this . typeName = thriftEnvelope . typeName ; this . name = thriftEnvelope . name ; this . payload . clear ( ) ; this . payload . addAll ( thriftEnvelope . payload ) ; }
hack method to allow hadoop to re - use this object
10,830
protected void addFrameWarning ( Content contentTree ) { Content noframes = new HtmlTree ( HtmlTag . NOFRAMES ) ; Content noScript = HtmlTree . NOSCRIPT ( HtmlTree . DIV ( getResource ( "doclet.No_Script_Message" ) ) ) ; noframes . addContent ( noScript ) ; Content noframesHead = HtmlTree . HEADING ( HtmlConstants . CO...
Add the code for issueing the warning for a non - frame capable web client . Also provide links to the non - frame version documentation .
10,831
private void addAllPackagesFrameTag ( Content contentTree ) { HtmlTree frame = HtmlTree . FRAME ( DocPaths . OVERVIEW_FRAME . getPath ( ) , "packageListFrame" , configuration . getText ( "doclet.All_Packages" ) ) ; contentTree . addContent ( frame ) ; }
Add the FRAME tag for the frame that lists all packages .
10,832
private void addAllClassesFrameTag ( Content contentTree ) { HtmlTree frame = HtmlTree . FRAME ( DocPaths . ALLCLASSES_FRAME . getPath ( ) , "packageFrame" , configuration . getText ( "doclet.All_classes_and_interfaces" ) ) ; contentTree . addContent ( frame ) ; }
Add the FRAME tag for the frame that lists all classes .
10,833
private void addClassFrameTag ( Content contentTree ) { HtmlTree frame = HtmlTree . FRAME ( configuration . topFile . getPath ( ) , "classFrame" , configuration . getText ( "doclet.Package_class_and_interface_descriptions" ) , SCROLL_YES ) ; contentTree . addContent ( frame ) ; }
Add the FRAME tag for the frame that describes the class in detail .
10,834
public static JCTree declarationFor ( final Symbol sym , final JCTree tree ) { class DeclScanner extends TreeScanner { JCTree result = null ; public void scan ( JCTree tree ) { if ( tree != null && result == null ) tree . accept ( this ) ; } public void visitTopLevel ( JCCompilationUnit that ) { if ( that . packge == s...
Find the declaration for a symbol where that symbol is defined somewhere in the given tree .
10,835
public static List < Type > types ( List < ? extends JCTree > trees ) { ListBuffer < Type > ts = new ListBuffer < Type > ( ) ; for ( List < ? extends JCTree > l = trees ; l . nonEmpty ( ) ; l = l . tail ) ts . append ( l . head . type ) ; return ts . toList ( ) ; }
Return the types of a list of trees .
10,836
protected void configure ( Properties properties ) { _properties = properties ; _recipients = properties . getProperty ( "mail.smtp.to" ) . split ( " *[,;] *" ) ; _authenticator = new Authenticator ( ) { protected PasswordAuthentication getPasswordAuthentication ( ) { return new PasswordAuthentication ( _properties . g...
Configures the EmailChannel with given properties .
10,837
private void initStandardTagsLowercase ( ) { Iterator < String > it = standardTags . iterator ( ) ; while ( it . hasNext ( ) ) { standardTagsLowercase . add ( StringUtils . toLowerCase ( it . next ( ) ) ) ; } }
Initialize lowercase version of standard Javadoc tags .
10,838
public static ApruveResponse < Subscription > get ( String suscriptionId ) { return ApruveClient . getInstance ( ) . get ( getSubscriptionsPath ( ) + suscriptionId , Subscription . class ) ; }
Get the Subscription with the given ID
10,839
public static ApruveResponse < SubscriptionCancelResponse > cancel ( String subscriptionId ) { return ApruveClient . getInstance ( ) . post ( getCancelPath ( subscriptionId ) , "" , SubscriptionCancelResponse . class ) ; }
Cancels the Subscription with the given ID . This cannot be undone once completed so use with care!
10,840
public boolean handleNextTask ( ) { Runnable task = this . getNextTask ( ) ; if ( task != null ) { synchronized ( this . tasksReachesZero ) { this . runningTasks ++ ; } try { task . run ( ) ; } catch ( Throwable t ) { t . printStackTrace ( ) ; } synchronized ( this . tasksReachesZero ) { this . runningTasks -- ; if ( t...
Process the next pending Task synchronously .
10,841
public < T extends Runnable > T executeSync ( T runnable ) { synchronized ( runnable ) { this . executeAsync ( runnable ) ; try { runnable . wait ( ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } } return runnable ; }
Add a Task to the queue and wait until it s run . It is guaranteed that the Runnable will be processed when this method returns .
10,842
public < T extends Runnable > T executeSyncTimed ( T runnable , long inMs ) { try { Thread . sleep ( inMs ) ; this . executeSync ( runnable ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } return runnable ; }
Add a Task to the queue and wait until it s run . The Task will be executed after inMs milliseconds . It is guaranteed that the Runnable will be processed when this method returns .
10,843
public < T extends Runnable > T executeAsyncTimed ( T runnable , long inMs ) { final Runnable theRunnable = runnable ; Timer timer = new Timer ( ) ; timer . schedule ( new TimerTask ( ) { public void run ( ) { TaskQueue . this . executeAsync ( theRunnable ) ; } } , inMs ) ; return runnable ; }
Add a Task to the queue . The Task will be executed after inMs milliseconds .
10,844
protected boolean waitForTasks ( ) { synchronized ( this . tasks ) { while ( ! this . closed && ! this . hasTaskPending ( ) ) { try { this . tasks . wait ( ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } } } return ! this . closed ; }
Wait until the TaskQueue has a Task ready to process . If the TaskQueue is closed this method will also return but giving the value false .
10,845
public void waitAllTasks ( ) { synchronized ( this . tasks ) { while ( this . hasTaskPending ( ) ) { try { this . tasks . wait ( ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } } synchronized ( this . tasksReachesZero ) { if ( this . runningTasks > 0 ) { try { this . tasksReachesZero . wait ( ) ; }...
Wait that every pending task are processed . This method will return once it has no pending task or once it has been closed
10,846
protected List < SchemaDescriptor > scanConnection ( String url , String user , String password , String infoLevelName , String bundledDriverName , Properties properties , Store store ) throws IOException { LOGGER . info ( "Scanning schema '{}'" , url ) ; Catalog catalog = getCatalog ( url , user , password , infoLevel...
Scans the connection identified by the given parameters .
10,847
protected Catalog getCatalog ( String url , String user , String password , String infoLevelName , String bundledDriverName , Properties properties ) throws IOException { InfoLevel level = InfoLevel . valueOf ( infoLevelName . toLowerCase ( ) ) ; SchemaInfoLevel schemaInfoLevel = level . getSchemaInfoLevel ( ) ; for ( ...
Retrieves the catalog metadata using schema crawler .
10,848
private SchemaCrawlerOptions getOptions ( String bundledDriverName , InfoLevel level ) throws IOException { for ( BundledDriver bundledDriver : BundledDriver . values ( ) ) { if ( bundledDriver . name ( ) . toLowerCase ( ) . equals ( bundledDriverName . toLowerCase ( ) ) ) { return bundledDriver . getOptions ( level ) ...
Loads the bundled driver options
10,849
private List < SchemaDescriptor > createSchemas ( Catalog catalog , Store store ) throws IOException { List < SchemaDescriptor > schemaDescriptors = new ArrayList < > ( ) ; Map < String , ColumnTypeDescriptor > columnTypes = new HashMap < > ( ) ; Map < Column , ColumnDescriptor > allColumns = new HashMap < > ( ) ; Set ...
Stores the data .
10,850
private void createTables ( Catalog catalog , Schema schema , SchemaDescriptor schemaDescriptor , Map < String , ColumnTypeDescriptor > columnTypes , Map < Column , ColumnDescriptor > allColumns , Set < ForeignKey > allForeignKeys , Store store ) { for ( Table table : catalog . getTables ( schema ) ) { TableDescriptor ...
Create the table descriptors .
10,851
private < T extends BaseColumnDescriptor > T createColumnDescriptor ( BaseColumn column , Class < T > descriptorType , Map < String , ColumnTypeDescriptor > columnTypes , Store store ) { T columnDescriptor = store . create ( descriptorType ) ; columnDescriptor . setName ( column . getName ( ) ) ; columnDescriptor . set...
Create a column descriptor .
10,852
private void createForeignKeys ( Set < ForeignKey > allForeignKeys , Map < Column , ColumnDescriptor > allColumns , Store store ) { for ( ForeignKey foreignKey : allForeignKeys ) { ForeignKeyDescriptor foreignKeyDescriptor = store . create ( ForeignKeyDescriptor . class ) ; foreignKeyDescriptor . setName ( foreignKey ....
Create the foreign key descriptors .
10,853
private void createRoutines ( Collection < Routine > routines , SchemaDescriptor schemaDescriptor , Map < String , ColumnTypeDescriptor > columnTypes , Store store ) throws IOException { for ( Routine routine : routines ) { RoutineDescriptor routineDescriptor ; String returnType ; switch ( routine . getRoutineType ( ) ...
Create routines i . e . functions and procedures .
10,854
private void createSequences ( Collection < Sequence > sequences , SchemaDescriptor schemaDescriptor , Store store ) { for ( Sequence sequence : sequences ) { SequenceDesriptor sequenceDesriptor = store . create ( SequenceDesriptor . class ) ; sequenceDesriptor . setName ( sequence . getName ( ) ) ; sequenceDesriptor ....
Add the sequences of a schema to the schema descriptor .
10,855
private TableDescriptor getTableDescriptor ( Table table , SchemaDescriptor schemaDescriptor , Store store ) { TableDescriptor tableDescriptor ; if ( table instanceof View ) { View view = ( View ) table ; ViewDescriptor viewDescriptor = store . create ( ViewDescriptor . class ) ; viewDescriptor . setUpdatable ( view . ...
Create a table descriptor for the given table .
10,856
private < I extends IndexDescriptor > I storeIndex ( Index index , TableDescriptor tableDescriptor , Map < String , ColumnDescriptor > columns , Class < I > indexType , Class < ? extends OnColumnDescriptor > onColumnType , Store store ) { I indexDescriptor = store . create ( indexType ) ; indexDescriptor . setName ( in...
Stores index data .
10,857
private ColumnTypeDescriptor getColumnTypeDescriptor ( ColumnDataType columnDataType , Map < String , ColumnTypeDescriptor > columnTypes , Store store ) { String databaseSpecificTypeName = columnDataType . getDatabaseSpecificTypeName ( ) ; ColumnTypeDescriptor columnTypeDescriptor = columnTypes . get ( databaseSpecific...
Return the column type descriptor for the given data type .
10,858
public static ProfilePackageSummaryBuilder getInstance ( Context context , PackageDoc pkg , ProfilePackageSummaryWriter profilePackageWriter , Profile profile ) { return new ProfilePackageSummaryBuilder ( context , pkg , profilePackageWriter , profile ) ; }
Construct a new ProfilePackageSummaryBuilder .
10,859
public void addItem ( Point coordinates , Drawable item ) { assertEDT ( ) ; if ( coordinates == null || item == null ) { throw new IllegalArgumentException ( "Coordinates and added item cannot be null" ) ; } log . trace ( "[addItem] New item added @ {}" , coordinates ) ; getPanelAt ( coordinates ) . addModel ( item ) ;...
Adds an item to draw in a particular position
10,860
public void moveItem ( Point oldCoordinates , Point newCoordinates ) { assertEDT ( ) ; if ( oldCoordinates == null || newCoordinates == null ) { throw new IllegalArgumentException ( "Coordinates cannot be null" ) ; } if ( getPanelAt ( newCoordinates ) . hasModel ( ) ) { throw new IllegalStateException ( "New position c...
Changes the position of the item in the specified location
10,861
public void clear ( ) { assertEDT ( ) ; log . debug ( "[clear] Cleaning board" ) ; for ( int row = 0 ; row < SIZE ; row ++ ) { for ( int col = 0 ; col < SIZE ; col ++ ) { removeItem ( new Point ( col , row ) ) ; } } }
Removes all the drawn elements
10,862
public void refresh ( Point coordinates ) { assertEDT ( ) ; if ( coordinates == null ) { throw new IllegalArgumentException ( "Coordinates cannot be null" ) ; } getPanelAt ( coordinates ) . repaint ( ) ; }
Repaints the item specified
10,863
public TablePanel removeAll ( ) { for ( int i = 0 ; i < content . length ; ++ i ) for ( int j = 0 ; j < content [ i ] . length ; ++ j ) content [ i ] [ j ] = null ; this . sendElement ( ) ; return this ; }
Removes all elements stored in this container
10,864
public TablePanel remove ( Widget widget ) { for ( int i = 0 ; i < content . length ; ++ i ) for ( int j = 0 ; j < content [ i ] . length ; ++ j ) if ( content [ i ] [ j ] == widget ) content [ i ] [ j ] = null ; this . sendElement ( ) ; return this ; }
Removes all elements that are instance of specified element
10,865
public TablePanel put ( Widget widget , int x , int y ) { if ( x < 0 || y < 0 || x >= content . length || y >= content [ x ] . length ) throw new IndexOutOfBoundsException ( ) ; attach ( widget ) ; content [ x ] [ y ] = widget ; this . sendElement ( ) ; return this ; }
Set widget to certain cell in table
10,866
private Map < String , String > loadProperties ( ServiceReference reference ) { log . trace ( "loadProperties" ) ; Map < String , String > properties = new HashMap < String , String > ( ) ; properties . put ( "id" , OsgiUtil . toString ( reference . getProperty ( Constants . SERVICE_ID ) , "" ) ) ; properties . put ( "...
Loads the properties from the specified Service Reference into a map .
10,867
private void renderBlock ( HttpServletResponse res , String templateName , Map < String , String > properties ) throws IOException { InputStream is = null ; ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; String template = null ; try { is = getClass ( ) . getClassLoader ( ) . getResourceAsStream ( template...
Loads the template with the specified name from the classloader and uses it to templatize the properties using Apache Commons Lang s StrSubstitutor and writes it to the response .
10,868
private void unmarshall ( ) { sheetData = sheet . getJaxbElement ( ) . getSheetData ( ) ; rows = sheetData . getRow ( ) ; if ( rows != null && rows . size ( ) > 0 ) { Row r = ( Row ) rows . get ( 0 ) ; numColumns = r . getC ( ) . size ( ) ; } }
Unmarshall the data in this worksheet .
10,869
public int getRows ( ) { if ( sheetData == null ) unmarshall ( ) ; int ret = 0 ; if ( rows != null ) ret = rows . size ( ) ; return ret ; }
Returns the number of rows in this worksheet .
10,870
public static ManifestVersion get ( final Class < ? > clazz ) { final String manifestUrl = ClassExtensions . getManifestUrl ( clazz ) ; try { return of ( manifestUrl != null ? new URL ( manifestUrl ) : null ) ; } catch ( final MalformedURLException ignore ) { return of ( null ) ; } }
Returns a ManifestVersion object by reading the manifest file from the JAR WAR or EAR file that contains the given class .
10,871
public Object processTask ( String taskName , Map < String , String [ ] > parameterMap ) { if ( "createAdmin" . equalsIgnoreCase ( taskName ) ) { return userService . createDefaultAdmin ( ) ; } return null ; }
Create a default admin in the datastore .
10,872
public ValueType get ( final KeyType ... keys ) { if ( ArrayUtils . isEmpty ( keys ) ) { return null ; } int keysLength = keys . length ; if ( keysLength == 1 ) { return get ( keys [ 0 ] ) ; } else { StorageComponent < KeyType , ValueType > storageComponent = this ; int lastKeyIndex = keysLength - 1 ; for ( int i = 0 ;...
Returns value of keys reference .
10,873
public void put ( final ValueType value , final KeyType ... keys ) { if ( ArrayUtils . isEmpty ( keys ) ) { return ; } int keysLength = keys . length ; if ( keysLength == 1 ) { put ( value , keys [ 0 ] ) ; } else { StorageComponent < KeyType , ValueType > childStorageComponent = getStorageComponent ( keys [ 0 ] ) ; int...
Storages the value by keys .
10,874
public StorageComponent < KeyType , ValueType > getStorageComponent ( final KeyType key ) { KeyToStorageComponent < KeyType , ValueType > storage = getkeyToStorage ( ) ; StorageComponent < KeyType , ValueType > storageComponent = storage . get ( key ) ; if ( storageComponent == null ) { storageComponent = new StorageCo...
Returns child StorageComponent by given key .
10,875
public boolean add ( T element , Class < ? > accessibleClass ) { boolean added = false ; while ( accessibleClass != null && accessibleClass != this . baseClass ) { added |= this . addSingle ( element , accessibleClass ) ; for ( Class < ? > interf : accessibleClass . getInterfaces ( ) ) { this . addSingle ( element , in...
Associate the element with accessibleClass and any of the the superclass and interfaces of the accessibleClass until baseClass
10,876
public void remove ( T element , Class < ? > accessibleClass ) { while ( accessibleClass != null && accessibleClass != this . baseClass ) { this . removeSingle ( element , accessibleClass ) ; for ( Class < ? > interf : accessibleClass . getInterfaces ( ) ) { this . removeSingle ( element , interf ) ; } accessibleClass ...
Remove the element from accessible class and any of the superclass and interfaces of the accessibleClass until baseClass
10,877
private static void _readIBANDataFromXML ( ) { final IMicroDocument aDoc = MicroReader . readMicroXML ( new ClassPathResource ( "codelists/iban-country-data.xml" ) ) ; if ( aDoc == null ) throw new InitializationException ( "Failed to read IBAN country data [1]" ) ; if ( aDoc . getDocumentElement ( ) == null ) throw ne...
Read all IBAN country data from a file .
10,878
public static IBANCountryData getCountryData ( final String sCountryCode ) { ValueEnforcer . notNull ( sCountryCode , "CountryCode" ) ; return s_aIBANData . get ( sCountryCode . toUpperCase ( Locale . US ) ) ; }
Get the country data for the given country code .
10,879
public static String unifyIBAN ( final String sIBAN ) { if ( sIBAN == null ) return null ; String sRealIBAN = sIBAN . toUpperCase ( Locale . US ) ; sRealIBAN = RegExHelper . stringReplacePattern ( "[^0-9A-Z]" , sRealIBAN , "" ) ; if ( sRealIBAN . length ( ) < 4 ) return null ; return sRealIBAN ; }
Make an IBAN that can be parsed . It is converted to upper case and all non - alphanumeric characters are removed .
10,880
public static boolean isValidIBAN ( final String sIBAN , final boolean bReturnCodeIfNoCountryData ) { final String sRealIBAN = unifyIBAN ( sIBAN ) ; if ( sRealIBAN == null ) return false ; final IBANCountryData aData = s_aIBANData . get ( sRealIBAN . substring ( 0 , 2 ) ) ; if ( aData == null ) return bReturnCodeIfNoCo...
Check if the passed IBAN is valid and the country is supported!
10,881
public void buildContent ( XMLNode node , Content contentTree ) { Content packageContentTree = packageWriter . getContentHeader ( ) ; buildChildren ( node , packageContentTree ) ; contentTree . addContent ( packageContentTree ) ; }
Build the content for the package doc .
10,882
public JavaFileObject asJavaFileObject ( File file ) { JavacFileManager fm = ( JavacFileManager ) context . get ( JavaFileManager . class ) ; return fm . getRegularFile ( file ) ; }
Construct a JavaFileObject from the given file .
10,883
public Iterable < ? extends CompilationUnitTree > parse ( ) throws IOException { try { prepareCompiler ( ) ; List < JCCompilationUnit > units = compiler . parseFiles ( fileObjects ) ; for ( JCCompilationUnit unit : units ) { JavaFileObject file = unit . getSourceFile ( ) ; if ( notYetEntered . containsKey ( file ) ) no...
Parse the specified files returning a list of abstract syntax trees .
10,884
public static ClassLoader findMostCompleteClassLoader ( Class < ? > target ) { ClassLoader classLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( classLoader == null && target != null ) { classLoader = target . getClassLoader ( ) ; } if ( classLoader == null ) { classLoader = ClassLoaders . class ....
Find the most complete class loader by trying the current thread context class loader then the classloader of the given class if any then the class loader that loaded SEED core then the system class loader .
10,885
public void emit ( Level level , String message , long sequence ) { if ( _broadcaster != null ) _broadcaster . sendNotification ( new Notification ( level . toString ( ) , _name != null ? _name : this , sequence , message ) ) ; }
Emits a notification through this manageable .
10,886
public < T extends Throwable > T emit ( T throwable , String message , long sequence ) { if ( _broadcaster != null ) _broadcaster . sendNotification ( new Notification ( Level . WARNING . toString ( ) , _name != null ? _name : this , sequence , message == null ? Throwables . getFullMessage ( throwable ) : message + ": ...
Emits an alert for a caught Throwable through this manageable .
10,887
public void emit ( Level level , String message , long sequence , Logger logger ) { emit ( level , message , sequence ) ; logger . log ( level , message ) ; }
Emits a notification through this manageable entering the notification into a logger along the way .
10,888
public < T extends Throwable > T emit ( T throwable , String message , long sequence , Logger logger ) { message = message == null ? Throwables . getFullMessage ( throwable ) : message + ": " + Throwables . getFullMessage ( throwable ) ; emit ( Level . WARNING , message , sequence , logger ) ; return throwable ; }
Emits an alert for a caught Throwable through this manageable entering the alert into a logger along the way .
10,889
public ArrayList < SchemaField > getSchema ( ) { final ArrayList < SchemaField > items = new ArrayList < SchemaField > ( schemaFields . values ( ) ) ; Collections . sort ( items , new Comparator < SchemaField > ( ) { public int compare ( final SchemaField left , final SchemaField right ) { return left . getId ( ) - rig...
Get the schema as a collection of fields . We guarantee the ordering by field id .
10,890
PlatformControl bind ( ServicePlatform p , XmlWebApplicationContext c , ClassLoader l ) { _platform = p ; _root = c ; _cloader = l ; return this ; }
To be called by ServicePlatform when detected in the top - level application context .
10,891
public static boolean isSafeMediaType ( final String mediaType ) { return mediaType != null && VALID_MIME_TYPE . matcher ( mediaType ) . matches ( ) && ! DANGEROUS_MEDIA_TYPES . contains ( mediaType ) ; }
Returns true if the given string is a valid media type
10,892
public WriteStream writeStream ( ) { detachReader ( ) ; if ( writer == null ) { writer = new BytesWriteStream ( bytes , maxCapacity ) ; } return writer ; }
Attaches a writer to the object . If there is already an attached writer the existing writer is returned . If a reader is attached to the object when this method is called the reader is closed and immediately detached before a writer is created .
10,893
public ReadStream readStream ( ) { detachWriter ( ) ; if ( reader == null ) { reader = new BytesReadStream ( bytes , 0 , length ) ; } return reader ; }
Attaches a reader to the object . If there is already any attached reader the existing reader is returned . If a writer is attached to the object when this method is called the writer is closed and immediately detached before the reader is created .
10,894
public void add ( Collection < Entity > entities ) { for ( Entity entity : entities ) this . entities . put ( entity . getId ( ) , entity ) ; }
Adds the entity list to the entities for the account .
10,895
public Class < ? > loadClass ( String classname ) throws ClassNotFoundException { return getClass ( ) . getClassLoader ( ) . loadClass ( classname ) ; }
Get the class loader of the mock rather than that of the bundle .
10,896
public ResourceSchema getSchema ( final String location , final Job job ) throws IOException { final List < Schema . FieldSchema > schemaList = new ArrayList < Schema . FieldSchema > ( ) ; for ( final GoodwillSchemaField field : schema . getSchema ( ) ) { schemaList . add ( new Schema . FieldSchema ( field . getName ( ...
Get a schema for the data to be loaded .
10,897
public static String getUserApplicationConfigurationFilePath ( final String applicationName , final String configFileName ) { return System . getProperty ( USER_HOME_PROPERTY_KEY ) + File . separator + applicationName + File . separator + configFileName ; }
Gets the user application configuration file path .
10,898
public static String getTemporaryApplicationConfigurationFilePath ( final String applicationName , final String fileName ) { return System . getProperty ( JAVA_IO_TPMDIR_PROPERTY_KEY ) + File . separator + applicationName + File . separator + fileName ; }
Gets the specific temporary directory path for from the given arguments . It is indeded for any application temporary files
10,899
public static < T > T instantiateClass ( final Class < T > clazz ) throws IllegalArgumentException , BeanInstantiationException { return instantiateClass ( clazz , MethodUtils . EMPTY_PARAMETER_CLASSTYPES , MethodUtils . EMPTY_PARAMETER_VALUES ) ; }
Create and initialize a new instance of the given class by default constructor .