idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
10,700
public ComponentFactory < T , E > toConfigure ( BiConsumer < Context , Annotation > consumer ) { return new ComponentFactory < > ( this . annotationType , this . classElement , consumer , this . createFunction ) ; }
Adds more rules to the context by passing a consumer that will be invoked before creating the component .
10,701
public List < E > createAll ( AnnotatedElement element ) { List < E > result = new ArrayList < > ( ) ; for ( Annotation annotation : element . getAnnotations ( ) ) { create ( annotation ) . ifPresent ( result :: add ) ; } return result ; }
Creates a list of components based on the annotations of the given element .
10,702
public static String getVersion ( ) { String version = null ; try { Properties p = new Properties ( ) ; InputStream is = VersionHelper . class . getResourceAsStream ( "/META-INF/maven/io.redlink/redlink-sdk-java/pom.properties" ) ; if ( is != null ) { p . load ( is ) ; version = p . getProperty ( "version" , "" ) ; } }...
Get artifact current version
10,703
protected static String formatApiVersion ( String version ) { if ( StringUtils . isBlank ( version ) ) { return VERSION ; } else { final Matcher matcher = VERSION_PATTERN . matcher ( version ) ; if ( matcher . matches ( ) ) { return String . format ( "%s.%s" , matcher . group ( 1 ) , matcher . group ( 2 ) ) ; } else { ...
Build a proper api version
10,704
public int numSheets ( ) { int ret = - 1 ; if ( workbook != null ) ret = workbook . getNumberOfSheets ( ) ; else if ( writableWorkbook != null ) ret = writableWorkbook . getNumberOfSheets ( ) ; return ret ; }
Returns the number of worksheets in the given workbook .
10,705
public String [ ] getSheetNames ( ) { String [ ] ret = null ; if ( workbook != null ) ret = workbook . getSheetNames ( ) ; else if ( writableWorkbook != null ) ret = writableWorkbook . getSheetNames ( ) ; return ret ; }
Returns the list of worksheet names from the given Excel XLS file .
10,706
public XlsWorksheet getSheet ( String name ) { XlsWorksheet ret = null ; if ( workbook != null ) { Sheet sheet = workbook . getSheet ( name ) ; if ( sheet != null ) ret = new XlsWorksheet ( sheet ) ; } else if ( writableWorkbook != null ) { Sheet sheet = writableWorkbook . getSheet ( name ) ; if ( sheet != null ) ret =...
Returns the worksheet with the given name in the workbook .
10,707
public XlsWorksheet createSheet ( FileColumn [ ] columns , List < String [ ] > lines , String sheetName ) throws IOException { WritableSheet sheet = writableWorkbook . createSheet ( sheetName , 9999 ) ; try { appendRows ( sheet , columns , lines , sheetName ) ; } catch ( WriteException e ) { throw new IOException ( e )...
Creates a sheet in the workbook with the given name and lines of data .
10,708
public void appendToSheet ( FileColumn [ ] columns , List < String [ ] > lines , String sheetName ) throws IOException { try { XlsWorksheet sheet = getSheet ( sheetName ) ; if ( sheet != null ) appendRows ( ( WritableSheet ) sheet . getSheet ( ) , columns , lines , sheetName ) ; } catch ( WriteException e ) { throw new...
Adds the given lines of data to an existing sheet in the workbook .
10,709
private void appendRows ( WritableSheet sheet , FileColumn [ ] columns , List < String [ ] > lines , String sheetName ) throws WriteException { WritableFont headerFont = new WritableFont ( WritableFont . ARIAL , 10 , WritableFont . BOLD ) ; WritableCellFormat headerFormat = new WritableCellFormat ( headerFont ) ; Writa...
Appends the given lines to the bottom of the given sheet .
10,710
public void setCellFormatAttributes ( WritableCellFormat cellFormat , FileColumn column ) { try { if ( cellFormat != null && column != null ) { Alignment a = Alignment . GENERAL ; short align = column . getAlign ( ) ; if ( align == FileColumn . ALIGN_CENTRE ) a = Alignment . CENTRE ; else if ( align == FileColumn . ALI...
Sets the cell attributes from the given column .
10,711
public void close ( ) { if ( workbook != null ) workbook . close ( ) ; try { if ( writableWorkbook != null ) writableWorkbook . close ( ) ; } catch ( IOException e ) { } catch ( WriteException e ) { } }
Close the workbook .
10,712
public static List < Range < Date > > getDateRanges ( Date from , Date to , final Period periodGranulation ) throws InvalidRangeException { if ( from . after ( to ) ) { throw buildInvalidRangeException ( from , to ) ; } if ( periodGranulation == Period . SINGLE ) { @ SuppressWarnings ( "unchecked" ) ArrayList < Range <...
Returns Range&lt ; Date&gt ; list between given date from and date to by period granulation .
10,713
public static Range < Date > getDatePeriod ( final Date date , final Period period ) { Calendar calendar = buildCalendar ( date ) ; Range < Date > dateRange = null ; Date startDate = calendar . getTime ( ) ; Date endDate = calendar . getTime ( ) ; if ( period != Period . DAY ) { for ( ; period . getValue ( date ) == pe...
Return Range&lt ; Date&gt ; by given date and period .
10,714
private static Calendar buildCalendar ( final Date date ) { Calendar calendar = buildCalendar ( ) ; calendar . setTime ( date ) ; return calendar ; }
Gets a calendar using the default time zone and locale . The Calendar returned is based on the given time in the default time zone with the default locale .
10,715
public synchronized void execute ( Runnable command ) { if ( active . get ( ) ) { stop ( ) ; this . command = command ; start ( ) ; } else { this . command = command ; } }
Executes the specified command continuously if the executor is started .
10,716
public boolean startsWith ( Name prefix ) { byte [ ] thisBytes = this . getByteArray ( ) ; int thisOffset = this . getByteOffset ( ) ; int thisLength = this . getByteLength ( ) ; byte [ ] prefixBytes = prefix . getByteArray ( ) ; int prefixOffset = prefix . getByteOffset ( ) ; int prefixLength = prefix . getByteLength ...
Does this name start with prefix?
10,717
public DocumentTemplate createBlob ( final DocumentType type , final LocalDate date , final String atPath , final String fileSuffix , final boolean previewOnly , final Blob blob , final RenderingStrategy contentRenderingStrategy , final String subjectText , final RenderingStrategy subjectRenderingStrategy ) { final Doc...
region > createBlob createClob createText
10,718
public List < DocumentTemplate > findByType ( final DocumentType documentType ) { return repositoryService . allMatches ( new QueryDefault < > ( DocumentTemplate . class , "findByType" , "type" , documentType ) ) ; }
Returns all templates for a type ordered by application tenancy and date desc .
10,719
public List < DocumentTemplate > findByApplicableToAtPathAndCurrent ( final String atPath ) { final LocalDate now = clockService . now ( ) ; return repositoryService . allMatches ( new QueryDefault < > ( DocumentTemplate . class , "findByApplicableToAtPathAndCurrent" , "atPath" , atPath , "now" , now ) ) ; }
Returns all templates available for a particular application tenancy ordered by most specific tenancy first and then within that the most recent first .
10,720
public TranslatableString validateApplicationTenancyAndDate ( final DocumentType proposedType , final String proposedAtPath , final LocalDate proposedDate , final DocumentTemplate ignore ) { final List < DocumentTemplate > existingTemplates = findByTypeAndAtPath ( proposedType , proposedAtPath ) ; for ( DocumentTemplat...
region > validate ...
10,721
public synchronized int numActiveSubTasks ( ) { int c = 0 ; for ( Future < ? > f : subTasks ) { if ( ! f . isDone ( ) && ! f . isCancelled ( ) ) { c ++ ; } } return c ; }
Count the number of active sub tasks .
10,722
public synchronized void use ( ) { assert ( ! inUse ) ; inUse = true ; compiler = com . sun . tools . javac . api . JavacTool . create ( ) ; fileManager = compiler . getStandardFileManager ( null , null , null ) ; fileManagerBase = ( BaseFileManager ) fileManager ; smartFileManager = new SmartFileManager ( fileManager ...
Prepare the compiler thread for use . It is not yet started . It will be started by the executor service .
10,723
public synchronized void unuse ( ) { assert ( inUse ) ; inUse = false ; compiler = null ; fileManager = null ; fileManagerBase = null ; smartFileManager = null ; context = null ; subTasks = null ; }
Prepare the compiler thread for idleness .
10,724
private static boolean expect ( BufferedReader in , String key ) throws IOException { String s = in . readLine ( ) ; if ( s != null && s . equals ( key ) ) { return true ; } return false ; }
Expect this key on the next line read from the reader .
10,725
public ParametricStatement set ( String sql ) throws IllegalArgumentException { if ( _env != null ) { try { sql = Macro . expand ( sql , _env . call ( ) ) ; } catch ( Exception x ) { throw new IllegalArgumentException ( x . getMessage ( ) , x ) ; } } if ( _params != null ) { int count = 0 ; int qmark = sql . indexOf ( ...
Assigns a SQL string to this ParametricStatement .
10,726
public int executeUpdate ( Connection conn , DataObject object ) throws SQLException { PreparedStatement statement = conn . prepareStatement ( _sql ) ; try { load ( statement , object ) ; return statement . executeUpdate ( ) ; } finally { statement . close ( ) ; } }
Executes an UPDATE or DELETE statement .
10,727
public int executeUpdate ( Connection conn , DataObject [ ] objects ) throws SQLException { PreparedStatement statement = conn . prepareStatement ( _sql ) ; try { for ( DataObject object : objects ) { load ( statement , object ) ; statement . addBatch ( ) ; } int count = getAffectedRowCount ( statement . executeBatch (...
Executes a batch UPDATE or DELETE statement .
10,728
public long [ ] executeInsert ( Connection conn , DataObject object , boolean generatedKeys ) throws SQLException { PreparedStatement statement = conn . prepareStatement ( _sql , generatedKeys ? Statement . RETURN_GENERATED_KEYS : Statement . NO_GENERATED_KEYS ) ; try { load ( statement , object ) ; long [ ] keys = new...
Executes an INSERT statement .
10,729
public int executeProcedure ( Connection conn , DataObject object ) throws SQLException { CallableStatement statement = conn . prepareCall ( _sql ) ; try { for ( int i = 0 ; i < _params . length ; ++ i ) { if ( ( _params [ i ] . direction & Param . OUT ) == 0 ) continue ; statement . registerOutParameter ( i + 1 , _par...
Executes a callable statement that performs updates .
10,730
public void add ( T closeable , Future < ? > future ) { _pairs . add ( new Pair < T , Future < ? > > ( closeable , future ) ) ; }
Adds an AutoCloseable task and associated Future to this group .
10,731
public boolean isDone ( ) { int count = 0 ; for ( Pair < T , Future < ? > > pair : _pairs ) { if ( pair . second . isDone ( ) ) ++ count ; } return count == _pairs . size ( ) ; }
Reports whether all futures in this group has completed .
10,732
public void close ( ) { int count = 0 , last = 0 ; do { last = count ; try { Thread . sleep ( 500 ) ; } catch ( Exception x ) { } count = 0 ; for ( Pair < T , Future < ? > > pair : _pairs ) { if ( pair . second . isDone ( ) ) ++ count ; } } while ( ( _waiting == null || _waiting . invoke ( count , count - last ) ) && c...
Closes all Futures . Waits for futures to complete then closes those still running after the waiting phase has ended .
10,733
public static Contract load ( File idlJson ) throws IOException { FileInputStream fis = new FileInputStream ( idlJson ) ; Contract c = load ( fis ) ; fis . close ( ) ; return c ; }
Loads the IDL JSON file parses it and returns a Contract . Uses the JacksonSerializer .
10,734
@ SuppressWarnings ( "unchecked" ) public static Contract load ( InputStream idlJson , Serializer ser ) throws IOException { return new Contract ( ser . readList ( idlJson ) ) ; }
Loads the IDL from the given stream using an arbitrary serializer and returns a Contract .
10,735
public Function getFunction ( String iface , String func ) throws RpcException { Interface i = interfaces . get ( iface ) ; if ( i == null ) { String msg = "Interface '" + iface + "' not found" ; throw RpcException . Error . METHOD_NOT_FOUND . exc ( msg ) ; } Function f = i . getFunction ( func ) ; if ( f == null ) { S...
Returns the Function associated with the given interface and function name .
10,736
private String getName ( String s1 , String s2 ) { if ( s1 == null || "" . equals ( s1 ) ) return s2 ; else return s1 ; }
If the first String parameter is nonempty return it else return the second string parameter .
10,737
private void write ( String s ) throws SAXException { try { out . write ( s ) ; out . flush ( ) ; } catch ( IOException ioException ) { throw new SAXParseException ( "I/O error" , documentLocator , ioException ) ; } }
suit handler signature requirements
10,738
void printSaxException ( String message , SAXException e ) { System . err . println ( ) ; System . err . println ( "*** SAX Exception -- " + message ) ; System . err . println ( " SystemId = \"" + documentLocator . getSystemId ( ) + "\"" ) ; e . printStackTrace ( System . err ) ; }
Utility method to print information about a SAXException .
10,739
void printSaxParseException ( String message , SAXParseException e ) { System . err . println ( ) ; System . err . println ( "*** SAX Parse Exception -- " + message ) ; System . err . println ( " SystemId = \"" + e . getSystemId ( ) + "\"" ) ; System . err . println ( " PublicId = \"" + e . getPublicId ( ) + ...
Utility method to print information about a SAXParseException .
10,740
public void call ( final T request , final Functor < String , RemoteService . Response > process , final Functor < Void , RemoteService . Response > confirm ) { try { String message = process . invoke ( RemoteService . call ( location , endpoint , true , request ) ) ; if ( message != null ) { throw new RuntimeException...
Starts a critical call and automatically manages uncertain outcomes .
10,741
public void execute ( ) throws MojoExecutionException , MojoFailureException { if ( preverifyPath == null ) { getLog ( ) . debug ( "skip native preverification" ) ; return ; } getLog ( ) . debug ( "start native preverification" ) ; final File preverifyCmd = getAbsolutePreverifyCommand ( ) ; StreamConsumer stdoutLogger ...
The main method of this MoJo
10,742
public static boolean isDisplayable ( Class < ? > type ) { return Enum . class . isAssignableFrom ( type ) || type == java . net . URL . class || type == java . io . File . class || java . math . BigInteger . class . isAssignableFrom ( type ) || java . math . BigDecimal . class . isAssignableFrom ( type ) || java . uti...
Tests whether a non - primitive type is directly displayable .
10,743
public static Class < ? > classForName ( String name ) throws ClassNotFoundException { if ( "void" . equals ( name ) ) return void . class ; if ( "char" . equals ( name ) ) return char . class ; if ( "boolean" . equals ( name ) ) return boolean . class ; if ( "byte" . equals ( name ) ) return byte . class ; if ( "short...
Class lookup by name which also accepts primitive type names .
10,744
public static Class < ? > toPrimitive ( Class < ? > type ) { if ( type . isPrimitive ( ) ) { return type ; } else if ( type == Boolean . class ) { return Boolean . TYPE ; } else if ( type == Character . class ) { return Character . TYPE ; } else if ( type == Byte . class ) { return Byte . TYPE ; } else if ( type == Sho...
Converts a boxed type to its primitive counterpart .
10,745
public static Class < ? > [ ] boxPrimitives ( Class < ? > [ ] types ) { for ( int i = 0 ; i < types . length ; ++ i ) { types [ i ] = boxPrimitive ( types [ i ] ) ; } return types ; }
Boxes primitive types .
10,746
public static Field getKnownField ( Class < ? > type , String name ) throws NoSuchFieldException { NoSuchFieldException last = null ; do { try { Field field = type . getDeclaredField ( name ) ; field . setAccessible ( true ) ; return field ; } catch ( NoSuchFieldException x ) { last = x ; type = type . getSuperclass ( ...
Returns a known field by name from the given class disregarding its access control setting looking through all super classes if needed .
10,747
public static < T extends AccessibleObject > T accessible ( T object ) throws SecurityException { object . setAccessible ( true ) ; return object ; }
Overrides access control of an AccessibleObject facilitating fluent coding style .
10,748
@ SuppressWarnings ( "unchecked" ) public static void setValue ( Object object , Field field , Object value ) throws IllegalArgumentException , IllegalAccessException { if ( value == null ) { return ; } try { field . setAccessible ( true ) ; field . set ( object , value ) ; } catch ( IllegalArgumentException x ) { if (...
Assigns a value to the field in an object converting value type as necessary .
10,749
public static < T > T fill ( T destination , Object source ) { if ( destination != source ) { Class < ? > stype = source . getClass ( ) ; for ( Field field : destination . getClass ( ) . getFields ( ) ) { try { Object value = field . get ( destination ) ; if ( value == null ) { field . set ( destination , stype . getFi...
Fills empty identically named public fields with values from another object .
10,750
public static < T , V > T update ( T object , Class < V > type , String pattern , Bifunctor < V , String , V > updater ) { if ( type . isPrimitive ( ) ) { throw new IllegalArgumentException ( "Primitive type must be boxed" ) ; } Pattern regex = pattern != null ? Pattern . compile ( pattern ) : null ; for ( Field field ...
Updates an object by modifying all of its public fields that match a certain name pattern or a super type with a transforming function .
10,751
public static StringBuilder print ( StringBuilder sb , Object bean , int level ) throws IntrospectionException { return print ( sb , Collections . newSetFromMap ( new IdentityHashMap < Object , Boolean > ( ) ) , bean , level ) ; }
Prints a bean to the StringBuilder .
10,752
public static < E > E get ( Class < E > type ) { ServiceLoader < E > loader = ServiceLoader . load ( type ) ; Iterator < E > iterator = loader . iterator ( ) ; if ( iterator . hasNext ( ) ) { return iterator . next ( ) ; } try { return ( E ) Class . forName ( getDefaultImplementationName ( type ) ) . newInstance ( ) ; ...
Returns the implementation for a given class .
10,753
public static IMutablePriceGraduation createSimple ( final IMutablePrice aPrice ) { final PriceGraduation ret = new PriceGraduation ( aPrice . getCurrency ( ) ) ; ret . addItem ( new PriceGraduationItem ( 1 , aPrice . getNetAmount ( ) . getValue ( ) ) ) ; return ret ; }
Create a simple price graduation that contains one item with the minimum quantity of 1 .
10,754
public void contextInitialized ( ServletContextEvent event ) { super . contextInitialized ( event ) ; _dict . addTypeSet ( org . xillium . data . validation . StandardDataTypes . class ) ; _packaged = _context . getResourcePaths ( "/WEB-INF/lib/" ) ; _extended = discover ( System . getProperty ( "xillium.service.Extens...
Tries to load an XML web application contenxt upon servlet context initialization . If a PlatformControl is detected in the web application contenxt registers it with the platform MBean server and stop . Otherwise continues to load all module contexts in the application .
10,755
public void realize ( ApplicationContext wac , ConfigurableApplicationContext child ) { if ( WebApplicationContextUtils . getWebApplicationContext ( _context ) == null ) { _context . setAttribute ( WebApplicationContext . ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE , wac ) ; } else { _logger . warning ( "Already realized" )...
Reloads the platform with the given application context at its root .
10,756
public void destroy ( ) { XmlWebApplicationContext wac = ( XmlWebApplicationContext ) WebApplicationContextUtils . getWebApplicationContext ( _context ) ; if ( wac != null ) { _context . removeAttribute ( WebApplicationContext . ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE ) ; } else { _logger . warning ( "Nothing more to de...
Unloads the platform .
10,757
private ApplicationContext install ( ApplicationContext wac , ModuleSorter . Sorted sorted , ServiceModuleInfo info ) { wac = install ( wac , sorted . specials ( ) , info , true ) ; install ( wac , sorted . regulars ( ) , info , false ) ; if ( info . plcas . size ( ) > 0 ) { _logger . info ( "configure PlatformAware ob...
install service modules in the ModuleSorter . Sorted
10,758
public < T , F > T doReadOnly ( F facility , Task < T , F > task ) { return doTransaction ( facility , task , _readonly ) ; }
Executes a task within a read - only transaction . Any exception rolls back the transaction and gets rethrown as a RuntimeException .
10,759
public < T , F > T doReadWrite ( F facility , Task < T , F > task ) { return doTransaction ( facility , task , null ) ; }
Executes a task within a read - write transaction . Any exception rolls back the transaction and gets rethrown as a RuntimeException .
10,760
public ParametricStatement getParametricStatement ( String name ) { ParametricStatement statement = _statements . get ( name ) ; if ( statement != null ) { return statement ; } else { throw new RuntimeException ( "ParametricStatement '" + name + "' not found" ) ; } }
Looks up a ParametricStatement by its name .
10,761
public < T > T executeSelect ( String name , DataObject object , ResultSetWorker < T > worker ) throws Exception { ParametricQuery statement = ( ParametricQuery ) _statements . get ( name ) ; if ( statement != null ) { return statement . executeSelect ( DataSourceUtils . getConnection ( _dataSource ) , object , worker ...
Executes a SELECT statement and passes the result set to the ResultSetWorker .
10,762
public < T extends DataObject > List < T > getResults ( String name , DataObject object ) throws Exception { @ SuppressWarnings ( "unchecked" ) ObjectMappedQuery < T > statement = ( ObjectMappedQuery < T > ) _statements . get ( name ) ; if ( statement != null ) { return statement . getResults ( DataSourceUtils . getCon...
Executes a SELECT statement and returns the result set as a list of objects
10,763
public int compile ( ) throws SQLException { int count = 0 ; for ( Map . Entry < String , ParametricStatement > entry : _statements . entrySet ( ) ) { try { ParametricStatement statement = entry . getValue ( ) ; Connection connection = DataSourceUtils . getConnection ( _dataSource ) ; if ( statement instanceof Parametr...
Compile all ParametricStatement registered with this Persistence .
10,764
public void addPackageDeprecationInfo ( Content li , PackageDoc pkg ) { Tag [ ] deprs ; if ( Util . isDeprecated ( pkg ) ) { deprs = pkg . tags ( "deprecated" ) ; HtmlTree deprDiv = new HtmlTree ( HtmlTag . DIV ) ; deprDiv . addStyle ( HtmlStyle . deprecatedContent ) ; Content deprPhrase = HtmlTree . SPAN ( HtmlStyle ....
Add the profile package deprecation information to the documentation tree .
10,765
public Content getNavLinkPrevious ( ) { Content li ; if ( prevProfile == null ) { li = HtmlTree . LI ( prevprofileLabel ) ; } else { li = HtmlTree . LI ( getHyperLink ( pathToRoot . resolve ( DocPaths . profileSummary ( prevProfile . name ) ) , prevprofileLabel , "" , "" ) ) ; } return li ; }
Get PREV PROFILE link in the navigation bar .
10,766
public Content getNavLinkNext ( ) { Content li ; if ( nextProfile == null ) { li = HtmlTree . LI ( nextprofileLabel ) ; } else { li = HtmlTree . LI ( getHyperLink ( pathToRoot . resolve ( DocPaths . profileSummary ( nextProfile . name ) ) , nextprofileLabel , "" , "" ) ) ; } return li ; }
Get NEXT PROFILE link in the navigation bar .
10,767
public ProgramElementDoc owner ( ) { Symbol osym = type . tsym . owner ; if ( ( osym . kind & Kinds . TYP ) != 0 ) { return env . getClassDoc ( ( ClassSymbol ) osym ) ; } Names names = osym . name . table . names ; if ( osym . name == names . init ) { return env . getConstructorDoc ( ( MethodSymbol ) osym ) ; } else { ...
Return the class interface method or constructor within which this type variable is declared .
10,768
protected void activate ( final ComponentContext context ) throws InvalidSyntaxException { log . info ( "activate" ) ; bundleContext = context . getBundleContext ( ) ; sl = new ServiceListener ( ) { public void serviceChanged ( ServiceEvent event ) { if ( event . getType ( ) == ServiceEvent . UNREGISTERING ) { cache . ...
Executed when the service is activated .
10,769
protected void deactivate ( ComponentContext context ) { log . info ( "deactivate" ) ; bundleContext = context . getBundleContext ( ) ; bundleContext . removeServiceListener ( sl ) ; log . info ( "Deactivate successful" ) ; }
Executed when the service is deactivated .
10,770
protected void reloadCache ( ) { log . info ( "reloadCache" ) ; cache . clear ( ) ; try { ServiceReference [ ] references = bundleContext . getAllServiceReferences ( ComponentBindingsProvider . class . getCanonicalName ( ) , null ) ; if ( references != null ) { for ( ServiceReference reference : references ) { cache . ...
Reloads the cache of Component Binding Providers
10,771
private boolean htmlSentenceTerminatorFound ( String str , int index ) { for ( int i = 0 ; i < sentenceTerminators . length ; i ++ ) { String terminator = sentenceTerminators [ i ] ; if ( str . regionMatches ( true , index , terminator , 0 , terminator . length ( ) ) ) { return true ; } } return false ; }
Find out if there is any HTML tag in the given string . If found return true else return false .
10,772
public TypeMirror getOriginalType ( javax . lang . model . type . ErrorType errorType ) { if ( errorType instanceof com . sun . tools . javac . code . Type . ErrorType ) { return ( ( com . sun . tools . javac . code . Type . ErrorType ) errorType ) . getOriginalType ( ) ; } return com . sun . tools . javac . code . Typ...
Gets the original type from the ErrorType object .
10,773
private static MimeBodyPart createBodyPart ( byte [ ] data , String type , String filename ) throws MessagingException { final MimeBodyPart attachmentPart = new MimeBodyPart ( ) ; attachmentPart . setFileName ( filename ) ; ByteArrayDataSource source = new ByteArrayDataSource ( data , type ) ; attachmentPart . setDataH...
Build attachment part
10,774
public T getObject ( Connection conn , DataObject object ) throws Exception { return executeSelect ( conn , object , new ResultSetMapper < SingleObjectCollector < T > > ( new SingleObjectCollector < T > ( ) ) ) . value ; }
Executes the query and returns the first row of the results as a single object .
10,775
public Collector < T > getResults ( Connection conn , DataObject object , Collector < T > collector ) throws Exception { return executeSelect ( conn , object , new ResultSetMapper < Collector < T > > ( collector ) ) ; }
Executes the query and passes the results to a Collector .
10,776
public static void preRegister ( Context context ) { context . put ( FSInfo . class , new Context . Factory < FSInfo > ( ) { public FSInfo make ( Context c ) { FSInfo instance = new CacheFSInfo ( ) ; c . put ( FSInfo . class , instance ) ; return instance ; } } ) ; }
Register a Context . Factory to create a CacheFSInfo .
10,777
public MediaType getContentType ( ) { if ( isNull ( this . contentType ) ) { contentType = getHeader ( HeaderName . CONTENT_TYPE ) . map ( MediaType :: of ) . orElse ( WILDCARD ) ; } return contentType ; }
Returns a content - type header value
10,778
public List < MediaType > getAccept ( ) { if ( isNull ( accept ) ) { List < MediaType > accepts = getHeader ( HeaderName . ACCEPT ) . map ( MediaType :: list ) . get ( ) ; this . accept = nonEmpty ( accepts ) ? accepts : singletonList ( WILDCARD ) ; } return accept ; }
Returns a accept header value
10,779
public int verify ( Request request , Response response ) { String authValue = request . getHeaders ( ) . getValues ( "Authorization" ) ; log . debug ( "Auth header value is: " + authValue ) ; if ( authValue == null ) { return Verifier . RESULT_MISSING ; } String [ ] tokenValues = authValue . split ( " " ) ; if ( token...
Verifies that the token passed is valid .
10,780
public void organizeTypeAnnotationsSignatures ( final Env < AttrContext > env , final JCClassDecl tree ) { annotate . afterRepeated ( new Worker ( ) { public void run ( ) { JavaFileObject oldSource = log . useSource ( env . toplevel . sourcefile ) ; try { new TypeAnnotationPositions ( true ) . scan ( tree ) ; } finally...
Separate type annotations from declaration annotations and determine the correct positions for type annotations . This version only visits types in signatures and should be called from MemberEnter . The method takes the Annotate object as parameter and adds an Annotate . Worker to the correct Annotate queue for later p...
10,781
public static Class < ? > classForNameWithException ( final String name , final ClassLoader cl ) throws ClassNotFoundException { if ( cl != null ) { try { return Class . forName ( name , false , cl ) ; } catch ( final ClassNotFoundException | NoClassDefFoundError e ) { } } return Class . forName ( name ) ; }
Get the Class from the class name .
10,782
public static ClassLoader getContextClassLoader ( ) { return AccessController . doPrivileged ( new PrivilegedAction < ClassLoader > ( ) { public ClassLoader run ( ) { ClassLoader cl = null ; try { cl = Thread . currentThread ( ) . getContextClassLoader ( ) ; } catch ( final SecurityException ex ) { } return cl ; } } ) ...
Get the context class loader .
10,783
public void sendMessage ( String subject , String message ) { first . sendMessage ( subject , message ) ; second . sendMessage ( subject , message ) ; }
Sends a message that consists of a subject and a message body .
10,784
private short getCellType ( String value ) { short ret = STRING_TYPE ; if ( value . equals ( "number" ) ) ret = NUMBER_TYPE ; else if ( value . equals ( "datetime" ) ) ret = DATETIME_TYPE ; else if ( value . equals ( "boolean" ) ) ret = BOOLEAN_TYPE ; return ret ; }
Returns the cell type for the given value .
10,785
private short getDataType ( String value ) { short ret = STRING_TYPE ; if ( value . equals ( "number" ) ) ret = NUMBER_TYPE ; else if ( value . equals ( "integer" ) ) ret = INTEGER_TYPE ; else if ( value . equals ( "decimal" ) ) ret = DECIMAL_TYPE ; else if ( value . equals ( "seconds" ) ) ret = SECONDS_TYPE ; else if ...
Returns the data type for the given value .
10,786
private short getAlignment ( String value ) { short ret = ALIGN_LEFT ; if ( value . equals ( "centre" ) ) ret = ALIGN_CENTRE ; else if ( value . equals ( "left" ) ) ret = ALIGN_LEFT ; else if ( value . equals ( "right" ) ) ret = ALIGN_RIGHT ; else if ( value . equals ( "justify" ) ) ret = ALIGN_JUSTIFY ; else if ( valu...
Returns the alignment for the given value .
10,787
public WritableCellFormat getCellFormat ( boolean create ) { WritableCellFormat ret = null ; if ( cellFormat != null ) ret = cellFormat ; else if ( create ) ret = new WritableCellFormat ( NumberFormats . TEXT ) ; return ret ; }
Returns the format object for this column .
10,788
private String convert ( String str , String dateFormat ) { String ret = str ; long longValue = 0L ; double doubleValue = 0.0d ; if ( str . length ( ) > 0 ) { if ( inputType == INTEGER_TYPE || inputType == NUMBER_TYPE ) longValue = Long . parseLong ( str ) ; else if ( inputType == DECIMAL_TYPE || inputType == SECONDS_T...
Convert the given string using the defined input and output formats and types .
10,789
private long parseDateTime ( String str , String format ) { return FormatUtilities . getDateTime ( str , format , false , true ) ; }
Parses the given date string in the given format to a milliseconds vale .
10,790
private String convertDateTime ( long dt , String format ) { if ( format . length ( ) == 0 ) format = Formats . DATETIME_FORMAT ; return FormatUtilities . getFormattedDateTime ( dt , format , false , 0L ) ; }
Converts the given milliseconds date value to the output date format .
10,791
private String convertDecimal ( double d , String format ) { String ret = "" ; if ( format . length ( ) > 0 ) { DecimalFormat f = new DecimalFormat ( format ) ; ret = f . format ( d ) ; } else { ret = Double . toString ( d ) ; } return ret ; }
Converts the given numeric value to the output date format .
10,792
private String convertString ( String str , String format , String expr ) { String ret = str ; String [ ] params = null ; if ( format . length ( ) > 0 ) { ret = "" ; if ( expr . length ( ) > 0 ) { Pattern pattern = getPattern ( expr ) ; Matcher m = pattern . matcher ( str ) ; if ( m . find ( ) ) { params = new String [...
Converts the given string value to the output string format .
10,793
private Pattern getPattern ( String expr ) { Pattern pattern = patterns . get ( expr ) ; if ( pattern == null ) { pattern = Pattern . compile ( expr ) ; patterns . put ( expr , pattern ) ; } return pattern ; }
Returns the pattern for the given regular expression .
10,794
public LanguageVersion languageVersion ( ) { try { Object retVal ; String methodName = "languageVersion" ; Class < ? > [ ] paramTypes = new Class < ? > [ 0 ] ; Object [ ] params = new Object [ 0 ] ; try { retVal = invoke ( methodName , JAVA_1_1 , paramTypes , params ) ; } catch ( DocletInvokeException exc ) { return JA...
Return the language version supported by this doclet . If the method does not exist in the doclet assume version 1 . 1 .
10,795
private Object invoke ( String methodName , Object returnValueIfNonExistent , Class < ? > [ ] paramTypes , Object [ ] params ) throws DocletInvokeException { Method meth ; try { meth = docletClass . getMethod ( methodName , paramTypes ) ; } catch ( NoSuchMethodException exc ) { if ( returnValueIfNonExistent == null ) {...
Utility method for calling doclet functionality
10,796
public synchronized List < ZipFileIndex > getZipFileIndexes ( boolean openedOnly ) { List < ZipFileIndex > zipFileIndexes = new ArrayList < ZipFileIndex > ( ) ; zipFileIndexes . addAll ( map . values ( ) ) ; if ( openedOnly ) { for ( ZipFileIndex elem : zipFileIndexes ) { if ( ! elem . isOpen ( ) ) { zipFileIndexes . r...
Returns a list of all ZipFileIndex entries
10,797
public synchronized void setOpenedIndexes ( List < ZipFileIndex > indexes ) throws IllegalStateException { if ( map . isEmpty ( ) ) { String msg = "Setting opened indexes should be called only when the ZipFileCache is empty. " + "Call JavacFileManager.flush() before calling this method." ; throw new IllegalStateExcepti...
Sets already opened list of ZipFileIndexes from an outside client of the compiler . This functionality should be used in a non - batch clients of the compiler .
10,798
public void close ( ) throws IOException , QdbException { this . compoundRegistry . close ( ) ; this . propertyRegistry . close ( ) ; this . descriptorRegistry . close ( ) ; this . modelRegistry . close ( ) ; this . predictionRegistry . close ( ) ; try { this . storage . close ( ) ; } finally { this . storage = null ; ...
Frees resources .
10,799
public static ExceptionThrower instance ( Class < ? extends RuntimeException > classType ) { iae . throwIfNull ( classType , "The parameter of exception type can not be null." ) ; if ( classType . equals ( IllegalArgumentException . class ) ) { return iae ; } else { iae . throwIfTrue ( true , "Not fond ExceptionThrower...
Return specify exception type singleton exceptionThrower .