idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
9,400 | public int getSqlType ( Object o ) { if ( null == o ) { return Types . NULL ; } return getSqlType ( o . getClass ( ) ) ; } | Get the SQL type for an object . |
9,401 | public Object fixNull ( Class type ) { return type . isPrimitive ( ) ? _primitiveDefaults . get ( type ) : null ; } | Returns a primitive legal value as opposed to null if type is primitive . |
9,402 | public ActionForward findForward ( String forwardName ) { ForwardConfig config = _delegate . findForwardConfig ( forwardName ) ; if ( config == null ) { config = getModuleConfig ( ) . findForwardConfig ( forwardName ) ; } if ( config == null ) { config = _delegate . getModuleConfig ( ) . findForwardConfig ( forwardName ) ; } return ( ActionForward ) config ; } | the delegate . |
9,403 | public static RowMapper getRowMapper ( ResultSet rs , Class returnTypeClass , Calendar cal ) { Class < ? extends RowMapper > rm = _rowMappings . get ( returnTypeClass ) ; if ( rm != null ) { return getMapper ( rm , rs , returnTypeClass , cal ) ; } if ( XMLOBJ_CLASS != null && XMLOBJ_CLASS . isAssignableFrom ( returnTypeClass ) ) { return getMapper ( DEFAULT_XMLOBJ_ROWMAPPING , rs , returnTypeClass , cal ) ; } else { return getMapper ( DEFAULT_OBJ_ROWMAPPING , rs , returnTypeClass , cal ) ; } } | Get a RowMapper instance which knows how to map a ResultSet row to the given return type . |
9,404 | public static void addRowMapping ( Class returnTypeClass , Class < ? extends RowMapper > rowMapperClass ) { _rowMappings . put ( returnTypeClass , rowMapperClass ) ; } | Add a new row mapper to the list of available row mappers . The getRowMapper method traverses the list of mappers from beginning to end checking to see if a mapper can handle the specified returnTypeClass . There is a default mapper which is used if a match cannot be found in the list . |
9,405 | public static Class < ? extends RowMapper > replaceRowMapping ( Class returnTypeClass , Class < ? extends RowMapper > rowMapperClass ) { return _rowMappings . put ( returnTypeClass , rowMapperClass ) ; } | Replace a row mapping . |
9,406 | public static Class < ? extends RowMapper > setDefaultRowMapping ( Class < ? extends RowMapper > rowMapperClass ) { Class < ? extends RowMapper > ret = DEFAULT_OBJ_ROWMAPPING ; DEFAULT_OBJ_ROWMAPPING = rowMapperClass ; return ret ; } | Sets the rowmapper for Object . class |
9,407 | public static Class < ? extends RowMapper > setDefaultXmlRowMapping ( Class mapToClass , Class < ? extends RowMapper > rowMapperClass ) { Class < ? extends RowMapper > ret = DEFAULT_XMLOBJ_ROWMAPPING ; DEFAULT_XMLOBJ_ROWMAPPING = rowMapperClass ; XMLOBJ_CLASS = mapToClass ; return ret ; } | Sets the rowmapper for XmlObject . class |
9,408 | private static RowMapper getMapper ( Class < ? extends RowMapper > rowMapper , ResultSet rs , Class returnType , Calendar cal ) { Constructor c = null ; try { c = rowMapper . getDeclaredConstructor ( _params ) ; return ( RowMapper ) c . newInstance ( new Object [ ] { rs , returnType , cal } ) ; } catch ( NoSuchMethodException e ) { throw new ControlException ( "Failure creating new instance of RowMapper, " + e . toString ( ) , e ) ; } catch ( InstantiationException e ) { throw new ControlException ( "Failure creating new instance of RowMapper, " + e . toString ( ) , e ) ; } catch ( IllegalAccessException e ) { throw new ControlException ( "Failure creating new instance of RowMapper, " + e . toString ( ) , e ) ; } catch ( InvocationTargetException e ) { throw new ControlException ( "Failure creating new instance of RowMapper, " + e . getCause ( ) . toString ( ) , e ) ; } } | Create an instance of the RowMapper class . |
9,409 | private static Handler createHandler ( String className , Class baseClassOrInterface , Handler previousHandler , ServletContext servletContext ) { assert Handler . class . isAssignableFrom ( baseClassOrInterface ) : baseClassOrInterface . getName ( ) + " cannot be assigned to " + Handler . class . getName ( ) ; ClassLoader cl = DiscoveryUtils . getClassLoader ( ) ; try { Class handlerClass = cl . loadClass ( className ) ; if ( ! baseClassOrInterface . isAssignableFrom ( handlerClass ) ) { _log . error ( "Handler " + handlerClass . getName ( ) + " does not implement or extend " + baseClassOrInterface . getName ( ) ) ; return null ; } Handler handler = ( Handler ) handlerClass . newInstance ( ) ; return handler ; } catch ( ClassNotFoundException e ) { _log . error ( "Could not find Handler class " + className , e ) ; } catch ( InstantiationException e ) { _log . error ( "Could not instantiate Handler class " + className , e ) ; } catch ( IllegalAccessException e ) { _log . error ( "Could not instantiate Handler class " + className , e ) ; } return null ; } | Instantiates a handler based on the class name in the given HandlerConfig . |
9,410 | public void setCellOnDblClick ( String onDblClick ) { _cellState . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , HtmlConstants . ONDBLCLICK , onDblClick ) ; } | Sets the onDblClick javascript event for the HTML table cell . |
9,411 | public void setCellOnKeyDown ( String onKeyDown ) { _cellState . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , HtmlConstants . ONKEYDOWN , onKeyDown ) ; } | Sets the onKeyDown javascript event for the HTML table cell . |
9,412 | public void setCellOnKeyUp ( String onKeyUp ) { _cellState . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , HtmlConstants . ONKEYUP , onKeyUp ) ; } | Sets the onKeyUp javascript event for the HTML table cell . |
9,413 | public void setCellOnKeyPress ( String onKeyPress ) { _cellState . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , HtmlConstants . ONKEYPRESS , onKeyPress ) ; } | Sets the onKeyPress javascript event for the HTML table cell . |
9,414 | public void setCellOnMouseDown ( String onMouseDown ) { _cellState . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , HtmlConstants . ONMOUSEDOWN , onMouseDown ) ; } | Sets the onMouseDown javascript event for the HTML table cell . |
9,415 | public void setCellOnMouseUp ( String onMouseUp ) { _cellState . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , HtmlConstants . ONMOUSEUP , onMouseUp ) ; } | Sets the onMouseUp javascript event for the HTML table cell . |
9,416 | public void setCellOnMouseMove ( String onMouseMove ) { _cellState . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , HtmlConstants . ONMOUSEMOVE , onMouseMove ) ; } | Sets the onMouseMove javascript event for the HTML table cell . |
9,417 | public void setCellOnMouseOut ( String onMouseOut ) { _cellState . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , HtmlConstants . ONMOUSEOUT , onMouseOut ) ; } | Sets the onMouseOut javascript event for the HTML table cell . |
9,418 | public void setCellOnMouseOver ( String onMouseOver ) { _cellState . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , HtmlConstants . ONMOUSEOVER , onMouseOver ) ; } | Sets the onMouseOver javascript event for the HTML table cell . |
9,419 | public void setCellTitle ( String title ) { _cellState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , HtmlConstants . TITLE , title ) ; } | Sets the value of the title attribute for the HTML table cell . |
9,420 | public void setCellAlign ( String align ) { _cellState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , HtmlConstants . ALIGN , align ) ; } | Sets the horizontal alignment of the HTML table cell . |
9,421 | public void setCellChar ( String alignChar ) { _cellState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , HtmlConstants . CHAR , alignChar ) ; } | Sets the value of the horizontal alignment character attribute for the HTML table cell . |
9,422 | public void setCellCharoff ( String alignCharOff ) { _cellState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , HtmlConstants . CHAROFF , alignCharOff ) ; } | Sets the value of the horizontal alignment character offset attribute for the HTML table cell . |
9,423 | public void setCellValign ( String align ) { _cellState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , HtmlConstants . VALIGN , align ) ; } | Sets the value of the vertical alignment attribute for the HTML table cell . |
9,424 | public void setCellLang ( String lang ) { _cellState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , HtmlConstants . LANG , lang ) ; } | Sets the value of the language attribute for the HTML table cell . |
9,425 | public void setCellDir ( String dir ) { _cellState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , HtmlConstants . DIR , dir ) ; } | Sets the value of the text direction attribute for the HTML table cell . |
9,426 | public void setCellAbbr ( String abbr ) { _cellState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , HtmlConstants . ABBR , abbr ) ; } | Sets the value of the abbreviated form of the HTML table cell s content . |
9,427 | public void setCellAxis ( String axis ) { _cellState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , HtmlConstants . AXIS , axis ) ; } | Sets the value of the axis attribute for the HTML table cell . |
9,428 | public void setCellHeaders ( String headers ) { _cellState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , HtmlConstants . HEADERS , headers ) ; } | Sets the value of the headers attribute for the HTML table cell . |
9,429 | public void setCellScope ( String scope ) { _cellState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , HtmlConstants . SCOPE , scope ) ; } | Sets the value of the scope attribute for the HTML table cell . |
9,430 | public void addActionMapping ( ActionModel mapping ) { String mappingPath = mapping . getPath ( ) ; ActionModel conflictingActionMapping = ( ActionModel ) _actionMappings . get ( mappingPath ) ; if ( conflictingActionMapping != null ) { ActionModel defaultMappingForThisPath = conflictingActionMapping ; if ( mapping . getFormBeanName ( ) == null || ( conflictingActionMapping . getFormBeanName ( ) != null && getBeanType ( mapping ) . compareTo ( getBeanType ( conflictingActionMapping ) ) < 0 ) ) { _actionMappings . remove ( mappingPath ) ; _actionMappings . put ( mappingPath , mapping ) ; defaultMappingForThisPath = mapping ; conflictingActionMapping . setOverloaded ( false ) ; addDisambiguatedActionMapping ( conflictingActionMapping ) ; } else { addDisambiguatedActionMapping ( mapping ) ; } defaultMappingForThisPath . setOverloaded ( true ) ; defaultMappingForThisPath . setComment ( DUPLICATE_ACTION_COMMENT . replaceAll ( "\\{0\\}" , mappingPath ) ) ; } else { _actionMappings . put ( mappingPath , mapping ) ; } } | Adds a new ActionMapping to this StrutsApp . |
9,431 | public List getFormBeansAsList ( ) { ArrayList retList = new ArrayList ( ) ; for ( Iterator i = _formBeans . values ( ) . iterator ( ) ; i . hasNext ( ) ; ) { FormBeanModel fb = ( FormBeanModel ) i . next ( ) ; if ( fb != null ) retList . add ( fb ) ; } return retList ; } | Returns a list of all the form beans that are defined for this StrutsApp . |
9,432 | public static PropertyMap getAnnotationMap ( ControlBeanContext cbc , AnnotatedElement annotElem ) { if ( cbc == null ) return new AnnotatedElementMap ( annotElem ) ; return cbc . getAnnotationMap ( annotElem ) ; } | Returns the annotation map for the specified element . |
9,433 | public void doTag ( ) throws JspException { InternalStringBuilder results = new InternalStringBuilder ( 128 ) ; PageContext pageContext = getPageContext ( ) ; Throwable e = ( Throwable ) pageContext . getAttribute ( Globals . EXCEPTION_KEY , PageContext . REQUEST_SCOPE ) ; if ( e == null ) { ServletRequest req = pageContext . getRequest ( ) ; e = ( Throwable ) req . getAttribute ( "javax.servlet.error.exception" ) ; if ( e == null ) { e = ( Throwable ) req . getAttribute ( "javax.servlet.jsp.jspException" ) ; } } if ( ! _showStackTrace && _showDevModeStackTrace ) { boolean devMode = ! AdapterManager . getServletContainerAdapter ( pageContext . getServletContext ( ) ) . isInProductionMode ( ) ; if ( devMode ) _showStackTrace = true ; } if ( e != null ) { if ( _showMessage ) { String msg = e . getMessage ( ) ; if ( ( msg != null ) && ( msg . length ( ) > 0 ) ) { if ( ! _showStackTrace ) msg = e . getClass ( ) . getName ( ) + ": " + msg ; results . append ( HtmlExceptionFormatter . format ( msg , e , _showStackTrace ) ) ; } else { results . append ( HtmlExceptionFormatter . format ( e . getClass ( ) . getName ( ) , e , _showStackTrace ) ) ; } } else { results . append ( HtmlExceptionFormatter . format ( null , e , _showStackTrace ) ) ; } ResponseUtils . write ( pageContext , results . toString ( ) ) ; } } | Render the exception text based on the display attributes . |
9,434 | protected final int parseIndex ( String indexString ) { try { return Integer . parseInt ( indexString ) ; } catch ( Exception e ) { String msg = "Error converting \"" + indexString + "\" into an integer. Cause: " + e ; LOGGER . error ( msg , e ) ; throw new RuntimeException ( msg , e ) ; } } | Attempt to convert a String indexString into an integer index . |
9,435 | public Graph createGraph ( final String name ) { if ( name == null ) { throw new IllegalArgumentException ( "Graph name cannot be null" ) ; } final Graph graph = new Graph ( name ) ; graphs . add ( graph ) ; return graph ; } | Construct and create a Graph that can be used to separate specific plotters to their own graphs on the metrics website . Plotters can be added to the graph object returned . |
9,436 | public boolean isOptOut ( ) { synchronized ( optOutLock ) { try { properties . load ( new FileInputStream ( configurationFile ) ) ; } catch ( IOException ex ) { if ( debug ) { System . out . println ( "[Metrics] " + ex . getMessage ( ) ) ; } return true ; } return Boolean . parseBoolean ( properties . getProperty ( "opt-out" ) ) ; } } | Has the server owner denied plugin metrics? |
9,437 | public void enable ( ) throws IOException { synchronized ( optOutLock ) { if ( isOptOut ( ) ) { properties . setProperty ( "opt-out" , "false" ) ; properties . store ( new FileOutputStream ( configurationFile ) , "http://mcstats.org" ) ; } if ( thread == null ) { start ( ) ; } } } | Enables metrics for the server by setting opt - out to false in the config file and starting the metrics task . |
9,438 | public void disable ( ) throws IOException { synchronized ( optOutLock ) { if ( ! isOptOut ( ) ) { properties . setProperty ( "opt-out" , "true" ) ; properties . store ( new FileOutputStream ( configurationFile ) , "http://mcstats.org" ) ; } if ( thread != null ) { thread . interrupt ( ) ; thread = null ; } } } | Disables metrics for the server by setting opt - out to true in the config file and canceling the metrics task . |
9,439 | public static byte [ ] gzip ( String input ) { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; GZIPOutputStream gzos = null ; try { gzos = new GZIPOutputStream ( baos ) ; gzos . write ( input . getBytes ( "UTF-8" ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } finally { if ( gzos != null ) { try { gzos . close ( ) ; } catch ( IOException ignore ) { } } } return baos . toByteArray ( ) ; } | GZip compress a string of bytes |
9,440 | private static String escapeJSON ( String text ) { StringBuilder builder = new StringBuilder ( ) ; builder . append ( '"' ) ; for ( int index = 0 ; index < text . length ( ) ; index ++ ) { char chr = text . charAt ( index ) ; switch ( chr ) { case '"' : case '\\' : builder . append ( '\\' ) ; builder . append ( chr ) ; break ; case '\b' : builder . append ( "\\b" ) ; break ; case '\t' : builder . append ( "\\t" ) ; break ; case '\n' : builder . append ( "\\n" ) ; break ; case '\r' : builder . append ( "\\r" ) ; break ; default : if ( chr < ' ' ) { String t = "000" + Integer . toHexString ( chr ) ; builder . append ( "\\u" + t . substring ( t . length ( ) - 4 ) ) ; } else { builder . append ( chr ) ; } break ; } } builder . append ( '"' ) ; return builder . toString ( ) ; } | Escape a string to create a valid JSON string |
9,441 | public void addContent ( String content ) { if ( _contentBuffer == null ) { int size = ( content != null ? ( 5 * content . length ( ) ) : 1024 ) ; _contentBuffer = new InternalStringBuilder ( size ) ; } _contentBuffer . append ( content ) ; } | Add content to the content that is being buffered by this tag . All content written by the body of this tag is added to this buffer . The buffer is rendered at the end of the tag s lifecycle if no fatal errors have occurred during this tag s lifecycle . |
9,442 | public int doStartTag ( ) throws JspException { Object source = evaluateDataSource ( ) ; if ( hasErrors ( ) ) return SKIP_BODY ; _renderState = INIT ; boolean empty = false ; if ( source != null ) { _iterator = IteratorFactory . createIterator ( source ) ; if ( _iterator == null ) { LOGGER . warn ( Bundle . getString ( "Tags_Repeater_nullIterator" ) ) ; _iterator = Collections . EMPTY_LIST . iterator ( ) ; } if ( _iterator . hasNext ( ) ) { _currentIndex = 0 ; _currentItem = _iterator . next ( ) ; if ( _ignoreNulls && _currentItem == null ) { advanceToNonNullItem ( ) ; if ( _currentItem == null ) empty = true ; } } else empty = true ; } else { _iterator = Collections . EMPTY_LIST . iterator ( ) ; empty = true ; } if ( empty ) { if ( _defaultText != null ) addContent ( _defaultText . toString ( ) ) ; return SKIP_BODY ; } else { DataAccessProviderStack . addDataAccessProvider ( this , pageContext ) ; _containerInPageContext = true ; return EVAL_BODY_BUFFERED ; } } | Start rendering the repeater . |
9,443 | public int doEndTag ( ) throws JspException { if ( hasErrors ( ) ) reportErrors ( ) ; else if ( _contentBuffer != null ) write ( _contentBuffer . toString ( ) ) ; return EVAL_PAGE ; } | Complete rendering the repeater . |
9,444 | private Object evaluateDataSource ( ) throws JspException { ExpressionHandling expr = new ExpressionHandling ( this ) ; String dataSource = getDataSource ( ) ; String ds = expr . ensureValidExpression ( dataSource , "dataSource" , "DataSourceError" ) ; if ( ds == null ) return null ; return expr . evaluateExpression ( dataSource , "dataSource" , pageContext ) ; } | Return the Object that is represented by the specified data source . |
9,445 | private void insertEJBRefsInEJBJar ( Document document , EJBInfo ejbInfo , String ejbLinkValue , List ejbList ) { for ( Object ejb : ejbList ) { if ( ejbInfo . isLocal ( ) ) insertEJBLocalRefInEJBJar ( ( Element ) ejb , ejbInfo , ejbLinkValue , document ) ; else insertEJBRefInEJBJar ( ( Element ) ejb , ejbInfo , ejbLinkValue , document ) ; } } | Insert EJB references in all of the descriptors of the EJB s in the supplied list |
9,446 | private void insertEJBRefInEJBJar ( Element ejb , EJBInfo ei , String ejbLinkValue , Document ejbDoc ) { List ejbRefArray = DomUtils . getChildElementsByName ( ejb , "ejb-ref" ) ; String insertedEjbRefName = ei . getRefName ( ) ; Node nextSibling = null ; for ( int j = ejbRefArray . size ( ) - 1 ; j >= 0 ; j -- ) { Element ejbRef = ( Element ) ejbRefArray . get ( j ) ; String ejbRefName = DomUtils . getChildElementText ( ejbRef , "ejb-ref-name" ) ; if ( insertedEjbRefName . equals ( ejbRefName ) ) { nextSibling = ejbRef . getNextSibling ( ) ; ejb . removeChild ( ejbRef ) ; break ; } } Element insertedEjbRef = ejbDoc . createElement ( "ejb-ref" ) ; if ( nextSibling != null ) { ejb . insertBefore ( insertedEjbRef , nextSibling ) ; } else { ejb . insertBefore ( insertedEjbRef , findEjbRefInsertPoint ( ejb ) ) ; } Element ejbRefName = ejbDoc . createElement ( "ejb-ref-name" ) ; ejbRefName . setTextContent ( insertedEjbRefName ) ; insertedEjbRef . appendChild ( ejbRefName ) ; Element ejbRefType = ejbDoc . createElement ( "ejb-ref-type" ) ; ejbRefType . setTextContent ( ei . getBeanType ( ) ) ; insertedEjbRef . appendChild ( ejbRefType ) ; Element homeType = ejbDoc . createElement ( "home" ) ; homeType . setTextContent ( ei . getHomeInterface ( ) . getName ( ) ) ; insertedEjbRef . appendChild ( homeType ) ; Element remoteType = ejbDoc . createElement ( "remote" ) ; remoteType . setTextContent ( ei . getBeanInterface ( ) . getName ( ) ) ; insertedEjbRef . appendChild ( remoteType ) ; Element ejbLink = ejbDoc . createElement ( "ejb-link" ) ; ejbLink . setTextContent ( ejbLinkValue ) ; insertedEjbRef . appendChild ( ejbLink ) ; } | Insert a remote ejb - ref into the specified EJB s descriptor if an ejb - ref already exists with the same name remove it before adding a new ref . |
9,447 | private Node findEjbRefInsertPoint ( Element parent ) { Element e = DomUtils . getChildElementByName ( parent , "ejb-local-ref" ) ; if ( e != null ) return e ; return findEjbLocalRefInsertPoint ( parent ) ; } | ejb - refs must be inserted before any ejb - local - ref tags . |
9,448 | private Node findEjbLocalRefInsertPoint ( Element parent ) { Element e = DomUtils . getChildElementByName ( parent , "service-ref" ) ; if ( e != null ) return e ; e = DomUtils . getChildElementByName ( parent , "resource-ref" ) ; if ( e != null ) return e ; e = DomUtils . getChildElementByName ( parent , "resource-env-ref" ) ; if ( e != null ) return e ; e = DomUtils . getChildElementByName ( parent , "message-destination-ref" ) ; if ( e != null ) return e ; e = DomUtils . getChildElementByName ( parent , "security-role-ref" ) ; if ( e != null ) return e ; e = DomUtils . getChildElementByName ( parent , "security-identity" ) ; if ( e != null ) return e ; e = DomUtils . getChildElementByName ( parent , "query" ) ; if ( e != null ) return e ; return null ; } | The local ref must be inserted into the ejb - jar file at the proper location based on the ejb - jar schema definition . Check for elements which can immediatly FOLLOW an ejb - ref from the closest to farthest as defined by the schema . |
9,449 | public synchronized int read ( int blockOffset , byte [ ] buffer , int offset , int length ) throws IOException { return provider . read ( blockNumber , blockOffset , buffer , offset , length ) ; } | Read a number of bytes from this block . |
9,450 | public synchronized void write ( int blockOffset , byte [ ] buffer , int offset , int length ) throws IOException { provider . write ( blockNumber , blockOffset , buffer , offset , length ) ; } | Writes a number of bytes to this block . |
9,451 | protected final void applyTagId ( AbstractHtmlState state , String tagId ) throws JspException { state . id = generateTagId ( tagId ) ; } | Create an un - indexed tag identifier for the given state object . |
9,452 | public static void register ( XStream stream ) { for ( XConverter converter : converters ) { stream . registerConverter ( converter ) ; converter . registerAliases ( stream ) ; } } | Registers all XES converters for XStream with the provided stream registers corresponding aliases . |
9,453 | public static Timer setTimeout ( int milliseconds , TimerCallback callback ) { TimeoutTimer timeout = new TimeoutTimer ( ) ; timeout . setId ( nativeSetTimeout ( milliseconds , callback , timeout ) ) ; return timeout ; } | Defines a one - shot timer . |
9,454 | public static Timer setInterval ( int milliseconds , TimerCallback callback ) { IntervalTimer interval = new IntervalTimer ( ) ; interval . setId ( nativeSetInterval ( milliseconds , callback , interval ) ) ; return interval ; } | Defines a repeating timer with a specified interval . |
9,455 | public void check ( ) throws FatalCompileTimeException { HashSet declsToCheck = new HashSet ( ) ; for ( int i = 0 ; i < _atds . length ; ++ i ) { AnnotationTypeDeclaration atd = _atds [ i ] ; Declaration [ ] decls = getAnnotationProcessorEnvironment ( ) . getDeclarationsAnnotatedWith ( atd ) ; for ( int j = 0 ; j < decls . length ; j ++ ) { declsToCheck . add ( decls [ j ] ) ; } } check ( declsToCheck ) ; } | Performs semantic validation of input Declarations that are annotated with annotations claimed by this CoreAnnotationProcessor . |
9,456 | public void generate ( ) { try { HashSet alreadyProcessed = new HashSet ( ) ; for ( int i = 0 ; i < _atds . length ; i ++ ) { AnnotationTypeDeclaration atd = _atds [ i ] ; Declaration [ ] decls = getAnnotationProcessorEnvironment ( ) . getDeclarationsAnnotatedWith ( atd ) ; for ( int j = 0 ; j < decls . length ; j ++ ) { Declaration decl = decls [ j ] ; if ( ! alreadyProcessed . contains ( decl ) ) generate ( decl ) ; alreadyProcessed . add ( decl ) ; } } } catch ( FatalCompileTimeException e ) { e . printDiagnostic ( this ) ; } } | Emits additional artifacts for input Declarations that are annotated with annotations claimed by this CoreAnnotationProcessor . |
9,457 | public static synchronized XEventClasses deriveEventClasses ( XEventClassifier classifier , XLog log ) { XEventClasses nClasses = new XEventClasses ( classifier ) ; nClasses . register ( log ) ; nClasses . harmonizeIndices ( ) ; return nClasses ; } | Creates a new set of event classes factory method . |
9,458 | public XEventClass getByIndex ( int index ) { for ( XEventClass eventClass : classMap . values ( ) ) { if ( eventClass . getIndex ( ) == index ) { return eventClass ; } } return null ; } | Returns a given event class by its unique index . |
9,459 | public synchronized void register ( XEvent event ) { String classId = classifier . getClassIdentity ( event ) ; XEventClass eventClass = classMap . get ( classId ) ; if ( eventClass == null && classId != null ) { eventClass = new XEventClass ( classId , classMap . size ( ) ) ; classMap . put ( classId , eventClass ) ; } if ( eventClass != null ) { eventClass . incrementSize ( ) ; } } | Registers an event with this set of event classes . This will potentially add a new event class to this set of event classes . An event class will be incremented in size if the given event is found to be a member of it . |
9,460 | protected void renderIndentation ( AbstractRenderAppender writer , TreeElement node , int level , InheritableState state ) { InternalStringBuilder img = new InternalStringBuilder ( 32 ) ; _imgState . clear ( ) ; _imgState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , WIDTH , "16px" ) ; _imgState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , BORDER , "0" ) ; _imgState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , ALT , "" , false ) ; for ( int i = 0 ; i < level ; i ++ ) { int levels = level - i ; TreeElement parent = node ; for ( int j = 1 ; j <= levels ; j ++ ) { parent = parent . getParent ( ) ; } img . setLength ( 0 ) ; img . append ( state . getImageRoot ( ) ) ; img . append ( '/' ) ; if ( parent . isLast ( ) ) { renderSpacerPrefix ( writer , node ) ; img . append ( state . getImageSpacer ( ) ) ; _imgState . style = null ; } else { renderVerticalLinePrefix ( writer , node ) ; img . append ( state . getVerticalLineImage ( ) ) ; _imgState . style = "vertical-align:bottom;" ; } _imgState . src = img . toString ( ) ; _imageRenderer . doStartTag ( writer , _imgState ) ; _imageRenderer . doEndTag ( writer ) ; if ( parent . isLast ( ) ) { renderSpacerSuffix ( writer , node ) ; } else { renderVerticalLineSuffix ( writer , node ) ; } } } | Write out the images that create the leading indentation for the given node . |
9,461 | protected TagRenderingBase renderSelectionLink ( AbstractRenderAppender writer , TreeElement node , String nodeName , AttributeRenderer attrs , InheritableState state ) throws JspException { String selectionLink = getSelectionlink ( node , nodeName , state ) ; TagRenderingBase endRender = null ; if ( selectionLink != null ) { _anchorState . clear ( ) ; _anchorState . href = selectionLink ; String target = node . getTarget ( ) ; if ( target == null ) { target = state . getSelectionTarget ( ) ; } _anchorState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , TARGET , target ) ; String title = node . getTitle ( ) ; _anchorState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , TITLE , title ) ; if ( node . isSelected ( ) ) { _anchorState . style = _trs . selectedStyle ; _anchorState . styleClass = _trs . selectedStyleClass ; } else { _anchorState . style = _trs . unselectedStyle ; _anchorState . styleClass = _trs . unselectedStyleClass ; } if ( _anchorState . style == null && _anchorState . styleClass == null ) { _anchorState . style = "text-decoration: none" ; } attrs . renderSelectionLink ( _anchorState , node ) ; if ( _trs . runAtClient ) { String action = node . getClientAction ( ) ; if ( action != null ) { action = HtmlUtils . escapeEscapes ( action ) ; action = ScriptRequestState . getString ( "netuiAction" , new Object [ ] { action } ) ; } _anchorState . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , ONCLICK , action ) ; } renderSelectionLinkPrefix ( writer , node ) ; _anchorRenderer . doStartTag ( writer , _anchorState ) ; endRender = _anchorRenderer ; } else { _spanState . clear ( ) ; _spanState . styleClass = _trs . disabledStyleClass ; _spanState . style = _trs . disabledStyle ; renderSelectionLinkPrefix ( writer , node ) ; _spanRenderer . doStartTag ( writer , _spanState ) ; endRender = _spanRenderer ; } return endRender ; } | If needed render the selection link around the icon for this node . Note that the tag rendered here needs to be closed after the actual icon and label are rendered . |
9,462 | protected String getSelectionlink ( TreeElement node , String nodeName , InheritableState state ) throws JspException { String selectionLink = null ; if ( ! node . isDisabled ( ) ) { String action = node . getAction ( ) ; if ( action == null ) { selectionLink = node . getHref ( ) ; if ( selectionLink == null && node . getClientAction ( ) != null ) { selectionLink = "" ; } if ( selectionLink == null ) { action = state . getSelectionAction ( ) ; } } if ( action != null && selectionLink == null ) { HashMap params = null ; boolean remove = false ; params = node . getParams ( ) ; if ( params == null ) { params = new HashMap ( ) ; remove = true ; } params . put ( TreeElement . SELECTED_NODE , nodeName ) ; if ( _trs . tagId != null ) { params . put ( TreeElement . TREE_ID , _trs . tagId ) ; } String scope = node . getScope ( ) ; if ( scope != null ) { params . put ( ScopedServletUtils . SCOPE_ID_PARAM , scope ) ; } String uri = null ; try { boolean xml = TagRenderingBase . Factory . isXHTML ( _req ) ; uri = PageFlowUtils . getRewrittenActionURI ( _servletContext , _req , _res , action , params , null , xml ) ; } catch ( URISyntaxException e ) { String s = Bundle . getString ( "Tags_Tree_Node_URLException" , new Object [ ] { action , e . getMessage ( ) } ) ; registerTagError ( s , e ) ; } if ( remove ) { params . remove ( TreeElement . SELECTED_NODE ) ; if ( _trs . tagId != null ) { params . remove ( TreeElement . TREE_ID ) ; } if ( scope != null ) { params . remove ( ScopedServletUtils . SCOPE_ID_PARAM ) ; } } if ( uri != null ) { selectionLink = _res . encodeURL ( uri ) ; } } } return selectionLink ; } | Calculate the selection link for this node if the node is disabled we can skip this because a disabled node may not be selected . |
9,463 | protected void renderItemIcon ( AbstractRenderAppender writer , TreeElement node , AttributeRenderer attrs , InheritableState state ) { renderItemIconPrefix ( writer , node ) ; String icon = node . getIcon ( ) ; if ( icon == null ) { icon = state . getIconRoot ( ) + "/" + state . getItemIcon ( ) ; } else { icon = state . getIconRoot ( ) + "/" + icon ; } if ( icon != null ) { _imgState . clear ( ) ; _imgState . src = icon ; _imgState . style = "vertical-align:text-top" ; String alt = null ; String label = node . getLabel ( ) ; if ( label != null && node . isLabelLegalAsAlt ( ) ) alt = label ; else alt = node . getTitle ( ) ; if ( alt == null ) alt = Bundle . getString ( "Tags_TreeAltText" , null ) ; _imgState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , ALT , alt , false ) ; _imgState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , BORDER , "0" ) ; attrs . renderIconImage ( _imgState , node ) ; _imageRenderer . doStartTag ( writer , _imgState ) ; _imageRenderer . doEndTag ( writer ) ; renderItemIconSuffix ( writer , node ) ; } } | Render the icon for this node . |
9,464 | public int doEndTag ( ) throws JspException { Object val = evaluateDataSource ( ) ; ServletRequest req = pageContext . getRequest ( ) ; if ( _dataInput != null ) { val = _dataInput . toString ( ) ; } if ( hasErrors ( ) ) return reportAndExit ( SKIP_BODY ) ; if ( val != null ) { _value = val . toString ( ) ; } ByRef ref = new ByRef ( ) ; nameHtmlControl ( _state , ref ) ; if ( _value != null ) { InternalStringBuilder sb = new InternalStringBuilder ( _value . length ( ) + 16 ) ; StringBuilderRenderAppender sbAppend = new StringBuilderRenderAppender ( sb ) ; HtmlUtils . filter ( _value , sbAppend ) ; _state . value = sb . toString ( ) ; } if ( _state . value == null ) _state . value = "" ; WriteRenderAppender writer = new WriteRenderAppender ( pageContext ) ; TagRenderingBase hiddenTag = TagRenderingBase . Factory . getRendering ( TagRenderingBase . INPUT_HIDDEN_TAG , req ) ; hiddenTag . doStartTag ( writer , _state ) ; hiddenTag . doEndTag ( writer ) ; if ( ! ref . isNull ( ) ) write ( ( String ) ref . getRef ( ) ) ; localRelease ( ) ; return SKIP_BODY ; } | Generate the hidden input tag . |
9,465 | public void setTabindex ( int tabindex ) { _state . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , HtmlConstants . TABINDEX , Integer . toString ( tabindex ) ) ; } | Sets the tabIndex of the rendered html tag . |
9,466 | public String extractResource ( XEvent event ) { XAttribute attribute = event . getAttributes ( ) . get ( KEY_RESOURCE ) ; if ( attribute == null ) { return null ; } else { return ( ( XAttributeLiteral ) attribute ) . getValue ( ) ; } } | Extracts the resource attribute string from an event . |
9,467 | public void assignResource ( XEvent event , String resource ) { if ( resource != null && resource . trim ( ) . length ( ) > 0 ) { XAttributeLiteral attr = ( XAttributeLiteral ) ATTR_RESOURCE . clone ( ) ; attr . setValue ( resource . trim ( ) ) ; event . getAttributes ( ) . put ( KEY_RESOURCE , attr ) ; } } | Assigns the resource attribute value for a given event . |
9,468 | public String extractRole ( XEvent event ) { XAttribute attribute = event . getAttributes ( ) . get ( KEY_ROLE ) ; if ( attribute == null ) { return null ; } else { return ( ( XAttributeLiteral ) attribute ) . getValue ( ) ; } } | Extracts the role attribute string from an event . |
9,469 | public void assignRole ( XEvent event , String role ) { if ( role != null && role . trim ( ) . length ( ) > 0 ) { XAttributeLiteral attr = ( XAttributeLiteral ) ATTR_ROLE . clone ( ) ; attr . setValue ( role . trim ( ) ) ; event . getAttributes ( ) . put ( KEY_ROLE , attr ) ; } } | Assigns the role attribute value for a given event . |
9,470 | public String extractGroup ( XEvent event ) { XAttribute attribute = event . getAttributes ( ) . get ( KEY_GROUP ) ; if ( attribute == null ) { return null ; } else { return ( ( XAttributeLiteral ) attribute ) . getValue ( ) ; } } | Extracts the group attribute string from an event . |
9,471 | public void assignGroup ( XEvent event , String group ) { if ( group != null && group . trim ( ) . length ( ) > 0 ) { XAttributeLiteral attr = ( XAttributeLiteral ) ATTR_GROUP . clone ( ) ; attr . setValue ( group . trim ( ) ) ; event . getAttributes ( ) . put ( KEY_GROUP , attr ) ; } } | Assigns the group attribute value for a given event . |
9,472 | public static void filter ( String value , AbstractRenderAppender result , boolean markupHTMLSpaceReturn ) { if ( value == null ) return ; int numChars = value . length ( ) ; char c ; char prev = 0 ; for ( int i = 0 ; i < numChars ; i ++ ) { c = value . charAt ( i ) ; switch ( c ) { case '<' : result . append ( "<" ) ; break ; case '>' : result . append ( ">" ) ; break ; case '&' : result . append ( "&" ) ; break ; case '"' : result . append ( """ ) ; break ; case '\'' : result . append ( "'" ) ; break ; case ' ' : if ( markupHTMLSpaceReturn ) { if ( prev == ' ' ) { result . append ( " " ) ; } else result . append ( c ) ; } else result . append ( c ) ; break ; case '\n' : if ( markupHTMLSpaceReturn ) { result . append ( "<br />" ) ; } else result . append ( c ) ; break ; default : result . append ( c ) ; } prev = c ; } } | Filter the specified string for characters that are sensitive to HTML interpreters returning the string with these characters replaced by the corresponding character entities . |
9,473 | protected String internalFormatMessage ( String pattern , Object [ ] args ) { MessageFormat format = new MessageFormat ( pattern ) ; String msg = format . format ( args ) . toString ( ) ; return msg ; } | Internal convenience method that is used to format a message given a pattern and a set of arguments . |
9,474 | public String mapLegacyTagId ( IScriptReporter scriptReporter , String tagId , String value ) { if ( scriptReporter != null ) { scriptReporter . addLegacyTagIdMappings ( tagId , value ) ; return null ; } InternalStringBuilder sb = new InternalStringBuilder ( 64 ) ; StringBuilderRenderAppender writer = new StringBuilderRenderAppender ( sb ) ; getTagIdMapping ( tagId , value , writer ) ; return sb . toString ( ) ; } | This method will add a tagId and value to the ScriptRepoter TagId map . The a ScriptContainer tag will create a JavaScript table that allows the container such as a portal to rewrite the id so it s unique . The real name may be looked up based upon the tagId . |
9,475 | private String getFeatureKey ( CoreScriptFeature feature ) { switch ( feature . getIntValue ( ) ) { case CoreScriptFeature . INT_ANCHOR_SUBMIT : return "anchorFormSubmit" ; case CoreScriptFeature . INT_SET_FOCUS : return "setFocus" ; case CoreScriptFeature . INT_POPUP_OPEN : return "popupSupportPopupWindow" ; case CoreScriptFeature . INT_POPUP_DONE : return "popupDone" ; case CoreScriptFeature . INT_POPUP_UPDATE_FORM : return "popupSupportUpdateForm" ; case CoreScriptFeature . INT_ROLLOVER : return "rollover" ; case CoreScriptFeature . INT_TREE_INIT : return "initTree" ; case CoreScriptFeature . INT_AJAX_PREFIX : return "initTreePrefix" ; case CoreScriptFeature . INT_AJAX_PARAM : return "initTreeParam" ; case CoreScriptFeature . INT_DIVPANEL_INIT : return "initDivPanel" ; case CoreScriptFeature . INT_DYNAMIC_INIT : return "writeWebAppName" ; case CoreScriptFeature . INT_BUTTON_DISABLE_AND_SUBMIT : return "buttonDisableAndSubmitForm" ; case CoreScriptFeature . INT_BUTTON_DISABLE : return "buttonDisable" ; } assert ( false ) : "getFeature fell through on feature:" + feature ; return null ; } | This will map the Features into their keys |
9,476 | private void getTagIdMapping ( String tagId , String value , AbstractRenderAppender results ) { if ( ( _javaScriptFeatures & CoreScriptFeature . ALLOCATE_LEGACY . value ) == 0 ) { _javaScriptFeatures |= CoreScriptFeature . ALLOCATE_LEGACY . value ; String s = getString ( "singleIdMappingTable" , new Object [ ] { tagId , value } ) ; String meths = writeNetuiNameFunctions ( null , true , false , false ) ; if ( meths != null ) s += meths ; writeScriptBlock ( _req , results , s ) ; } else { String s = getString ( "idMappingEntry" , new Object [ ] { tagId , value } ) ; writeScriptBlock ( _req , results , s ) ; } } | This method will write out a tagId map entry for when there isn t a ScriptContainer defined . |
9,477 | public NikeFS2Block allocateBlock ( ) throws IOException { synchronized ( this ) { for ( NikeFS2BlockProvider provider : blockProviders ) { if ( provider . numberOfFreeBlocks ( ) > 0 ) { NikeFS2Block block = provider . allocateBlock ( ) ; if ( block != null ) { return block ; } } } XLogging . log ( "NikeFS2: Allocating new swap file. (#" + ( blockProviders . size ( ) + 1 ) + ": " + swapFileSize + " bytes)" , Importance . DEBUG ) ; File swapFile = NikeFS2SwapFileManager . createSwapFile ( ) ; NikeFS2BlockProvider addedProvider = new NikeFS2BlockProvider ( swapFile , swapFileSize , blockSize , true ) ; blockProviders . add ( addedProvider ) ; return addedProvider . allocateBlock ( ) ; } } | Allocates a new virtual storage block from this virtual file system instance . If no currently allocated swap file can provide any more storage blocks a new swap file will be allocated . |
9,478 | public XExtension parse ( File file ) throws IOException , ParserConfigurationException , SAXException { BufferedInputStream is = new BufferedInputStream ( new FileInputStream ( file ) ) ; XExtensionHandler handler = new XExtensionHandler ( ) ; SAXParserFactory parserFactory = SAXParserFactory . newInstance ( ) ; SAXParser parser = parserFactory . newSAXParser ( ) ; parser . parse ( is , handler ) ; is . close ( ) ; return handler . getExtension ( ) ; } | Parses an extension from a definition file . |
9,479 | public XExtension parse ( URI uri ) throws IOException , ParserConfigurationException , SAXException { BufferedInputStream is = new BufferedInputStream ( uri . toURL ( ) . openStream ( ) ) ; XExtensionHandler handler = new XExtensionHandler ( ) ; SAXParserFactory parserFactory = SAXParserFactory . newInstance ( ) ; SAXParser parser = parserFactory . newSAXParser ( ) ; parser . parse ( is , handler ) ; is . close ( ) ; return handler . getExtension ( ) ; } | Parses an extension from a URI . |
9,480 | public boolean hasNext ( ) { if ( _rs == null ) return false ; if ( _primed ) return true ; try { _primed = _rs . next ( ) ; return _primed ; } catch ( SQLException sql ) { String msg = "An exception occurred reading from the Iterator. Cause: " + sql ; LOGGER . error ( msg , sql ) ; throw new IllegalStateException ( msg , sql ) ; } } | Check for a subsequent item in the ResultSet . |
9,481 | public Object next ( ) { if ( _rs == null ) throw new NoSuchElementException ( Bundle . getErrorString ( "IteratorFactory_Iterator_noSuchElement" ) ) ; try { if ( ! _primed ) { _primed = _rs . next ( ) ; if ( ! _primed ) { throw new NoSuchElementException ( Bundle . getErrorString ( "IteratorFactory_Iterator_noSuchElement" ) ) ; } } _primed = false ; return convertRow ( _rs , _columnNames ) ; } catch ( SQLException sql ) { String msg = "An exception occurred reading from the Iterator. Cause: " + sql ; LOGGER . error ( msg , sql ) ; throw new IllegalStateException ( msg , sql ) ; } } | Advance to the next row in the ResultSet . |
9,482 | public OWLAxiom visit ( OWLSubClassOfAxiom axiom ) { return dataFactory . getOWLSubClassOfAxiom ( axiom . getSubClass ( ) . accept ( this ) , axiom . getSuperClass ( ) . accept ( this ) ) ; } | Conversion of non - class expressions to NNF |
9,483 | public int doEndTag ( ) throws JspException { if ( _name . length ( ) == 0 ) { String msg = Bundle . getErrorString ( "Tags_DeclareBundle_invalidName" , new Object [ ] { _name } ) ; registerTagError ( msg , null ) ; } if ( _name . equals ( BundleMap . DEFAULT_STRUTS_BUNDLE_NAME ) ) { String msg = Bundle . getErrorString ( "Tags_DeclareBundle_defaultIsReservedWord" , null ) ; registerTagError ( msg , null ) ; } if ( _bundlePath . length ( ) == 0 ) { String msg = Bundle . getErrorString ( "Tags_DeclareBundle_invalidResourcePath" , new Object [ ] { _bundlePath } ) ; registerTagError ( msg , null ) ; } Locale locale = getCurrentLocale ( ) ; if ( hasErrors ( ) ) { reportErrors ( ) ; return EVAL_PAGE ; } BundleMap bundleMap = null ; Object obj = pageContext . getAttribute ( "bundle" ) ; if ( obj == null ) { bundleMap = new BundleMap ( ( HttpServletRequest ) pageContext . getRequest ( ) , pageContext . getServletContext ( ) ) ; pageContext . setAttribute ( "bundle" , bundleMap ) ; } else if ( ! ( obj instanceof BundleMap ) ) { String msg = Bundle . getErrorString ( "Tags_DeclareBundle_wrongContextType" , new Object [ ] { obj . getClass ( ) . getName ( ) } ) ; registerTagError ( msg , null ) ; if ( hasErrors ( ) ) reportErrors ( ) ; return EVAL_PAGE ; } else bundleMap = ( BundleMap ) obj ; bundleMap . registerResourceBundle ( _name , _bundlePath , locale ) ; return EVAL_PAGE ; } | Register a ResourceBundle that is available for the scope of this page . Errors raised during the execution of this tag will be reported in the page which will continue rendering . |
9,484 | public static Class < ? extends XAttribute > getType ( XAttribute attribute ) { if ( attribute instanceof XAttributeList ) { return XAttributeList . class ; } else if ( attribute instanceof XAttributeContainer ) { return XAttributeContainer . class ; } else if ( attribute instanceof XAttributeLiteral ) { return XAttributeLiteral . class ; } else if ( attribute instanceof XAttributeBoolean ) { return XAttributeBoolean . class ; } else if ( attribute instanceof XAttributeContinuous ) { return XAttributeContinuous . class ; } else if ( attribute instanceof XAttributeDiscrete ) { return XAttributeDiscrete . class ; } else if ( attribute instanceof XAttributeTimestamp ) { return XAttributeTimestamp . class ; } else if ( attribute instanceof XAttributeID ) { return XAttributeID . class ; } else { throw new AssertionError ( "Unexpected attribute type!" ) ; } } | For the given attribute returns its type i . e . the most high - level typed interface this attribute implements . |
9,485 | public static XAttribute derivePrototype ( XAttribute instance ) { XAttribute prototype = ( XAttribute ) instance . clone ( ) ; if ( prototype instanceof XAttributeList ) { } else if ( prototype instanceof XAttributeContainer ) { } else if ( prototype instanceof XAttributeLiteral ) { ( ( XAttributeLiteral ) prototype ) . setValue ( "DEFAULT" ) ; } else if ( prototype instanceof XAttributeBoolean ) { ( ( XAttributeBoolean ) prototype ) . setValue ( true ) ; } else if ( prototype instanceof XAttributeContinuous ) { ( ( XAttributeContinuous ) prototype ) . setValue ( 0.0 ) ; } else if ( prototype instanceof XAttributeDiscrete ) { ( ( XAttributeDiscrete ) prototype ) . setValue ( 0 ) ; } else if ( prototype instanceof XAttributeTimestamp ) { ( ( XAttributeTimestamp ) prototype ) . setValueMillis ( 0 ) ; } else if ( prototype instanceof XAttributeID ) { ( ( XAttributeID ) prototype ) . setValue ( XIDFactory . instance ( ) . createId ( ) ) ; } else { throw new AssertionError ( "Unexpected attribute type!" ) ; } return prototype ; } | Derives a prototype for the given attribute . This prototype attribute will be equal in all respects expect for the value of the attribute . This value will be set to a default value depending on the specific type of the given attribute . |
9,486 | public static Set < XExtension > extractExtensions ( Map < String , XAttribute > attributeMap ) { HashSet < XExtension > extensions = new HashSet < XExtension > ( ) ; for ( XAttribute attribute : attributeMap . values ( ) ) { XExtension extension = attribute . getExtension ( ) ; if ( extension != null ) { extensions . add ( extension ) ; } } return extensions ; } | Static helper method for extracting all extensions from an attribute map . |
9,487 | protected String replace ( String template , String placeholder , String value ) { if ( template == null ) return null ; if ( ( placeholder == null ) || ( value == null ) ) return template ; while ( true ) { int index = template . indexOf ( placeholder ) ; if ( index < 0 ) break ; InternalStringBuilder temp = new InternalStringBuilder ( template . substring ( 0 , index ) ) ; temp . append ( value ) ; temp . append ( template . substring ( index + placeholder . length ( ) ) ) ; template = temp . toString ( ) ; } return template ; } | Replace any occurrence of the specified placeholder in the specified template string with the specified replacement value . |
9,488 | public void collectChildError ( String error ) { if ( _errorText == null ) { _errorText = new InternalStringBuilder ( 32 ) ; } _errorText . append ( error ) ; } | This method will report all collected errors . |
9,489 | private String renderDefaultJavaScript ( HttpServletRequest request , String realId ) { String idScript = null ; if ( TagConfig . isDefaultJavaScript ( ) ) { ScriptRequestState srs = ScriptRequestState . getScriptRequestState ( request ) ; idScript = srs . mapTagId ( getScriptReporter ( ) , _trs . tagId , realId , null ) ; } return idScript ; } | Much of the code below is taken from the HtmlBaseTag . We need to eliminate this duplication through some type of helper methods . |
9,490 | public static String getFormClassName ( TypeDeclaration jclass , CoreAnnotationProcessorEnv env ) { if ( isAssignableFrom ( STRUTS_FORM_CLASS_NAME , jclass , env ) ) { return getLoadableName ( jclass ) ; } else if ( isAssignableFrom ( BEA_XMLOBJECT_CLASS_NAME , jclass , env ) ) { return XML_FORM_CLASS_NAME ; } else if ( isAssignableFrom ( APACHE_XMLOBJECT_CLASS_NAME , jclass , env ) ) { return XML_FORM_CLASS_NAME ; } else { return ANY_FORM_CLASS_NAME ; } } | Get a Class . forName - able string for the given type signature . |
9,491 | public static String inferModulePathFromType ( TypeDeclaration type ) { PackageDeclaration pkg = type . getPackage ( ) ; return pkg != null ? '/' + pkg . getQualifiedName ( ) . replace ( '.' , '/' ) : "/" ; } | Infers the Struts module path from the given controller class . |
9,492 | public static boolean isAbsoluteURI ( String uri ) { if ( uri . length ( ) == 0 || uri . charAt ( 0 ) == '/' ) return false ; for ( int i = 0 , len = uri . length ( ) ; i < len ; ++ i ) { char c = uri . charAt ( i ) ; if ( c == ':' ) { return true ; } else if ( c == '/' ) { return false ; } } return false ; } | This is the same logic that we have in the runtime in PageFlowRequestProcessor . Can t share the code though . |
9,493 | public static String isReconcilePhase ( CoreAnnotationProcessorEnv env ) throws FatalCompileTimeException { String [ ] phase = getOption ( "-A" + JpfLanguageConstants . ANNOTATION_PROCESSOR_OPTION_PHASE , false , env ) ; return phase != null && phase . length > 0 ? phase [ 0 ] : null ; } | Utility method to get the value of the phase option from the annotation processing environment . |
9,494 | public boolean needsGui ( ) { BeanContextChild bcc = getPeer ( ) ; if ( bcc != this && bcc instanceof Visibility ) { return ( ( Visibility ) bcc ) . needsGui ( ) ; } for ( Object o : _children . keySet ( ) ) { if ( o instanceof Visibility ) { if ( ( ( Visibility ) o ) . needsGui ( ) ) { return true ; } } } return false ; } | Determines whether this bean needs a GUI . |
9,495 | public void dontUseGui ( ) { if ( ! _mayUseGui ) return ; _mayUseGui = false ; for ( Object o : _children . keySet ( ) ) { if ( o instanceof Visibility ) { ( ( Visibility ) o ) . dontUseGui ( ) ; } } } | This method instructs the bean that it should not use the Gui . |
9,496 | public void okToUseGui ( ) { if ( _mayUseGui ) return ; _mayUseGui = true ; for ( Object o : _children . keySet ( ) ) { if ( o instanceof Visibility ) { ( ( Visibility ) o ) . okToUseGui ( ) ; } } } | This method instructs the bean that it is OK to use the Gui . |
9,497 | public void vetoableChange ( PropertyChangeEvent evt ) throws PropertyVetoException { if ( "beanContext" . equals ( evt . getPropertyName ( ) ) && contains ( evt . getOldValue ( ) ) ) { } } | This method gets called when a constrained property is changed . |
9,498 | protected void initialize ( ) { _bcMembershipListeners = new ArrayList < BeanContextMembershipListener > ( ) ; _children = Collections . synchronizedMap ( new HashMap < Object , BCChild > ( ) ) ; _childPcl = new PropertyChangeListener ( ) { public void propertyChange ( PropertyChangeEvent pce ) { ControlBeanContextSupport . this . propertyChange ( pce ) ; } } ; _childVcl = new VetoableChangeListener ( ) { public void vetoableChange ( PropertyChangeEvent pce ) throws PropertyVetoException { ControlBeanContextSupport . this . vetoableChange ( pce ) ; } } ; } | Init this classes data structures . |
9,499 | private void fireMembershipEvent ( BeanContextMembershipEvent bcme , boolean childrenAdded ) { for ( BeanContextMembershipListener bcml : _bcMembershipListeners ) { if ( childrenAdded ) { bcml . childrenAdded ( bcme ) ; } else { bcml . childrenRemoved ( bcme ) ; } } } | Fire a BeanContextMembershipEvent . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.