idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
10,800
public Iterable < DConnection > queryByExpireTime ( java . util . Date expireTime ) { return queryByField ( null , DConnectionMapper . Field . EXPIRETIME . getFieldName ( ) , expireTime ) ; }
query - by method for field expireTime
52
8
10,801
public Iterable < DConnection > queryByImageUrl ( java . lang . String imageUrl ) { return queryByField ( null , DConnectionMapper . Field . IMAGEURL . getFieldName ( ) , imageUrl ) ; }
query - by method for field imageUrl
50
8
10,802
public Iterable < DConnection > queryByProfileUrl ( java . lang . String profileUrl ) { return queryByField ( null , DConnectionMapper . Field . PROFILEURL . getFieldName ( ) , profileUrl ) ; }
query - by method for field profileUrl
50
8
10,803
public Iterable < DConnection > queryByProviderId ( java . lang . String providerId ) { return queryByField ( null , DConnectionMapper . Field . PROVIDERID . getFieldName ( ) , providerId ) ; }
query - by method for field providerId
50
8
10,804
public Iterable < DConnection > queryByProviderUserId ( java . lang . String providerUserId ) { return queryByField ( null , DConnectionMapper . Field . PROVIDERUSERID . getFieldName ( ) , providerUserId ) ; }
query - by method for field providerUserId
54
9
10,805
public DConnection findByRefreshToken ( java . lang . String refreshToken ) { return queryUniqueByField ( null , DConnectionMapper . Field . REFRESHTOKEN . getFieldName ( ) , refreshToken ) ; }
find - by method for unique field refreshToken
51
9
10,806
public Iterable < DConnection > queryBySecret ( java . lang . String secret ) { return queryByField ( null , DConnectionMapper . Field . SECRET . getFieldName ( ) , secret ) ; }
query - by method for field secret
46
7
10,807
public Iterable < DConnection > queryByUserId ( java . lang . Long userId ) { return queryByField ( null , DConnectionMapper . Field . USERID . getFieldName ( ) , userId ) ; }
query - by method for field userId
50
8
10,808
public Iterable < DConnection > queryByUserRoles ( java . lang . String userRoles ) { return queryByField ( null , DConnectionMapper . Field . USERROLES . getFieldName ( ) , userRoles ) ; }
query - by method for field userRoles
55
9
10,809
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 .
35
11
10,810
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 function is given data object that is passed as JSON here
78
69
10,811
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
69
12
10,812
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 . CONTENT_HEADING , getResource ( "doclet.Frame_Alert" ) ) ; noframes . addContent ( noframesHead ) ; Content p = HtmlTree . P ( getResource ( "doclet.Frame_Warning_Message" , getHyperLink ( configuration . topFile , configuration . getText ( "doclet.Non_Frame_Version" ) ) ) ) ; noframes . addContent ( p ) ; contentTree . addContent ( noframes ) ; }
Add the code for issueing the warning for a non - frame capable web client . Also provide links to the non - frame version documentation .
196
28
10,813
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 .
74
13
10,814
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 .
78
13
10,815
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 .
79
15
10,816
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 == sym ) result = that ; else super . visitTopLevel ( that ) ; } public void visitClassDef ( JCClassDecl that ) { if ( that . sym == sym ) result = that ; else super . visitClassDef ( that ) ; } public void visitMethodDef ( JCMethodDecl that ) { if ( that . sym == sym ) result = that ; else super . visitMethodDef ( that ) ; } public void visitVarDef ( JCVariableDecl that ) { if ( that . sym == sym ) result = that ; else super . visitVarDef ( that ) ; } public void visitTypeParameter ( JCTypeParameter that ) { if ( that . type != null && that . type . tsym == sym ) result = that ; else super . visitTypeParameter ( that ) ; } } DeclScanner s = new DeclScanner ( ) ; tree . accept ( s ) ; return s . result ; }
Find the declaration for a symbol where that symbol is defined somewhere in the given tree .
277
17
10,817
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 .
82
9
10,818
protected void configure ( Properties properties ) { _properties = properties ; _recipients = properties . getProperty ( "mail.smtp.to" ) . split ( " *[,;] *" ) ; _authenticator = new Authenticator ( ) { protected PasswordAuthentication getPasswordAuthentication ( ) { return new PasswordAuthentication ( _properties . getProperty ( "mail.smtp.user" ) , _properties . getProperty ( "mail.smtp.pass" ) ) ; } } ; }
Configures the EmailChannel with given properties .
109
9
10,819
private void initStandardTagsLowercase ( ) { Iterator < String > it = standardTags . iterator ( ) ; while ( it . hasNext ( ) ) { standardTagsLowercase . add ( StringUtils . toLowerCase ( it . next ( ) ) ) ; } }
Initialize lowercase version of standard Javadoc tags .
59
12
10,820
public static ApruveResponse < Subscription > get ( String suscriptionId ) { return ApruveClient . getInstance ( ) . get ( getSubscriptionsPath ( ) + suscriptionId , Subscription . class ) ; }
Get the Subscription with the given ID
50
8
10,821
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!
54
22
10,822
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 ( this . runningTasks == 0 ) { this . tasksReachesZero . notifyAll ( ) ; } } synchronized ( task ) { task . notifyAll ( ) ; } return true ; } return false ; }
Process the next pending Task synchronously .
135
8
10,823
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 .
71
29
10,824
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 .
69
39
10,825
public < T extends Runnable > T executeAsyncTimed ( T runnable , long inMs ) { final Runnable theRunnable = runnable ; // This implementation is not really suitable for now as the timer uses its own thread // The TaskQueue itself should be able in the future to handle this without using a new thread Timer timer = new Timer ( ) ; timer . schedule ( new TimerTask ( ) { @ Override public void run ( ) { TaskQueue . this . executeAsync ( theRunnable ) ; } } , inMs ) ; return runnable ; }
Add a Task to the queue . The Task will be executed after inMs milliseconds .
129
17
10,826
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 .
72
29
10,827
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 ( ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } } } } }
Wait that every pending task are processed . This method will return once it has no pending task or once it has been closed
115
24
10,828
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 , infoLevelName , bundledDriverName , properties ) ; return createSchemas ( catalog , store ) ; }
Scans the connection identified by the given parameters .
92
10
10,829
protected Catalog getCatalog ( String url , String user , String password , String infoLevelName , String bundledDriverName , Properties properties ) throws IOException { // Determine info level InfoLevel level = InfoLevel . valueOf ( infoLevelName . toLowerCase ( ) ) ; SchemaInfoLevel schemaInfoLevel = level . getSchemaInfoLevel ( ) ; // Set options for ( InfoLevelOption option : InfoLevelOption . values ( ) ) { String value = properties . getProperty ( option . getPropertyName ( ) ) ; if ( value != null ) { LOGGER . info ( "Setting option " + option . name ( ) + "=" + value ) ; option . set ( schemaInfoLevel , Boolean . valueOf ( value . toLowerCase ( ) ) ) ; } } SchemaCrawlerOptions options ; if ( bundledDriverName != null ) { options = getOptions ( bundledDriverName , level ) ; } else { options = new SchemaCrawlerOptions ( ) ; } options . setSchemaInfoLevel ( schemaInfoLevel ) ; LOGGER . debug ( "Scanning database schemas on '" + url + "' (user='" + user + "', info level='" + level . name ( ) + "')" ) ; Catalog catalog ; try ( Connection connection = DriverManager . getConnection ( url , user , password ) ) { catalog = SchemaCrawlerUtility . getCatalog ( connection , options ) ; } catch ( SQLException | SchemaCrawlerException e ) { throw new IOException ( String . format ( "Cannot scan schema (url='%s', user='%s'" , url , user ) , e ) ; } return catalog ; }
Retrieves the catalog metadata using schema crawler .
358
11
10,830
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 ) ; } } throw new IOException ( "Unknown bundled driver name '" + bundledDriverName + "', supported values are " + Arrays . asList ( BundledDriver . values ( ) ) ) ; }
Loads the bundled driver options
121
6
10,831
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 < ForeignKey > allForeignKeys = new HashSet <> ( ) ; for ( Schema schema : catalog . getSchemas ( ) ) { SchemaDescriptor schemaDescriptor = store . create ( SchemaDescriptor . class ) ; schemaDescriptor . setName ( schema . getName ( ) ) ; // Tables createTables ( catalog , schema , schemaDescriptor , columnTypes , allColumns , allForeignKeys , store ) ; // Sequences createSequences ( catalog . getSequences ( schema ) , schemaDescriptor , store ) ; // Procedures and Functions createRoutines ( catalog . getRoutines ( schema ) , schemaDescriptor , columnTypes , store ) ; schemaDescriptors . add ( schemaDescriptor ) ; } // Foreign keys createForeignKeys ( allForeignKeys , allColumns , store ) ; return schemaDescriptors ; }
Stores the data .
279
5
10,832
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 tableDescriptor = getTableDescriptor ( table , schemaDescriptor , store ) ; Map < String , ColumnDescriptor > localColumns = new HashMap <> ( ) ; for ( Column column : table . getColumns ( ) ) { ColumnDescriptor columnDescriptor = createColumnDescriptor ( column , ColumnDescriptor . class , columnTypes , store ) ; columnDescriptor . setDefaultValue ( column . getDefaultValue ( ) ) ; columnDescriptor . setGenerated ( column . isGenerated ( ) ) ; columnDescriptor . setPartOfIndex ( column . isPartOfIndex ( ) ) ; columnDescriptor . setPartOfPrimaryKey ( column . isPartOfPrimaryKey ( ) ) ; columnDescriptor . setPartOfForeignKey ( column . isPartOfForeignKey ( ) ) ; columnDescriptor . setAutoIncremented ( column . isAutoIncremented ( ) ) ; tableDescriptor . getColumns ( ) . add ( columnDescriptor ) ; localColumns . put ( column . getName ( ) , columnDescriptor ) ; allColumns . put ( column , columnDescriptor ) ; } // Primary key PrimaryKey primaryKey = table . getPrimaryKey ( ) ; if ( primaryKey != null ) { PrimaryKeyDescriptor primaryKeyDescriptor = storeIndex ( primaryKey , tableDescriptor , localColumns , PrimaryKeyDescriptor . class , PrimaryKeyOnColumnDescriptor . class , store ) ; tableDescriptor . setPrimaryKey ( primaryKeyDescriptor ) ; } // Indices for ( Index index : table . getIndices ( ) ) { IndexDescriptor indexDescriptor = storeIndex ( index , tableDescriptor , localColumns , IndexDescriptor . class , IndexOnColumnDescriptor . class , store ) ; tableDescriptor . getIndices ( ) . add ( indexDescriptor ) ; } // Trigger for ( Trigger trigger : table . getTriggers ( ) ) { TriggerDescriptor triggerDescriptor = store . create ( TriggerDescriptor . class ) ; triggerDescriptor . setName ( trigger . getName ( ) ) ; triggerDescriptor . setActionCondition ( trigger . getActionCondition ( ) ) ; triggerDescriptor . setActionOrder ( trigger . getActionOrder ( ) ) ; triggerDescriptor . setActionOrientation ( trigger . getActionOrientation ( ) . name ( ) ) ; triggerDescriptor . setActionStatement ( trigger . getActionStatement ( ) ) ; triggerDescriptor . setConditionTiming ( trigger . getConditionTiming ( ) . name ( ) ) ; triggerDescriptor . setEventManipulationTime ( trigger . getEventManipulationType ( ) . name ( ) ) ; tableDescriptor . getTriggers ( ) . add ( triggerDescriptor ) ; } allForeignKeys . addAll ( table . getForeignKeys ( ) ) ; } }
Create the table descriptors .
732
6
10,833
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 . setNullable ( column . isNullable ( ) ) ; columnDescriptor . setSize ( column . getSize ( ) ) ; columnDescriptor . setDecimalDigits ( column . getDecimalDigits ( ) ) ; ColumnDataType columnDataType = column . getColumnDataType ( ) ; ColumnTypeDescriptor columnTypeDescriptor = getColumnTypeDescriptor ( columnDataType , columnTypes , store ) ; columnDescriptor . setColumnType ( columnTypeDescriptor ) ; return columnDescriptor ; }
Create a column descriptor .
198
5
10,834
private void createForeignKeys ( Set < ForeignKey > allForeignKeys , Map < Column , ColumnDescriptor > allColumns , Store store ) { // Foreign keys for ( ForeignKey foreignKey : allForeignKeys ) { ForeignKeyDescriptor foreignKeyDescriptor = store . create ( ForeignKeyDescriptor . class ) ; foreignKeyDescriptor . setName ( foreignKey . getName ( ) ) ; foreignKeyDescriptor . setDeferrability ( foreignKey . getDeferrability ( ) . name ( ) ) ; foreignKeyDescriptor . setDeleteRule ( foreignKey . getDeleteRule ( ) . name ( ) ) ; foreignKeyDescriptor . setUpdateRule ( foreignKey . getUpdateRule ( ) . name ( ) ) ; for ( ForeignKeyColumnReference columnReference : foreignKey . getColumnReferences ( ) ) { ForeignKeyReferenceDescriptor keyReferenceDescriptor = store . create ( ForeignKeyReferenceDescriptor . class ) ; // foreign key table and column Column foreignKeyColumn = columnReference . getForeignKeyColumn ( ) ; ColumnDescriptor foreignKeyColumnDescriptor = allColumns . get ( foreignKeyColumn ) ; keyReferenceDescriptor . setForeignKeyColumn ( foreignKeyColumnDescriptor ) ; // primary key table and column Column primaryKeyColumn = columnReference . getPrimaryKeyColumn ( ) ; ColumnDescriptor primaryKeyColumnDescriptor = allColumns . get ( primaryKeyColumn ) ; keyReferenceDescriptor . setPrimaryKeyColumn ( primaryKeyColumnDescriptor ) ; foreignKeyDescriptor . getForeignKeyReferences ( ) . add ( keyReferenceDescriptor ) ; } } }
Create the foreign key descriptors .
357
7
10,835
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 ( ) ) { case procedure : routineDescriptor = store . create ( ProcedureDescriptor . class ) ; returnType = ( ( ProcedureReturnType ) routine . getReturnType ( ) ) . name ( ) ; schemaDescriptor . getProcedures ( ) . add ( ( ProcedureDescriptor ) routineDescriptor ) ; break ; case function : routineDescriptor = store . create ( FunctionDescriptor . class ) ; returnType = ( ( FunctionReturnType ) routine . getReturnType ( ) ) . name ( ) ; schemaDescriptor . getFunctions ( ) . add ( ( FunctionDescriptor ) routineDescriptor ) ; break ; case unknown : routineDescriptor = store . create ( RoutineDescriptor . class ) ; returnType = null ; schemaDescriptor . getUnknownRoutines ( ) . add ( routineDescriptor ) ; break ; default : throw new IOException ( "Unsupported routine type " + routine . getRoutineType ( ) ) ; } routineDescriptor . setName ( routine . getName ( ) ) ; routineDescriptor . setReturnType ( returnType ) ; routineDescriptor . setBodyType ( routine . getRoutineBodyType ( ) . name ( ) ) ; routineDescriptor . setDefinition ( routine . getDefinition ( ) ) ; for ( RoutineColumn < ? extends Routine > routineColumn : routine . getColumns ( ) ) { RoutineColumnDescriptor columnDescriptor = createColumnDescriptor ( routineColumn , RoutineColumnDescriptor . class , columnTypes , store ) ; routineDescriptor . getColumns ( ) . add ( columnDescriptor ) ; RoutineColumnType columnType = routineColumn . getColumnType ( ) ; if ( columnType instanceof ProcedureColumnType ) { ProcedureColumnType procedureColumnType = ( ProcedureColumnType ) columnType ; columnDescriptor . setType ( procedureColumnType . name ( ) ) ; } else if ( columnType instanceof FunctionColumnType ) { FunctionColumnType functionColumnType = ( FunctionColumnType ) columnType ; columnDescriptor . setType ( functionColumnType . name ( ) ) ; } else { throw new IOException ( "Unsupported routine column type " + columnType . getClass ( ) . getName ( ) ) ; } } } }
Create routines i . e . functions and procedures .
576
10
10,836
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 . setIncrement ( sequence . getIncrement ( ) ) ; sequenceDesriptor . setMinimumValue ( sequence . getMinimumValue ( ) . longValue ( ) ) ; sequenceDesriptor . setMaximumValue ( sequence . getMaximumValue ( ) . longValue ( ) ) ; sequenceDesriptor . setCycle ( sequence . isCycle ( ) ) ; schemaDescriptor . getSequences ( ) . add ( sequenceDesriptor ) ; } }
Add the sequences of a schema to the schema descriptor .
174
11
10,837
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 . isUpdatable ( ) ) ; CheckOptionType checkOption = view . getCheckOption ( ) ; if ( checkOption != null ) { viewDescriptor . setCheckOption ( checkOption . name ( ) ) ; } schemaDescriptor . getViews ( ) . add ( viewDescriptor ) ; tableDescriptor = viewDescriptor ; } else { tableDescriptor = store . create ( TableDescriptor . class ) ; schemaDescriptor . getTables ( ) . add ( tableDescriptor ) ; } tableDescriptor . setName ( table . getName ( ) ) ; return tableDescriptor ; }
Create a table descriptor for the given table .
226
9
10,838
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 ( index . getName ( ) ) ; indexDescriptor . setUnique ( index . isUnique ( ) ) ; indexDescriptor . setCardinality ( index . getCardinality ( ) ) ; indexDescriptor . setIndexType ( index . getIndexType ( ) . name ( ) ) ; indexDescriptor . setPages ( index . getPages ( ) ) ; for ( IndexColumn indexColumn : index . getColumns ( ) ) { ColumnDescriptor columnDescriptor = columns . get ( indexColumn . getName ( ) ) ; OnColumnDescriptor onColumnDescriptor = store . create ( indexDescriptor , onColumnType , columnDescriptor ) ; onColumnDescriptor . setIndexOrdinalPosition ( indexColumn . getIndexOrdinalPosition ( ) ) ; onColumnDescriptor . setSortSequence ( indexColumn . getSortSequence ( ) . name ( ) ) ; } return indexDescriptor ; }
Stores index data .
291
5
10,839
private ColumnTypeDescriptor getColumnTypeDescriptor ( ColumnDataType columnDataType , Map < String , ColumnTypeDescriptor > columnTypes , Store store ) { String databaseSpecificTypeName = columnDataType . getDatabaseSpecificTypeName ( ) ; ColumnTypeDescriptor columnTypeDescriptor = columnTypes . get ( databaseSpecificTypeName ) ; if ( columnTypeDescriptor == null ) { columnTypeDescriptor = store . find ( ColumnTypeDescriptor . class , databaseSpecificTypeName ) ; if ( columnTypeDescriptor == null ) { columnTypeDescriptor = store . create ( ColumnTypeDescriptor . class ) ; columnTypeDescriptor . setDatabaseType ( databaseSpecificTypeName ) ; columnTypeDescriptor . setAutoIncrementable ( columnDataType . isAutoIncrementable ( ) ) ; columnTypeDescriptor . setCaseSensitive ( columnDataType . isCaseSensitive ( ) ) ; columnTypeDescriptor . setPrecision ( columnDataType . getPrecision ( ) ) ; columnTypeDescriptor . setMinimumScale ( columnDataType . getMinimumScale ( ) ) ; columnTypeDescriptor . setMaximumScale ( columnDataType . getMaximumScale ( ) ) ; columnTypeDescriptor . setFixedPrecisionScale ( columnDataType . isFixedPrecisionScale ( ) ) ; columnTypeDescriptor . setNumericPrecisionRadix ( columnDataType . getNumPrecisionRadix ( ) ) ; columnTypeDescriptor . setUnsigned ( columnDataType . isUnsigned ( ) ) ; columnTypeDescriptor . setUserDefined ( columnDataType . isUserDefined ( ) ) ; columnTypeDescriptor . setNullable ( columnDataType . isNullable ( ) ) ; } columnTypes . put ( databaseSpecificTypeName , columnTypeDescriptor ) ; } return columnTypeDescriptor ; }
Return the column type descriptor for the given data type .
414
11
10,840
public static ProfilePackageSummaryBuilder getInstance ( Context context , PackageDoc pkg , ProfilePackageSummaryWriter profilePackageWriter , Profile profile ) { return new ProfilePackageSummaryBuilder ( context , pkg , profilePackageWriter , profile ) ; }
Construct a new ProfilePackageSummaryBuilder .
49
8
10,841
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 ) ; getPanelAt ( coordinates ) . repaint ( ) ; }
Adds an item to draw in a particular position
95
9
10,842
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 contains a model in the UI already. New position = " + newCoordinates ) ; } if ( ! getPanelAt ( oldCoordinates ) . hasModel ( ) ) { throw new IllegalStateException ( "Old position doesn't contain a model in the UI. Old position = " + oldCoordinates ) ; } // all good Drawable item = getPanelAt ( oldCoordinates ) . getModel ( ) ; removeItem ( oldCoordinates ) ; addItem ( newCoordinates , item ) ; }
Changes the position of the item in the specified location
198
10
10,843
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
72
6
10,844
public void refresh ( Point coordinates ) { assertEDT ( ) ; if ( coordinates == null ) { throw new IllegalArgumentException ( "Coordinates cannot be null" ) ; } getPanelAt ( coordinates ) . repaint ( ) ; }
Repaints the item specified
52
5
10,845
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
64
8
10,846
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
78
10
10,847
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
78
7
10,848
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 ( "class" , OsgiUtil . toString ( reference . getProperty ( Constants . SERVICE_PID ) , "" ) ) ; properties . put ( "description" , OsgiUtil . toString ( reference . getProperty ( Constants . SERVICE_DESCRIPTION ) , "" ) ) ; properties . put ( "vendor" , OsgiUtil . toString ( reference . getProperty ( Constants . SERVICE_VENDOR ) , "" ) ) ; properties . put ( "resourceTypes" , Arrays . toString ( OsgiUtil . toStringArray ( reference . getProperty ( ComponentBindingsProvider . RESOURCE_TYPE_PROP ) , new String [ 0 ] ) ) ) ; properties . put ( "priority" , OsgiUtil . toString ( reference . getProperty ( ComponentBindingsProvider . PRIORITY ) , "" ) ) ; properties . put ( "bundle_id" , String . valueOf ( reference . getBundle ( ) . getBundleId ( ) ) ) ; properties . put ( "bundle_name" , reference . getBundle ( ) . getSymbolicName ( ) ) ; log . debug ( "Loaded properties {}" , properties ) ; return properties ; }
Loads the properties from the specified Service Reference into a map .
349
13
10,849
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 ( templateName ) ; if ( is != null ) { IOUtils . copy ( is , baos ) ; template = baos . toString ( ) ; } else { throw new IOException ( "Unable to load template " + templateName ) ; } } finally { IOUtils . closeQuietly ( is ) ; IOUtils . closeQuietly ( baos ) ; } StrSubstitutor sub = new StrSubstitutor ( properties ) ; res . getWriter ( ) . write ( sub . replace ( 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 .
195
39
10,850
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 .
83
11
10,851
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 .
44
10
10,852
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 .
74
24
10,853
@ Override 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 .
56
10
10,854
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 ; i < lastKeyIndex ; i ++ ) { KeyType storageComponentKey = keys [ i ] ; storageComponent = storageComponent . getStorageComponent ( storageComponentKey ) ; } return storageComponent . get ( keys [ lastKeyIndex ] ) ; } }
Returns value of keys reference .
141
6
10,855
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 lastKeyIndex = keysLength - 1 ; for ( int i = 1 ; i < lastKeyIndex ; i ++ ) { childStorageComponent = childStorageComponent . getStorageComponent ( keys [ i ] ) ; } childStorageComponent . put ( value , keys [ lastKeyIndex ] ) ; } }
Storages the value by keys .
148
8
10,856
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 StorageComponent < KeyType , ValueType > ( ) ; storage . put ( key , storageComponent ) ; } return storageComponent ; }
Returns child StorageComponent by given key .
99
8
10,857
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 , interf ) ; } accessibleClass = accessibleClass . getSuperclass ( ) ; } return added ; }
Associate the element with accessibleClass and any of the the superclass and interfaces of the accessibleClass until baseClass
96
23
10,858
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 = accessibleClass . getSuperclass ( ) ; } }
Remove the element from accessible class and any of the superclass and interfaces of the accessibleClass until baseClass
85
21
10,859
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 new InitializationException ( "Failed to read IBAN country data [2]" ) ; final DateTimeFormatter aDTPattern = DateTimeFormatter . ISO_DATE ; for ( final IMicroElement eCountry : aDoc . getDocumentElement ( ) . getAllChildElements ( ELEMENT_COUNTRY ) ) { // get descriptive string final String sDesc = eCountry . getTextContent ( ) ; final String sCountryCode = sDesc . substring ( 0 , 2 ) ; if ( CountryCache . getInstance ( ) . getCountry ( sCountryCode ) == null ) if ( LOGGER . isWarnEnabled ( ) ) LOGGER . warn ( "IBAN country data: no such country code '" + sCountryCode + "' - be careful" ) ; LocalDate aValidFrom = null ; if ( eCountry . hasAttribute ( ATTR_VALIDFROM ) ) { // Constant format, conforming to XML date aValidFrom = PDTFromString . getLocalDateFromString ( eCountry . getAttributeValue ( ATTR_VALIDFROM ) , aDTPattern ) ; } LocalDate aValidTo = null ; if ( eCountry . hasAttribute ( ATTR_VALIDUNTIL ) ) { // Constant format, conforming to XML date aValidTo = PDTFromString . getLocalDateFromString ( eCountry . getAttributeValue ( ATTR_VALIDUNTIL ) , aDTPattern ) ; } final String sLayout = eCountry . getAttributeValue ( ATTR_LAYOUT ) ; final String sCheckDigits = eCountry . getAttributeValue ( ATTR_CHECKDIGITS ) ; // get expected length final String sLen = eCountry . getAttributeValue ( ATTR_LEN ) ; final int nExpectedLength = StringParser . parseInt ( sLen , CGlobal . ILLEGAL_UINT ) ; if ( nExpectedLength == CGlobal . ILLEGAL_UINT ) throw new InitializationException ( "Failed to convert length '" + sLen + "' to int!" ) ; if ( s_aIBANData . containsKey ( sCountryCode ) ) throw new IllegalArgumentException ( "Country " + sCountryCode + " is already contained!" ) ; s_aIBANData . put ( sCountryCode , IBANCountryData . createFromString ( sCountryCode , nExpectedLength , sLayout , sCheckDigits , aValidFrom , aValidTo , sDesc ) ) ; } }
Read all IBAN country data from a file .
637
10
10,860
@ Nullable public static IBANCountryData getCountryData ( @ Nonnull final String sCountryCode ) { ValueEnforcer . notNull ( sCountryCode , "CountryCode" ) ; return s_aIBANData . get ( sCountryCode . toUpperCase ( Locale . US ) ) ; }
Get the country data for the given country code .
67
10
10,861
@ Nullable public static String unifyIBAN ( @ Nullable final String sIBAN ) { if ( sIBAN == null ) return null ; // to uppercase String sRealIBAN = sIBAN . toUpperCase ( Locale . US ) ; // kick all non-IBAN chars 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 .
121
26
10,862
public static boolean isValidIBAN ( @ Nullable final String sIBAN , final boolean bReturnCodeIfNoCountryData ) { // kick all non-IBAN chars final String sRealIBAN = unifyIBAN ( sIBAN ) ; if ( sRealIBAN == null ) return false ; // is the country supported? final IBANCountryData aData = s_aIBANData . get ( sRealIBAN . substring ( 0 , 2 ) ) ; if ( aData == null ) return bReturnCodeIfNoCountryData ; // Does the length match the expected length? if ( aData . getExpectedLength ( ) != sRealIBAN . length ( ) ) return false ; // Are the checksum characters valid? if ( ! _isValidChecksumChar ( sRealIBAN . charAt ( 2 ) ) || ! _isValidChecksumChar ( sRealIBAN . charAt ( 3 ) ) ) return false ; // Is existing checksum valid? if ( _calculateChecksum ( sRealIBAN ) != 1 ) return false ; // Perform pattern check if ( ! aData . matchesPattern ( sRealIBAN ) ) return false ; return true ; }
Check if the passed IBAN is valid and the country is supported!
260
14
10,863
public void buildContent ( XMLNode node , Content contentTree ) { Content packageContentTree = packageWriter . getContentHeader ( ) ; buildChildren ( node , packageContentTree ) ; contentTree . addContent ( packageContentTree ) ; }
Build the content for the package doc .
50
8
10,864
public JavaFileObject asJavaFileObject ( File file ) { JavacFileManager fm = ( JavacFileManager ) context . get ( JavaFileManager . class ) ; return fm . getRegularFile ( file ) ; }
Construct a JavaFileObject from the given file .
49
10
10,865
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 ) ) notYetEntered . put ( file , unit ) ; } return units ; } finally { parsed = true ; if ( compiler != null && compiler . log != null ) compiler . log . flush ( ) ; } }
Parse the specified files returning a list of abstract syntax trees .
128
13
10,866
public static ClassLoader findMostCompleteClassLoader ( Class < ? > target ) { // Try the most complete class loader we can get ClassLoader classLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; // Then fallback to the class loader from a specific class given if ( classLoader == null && target != null ) { classLoader = target . getClassLoader ( ) ; } // Then fallback to the class loader that loaded this class if ( classLoader == null ) { classLoader = ClassLoaders . class . getClassLoader ( ) ; } // Then fallback to the system class loader if ( classLoader == null ) { classLoader = ClassLoader . getSystemClassLoader ( ) ; } // Throw an exception if no classloader was found at all if ( classLoader == null ) { throw new RuntimeException ( "Unable to find a classloader" ) ; } return classLoader ; }
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 .
192
39
10,867
@ Override 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 .
60
8
10,868
@ Override 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 + ": " + Throwables . getFullMessage ( throwable ) ) ) ; return throwable ; }
Emits an alert for a caught Throwable through this manageable .
103
13
10,869
@ Override 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 .
40
17
10,870
@ Override 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 .
80
22
10,871
public ArrayList < SchemaField > getSchema ( ) { final ArrayList < SchemaField > items = new ArrayList < SchemaField > ( schemaFields . values ( ) ) ; Collections . sort ( items , new Comparator < SchemaField > ( ) { @ Override public int compare ( final SchemaField left , final SchemaField right ) { return left . getId ( ) - right . getId ( ) ; } } ) ; return items ; }
Get the schema as a collection of fields . We guarantee the ordering by field id .
102
17
10,872
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 .
41
16
10,873
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
59
11
10,874
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 .
40
47
10,875
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 .
40
47
10,876
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 .
35
11
10,877
@ Override 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 .
41
14
10,878
@ Override 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 ( ) , getPigType ( field . getType ( ) ) ) ) ; } return new ResourceSchema ( new Schema ( schemaList ) ) ; }
Get a schema for the data to be loaded .
121
10
10,879
public static String getUserApplicationConfigurationFilePath ( @ NonNull final String applicationName , @ NonNull final String configFileName ) { return System . getProperty ( USER_HOME_PROPERTY_KEY ) + File . separator + applicationName + File . separator + configFileName ; }
Gets the user application configuration file path .
64
9
10,880
public static String getTemporaryApplicationConfigurationFilePath ( @ NonNull final String applicationName , @ NonNull 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
68
22
10,881
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 .
72
14
10,882
public static < T > T instantiateClass ( final Class < T > clazz , final Class < ? > [ ] parameterTypes , final Object [ ] parameterValues ) throws BeanInstantiationException { if ( clazz . isInterface ( ) ) { throw new BeanInstantiationException ( clazz , CLASS_IS_INTERFACE ) ; } try { Constructor < T > constructor = clazz . getConstructor ( parameterTypes ) ; T newInstance = constructor . newInstance ( parameterValues ) ; return newInstance ; } catch ( Exception e ) { throw new BeanInstantiationException ( clazz , NO_DEFAULT_CONSTRUCTOR_FOUND , e ) ; } }
Create and initialize a new instance of the given class by given parameterTypes and parameterValues .
142
18
10,883
public static boolean isDataObject ( final Object object ) { if ( object == null ) { return true ; } Class < ? > clazz = object . getClass ( ) ; return isDataClass ( clazz ) ; }
Returns true if the given object class is 8 primitive class or their wrapper class or String class or null .
47
21
10,884
public static boolean isDataClass ( final Class < ? > clazz ) { if ( clazz == null || clazz . isPrimitive ( ) ) { return true ; } boolean isWrapperClass = contains ( WRAPPER_CLASSES , clazz ) ; if ( isWrapperClass ) { return true ; } boolean isDataClass = contains ( DATA_PRIMITIVE_CLASS , clazz ) ; if ( isDataClass ) { return true ; } return false ; }
Returns true if the given class is 8 primitive class or their wrapper class or String class or null .
103
20
10,885
public static String stringFor ( int m ) { switch ( m ) { case CUFFT_R2C : return "CUFFT_R2C" ; case CUFFT_C2R : return "CUFFT_C2R" ; case CUFFT_C2C : return "CUFFT_C2C" ; case CUFFT_D2Z : return "CUFFT_D2Z" ; case CUFFT_Z2D : return "CUFFT_Z2D" ; case CUFFT_Z2Z : return "CUFFT_Z2Z" ; } return "INVALID cufftType: " + m ; }
Returns the String identifying the given cufftType
150
9
10,886
@ Override public void setContract ( Contract c ) { super . setContract ( c ) ; for ( Field f : fields . values ( ) ) { f . setContract ( c ) ; } }
Sets the Contract associated with this Struct . Propagates to Fields .
42
15
10,887
public Map < String , Field > getFieldsPlusParents ( ) { Map < String , Field > tmp = new HashMap < String , Field > ( ) ; tmp . putAll ( fields ) ; if ( extend != null && ! extend . equals ( "" ) ) { Struct parent = contract . getStructs ( ) . get ( extend ) ; tmp . putAll ( parent . getFieldsPlusParents ( ) ) ; } return tmp ; }
Returns a Map of the Fields belonging to this Struct and all its ancestors . Keys are the Field names .
94
21
10,888
public List < String > getFieldNamesPlusParents ( ) { List < String > tmp = new ArrayList < String > ( ) ; tmp . addAll ( getFieldNames ( ) ) ; if ( extend != null && ! extend . equals ( "" ) ) { Struct parent = contract . getStructs ( ) . get ( extend ) ; tmp . addAll ( parent . getFieldNamesPlusParents ( ) ) ; } return tmp ; }
Returns a List of the Field names belonging to this Struct and all its ancestors .
92
16
10,889
public void add ( Collection < MobileApplication > mobileApplications ) { for ( MobileApplication mobileApplication : mobileApplications ) this . mobileApplications . put ( mobileApplication . getId ( ) , mobileApplication ) ; }
Adds the mobile application list to the mobile applications for the account .
43
13
10,890
private FileSystem getFileSystemSafe ( ) throws IOException { try { fs . getFileStatus ( new Path ( "/" ) ) ; return fs ; } catch ( NullPointerException e ) { throw new IOException ( "file system not initialized" ) ; } }
throws an IOException if the current FileSystem isn t working
57
13
10,891
@ Nonnull public ETriState isValidPostalCode ( @ Nullable final Locale aCountry , @ Nullable final String sPostalCode ) { final IPostalCodeCountry aPostalCountry = getPostalCountryOfCountry ( aCountry ) ; if ( aPostalCountry == null ) return ETriState . UNDEFINED ; return ETriState . valueOf ( aPostalCountry . isValidPostalCode ( sPostalCode ) ) ; }
Check if the passed postal code is valid for the passed country .
101
13
10,892
public boolean isValidPostalCodeDefaultYes ( @ Nullable final Locale aCountry , @ Nullable final String sPostalCode ) { return isValidPostalCode ( aCountry , sPostalCode ) . getAsBooleanValue ( true ) ; }
Check if the passed postal code is valid for the passed country . If no information for that specific country is defined the postal code is assumed valid!
56
29
10,893
public boolean isValidPostalCodeDefaultNo ( @ Nullable final Locale aCountry , @ Nullable final String sPostalCode ) { return isValidPostalCode ( aCountry , sPostalCode ) . getAsBooleanValue ( false ) ; }
Check if the passed postal code is valid for the passed country . If no information for that specific country is defined the postal code is assumed invalid!
56
29
10,894
@ Nullable @ ReturnsMutableCopy public ICommonsList < String > getPostalCodeExamples ( @ Nullable final Locale aCountry ) { final IPostalCodeCountry aPostalCountry = getPostalCountryOfCountry ( aCountry ) ; return aPostalCountry == null ? null : aPostalCountry . getAllExamples ( ) ; }
Get a list of possible postal code examples for the passed country .
76
13
10,895
@ Override public ServiceRegistration < ? > registerService ( String clazz , Object service , Dictionary < String , ? > properties ) { MockServiceReference < Object > serviceReference = new MockServiceReference < Object > ( getBundle ( ) , properties ) ; if ( serviceRegistrations . get ( clazz ) == null ) { serviceRegistrations . put ( clazz , new ArrayList < ServiceReference < ? > > ( ) ) ; } serviceRegistrations . get ( clazz ) . add ( serviceReference ) ; serviceImplementations . put ( serviceReference , service ) ; notifyListenersAboutNewService ( clazz , serviceReference ) ; return new MockServiceRegistration < Object > ( this , serviceReference ) ; }
Register a service with the bundle context .
155
8
10,896
@ Override public void addServiceListener ( ServiceListener listener , String filter ) throws InvalidSyntaxException { if ( null == filteredServiceListeners . get ( filter ) ) { filteredServiceListeners . put ( filter , new ArrayList < ServiceListener > ( 1 ) ) ; } filteredServiceListeners . get ( filter ) . add ( listener ) ; }
Register a listener for a service using a filter expression .
75
11
10,897
@ Override public void removeServiceListener ( ServiceListener listener ) { // Note: if unfiltered service listeners are implemented // This method needs to look for, and remove, the listener there // as well // Go through all of the filters, and for each filter // remove the listener from the filter's list. for ( Entry < String , List < ServiceListener > > filteredList : filteredServiceListeners . entrySet ( ) ) { filteredList . getValue ( ) . remove ( listener ) ; } }
Remove a listener object
105
4
10,898
@ Nonnull public String [ ] getLoggerList ( ) { try { Enumeration < Logger > currentLoggers = LogManager . getLoggerRepository ( ) . getCurrentLoggers ( ) ; List < String > loggerNames = new ArrayList < String > ( ) ; while ( currentLoggers . hasMoreElements ( ) ) { loggerNames . add ( currentLoggers . nextElement ( ) . getName ( ) ) ; } return loggerNames . toArray ( new String [ 0 ] ) ; } catch ( RuntimeException e ) { logger . warn ( "Exception getting logger names" , e ) ; throw e ; } }
Returns the list of active loggers .
137
8
10,899
private void checkHead ( Token token , Optional < Integer > optHead ) { if ( optHead . isPresent ( ) ) { int head = optHead . get ( ) ; Preconditions . checkArgument ( head >= 0 && head <= tokens . size ( ) , String . format ( "Head should refer to token or 0: %s" , token ) ) ; } }
Check that the head is connected .
80
7