idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
12,100 | public static BeanInfoIndexedProperty getBeanInfoIndexedProperty ( Class pClass , String pIndexedPropertyName , Logger pLogger ) throws ELException { return getBeanInfoManager ( pClass ) . getIndexedProperty ( pIndexedPropertyName , pLogger ) ; } | Returns the BeanInfoIndexedProperty for the specified property in the given class or null if not found . |
12,101 | void checkInitialized ( Logger pLogger ) throws ELException { if ( ! mInitialized ) { synchronized ( this ) { if ( ! mInitialized ) { initialize ( pLogger ) ; mInitialized = true ; } } } } | Makes sure that this class has been initialized and synchronizes the initialization if it s required . |
12,102 | void initialize ( Logger pLogger ) throws ELException { try { mBeanInfo = Introspector . getBeanInfo ( mBeanClass ) ; mPropertyByName = new HashMap ( ) ; mIndexedPropertyByName = new HashMap ( ) ; PropertyDescriptor [ ] pds = mBeanInfo . getPropertyDescriptors ( ) ; for ( int i = 0 ; pds != null && i < pds . length ; i ++ ) { PropertyDescriptor pd = pds [ i ] ; if ( pd instanceof IndexedPropertyDescriptor ) { IndexedPropertyDescriptor ipd = ( IndexedPropertyDescriptor ) pd ; Method readMethod = getPublicMethod ( ipd . getIndexedReadMethod ( ) ) ; Method writeMethod = getPublicMethod ( ipd . getIndexedWriteMethod ( ) ) ; BeanInfoIndexedProperty property = new BeanInfoIndexedProperty ( readMethod , writeMethod , ipd ) ; mIndexedPropertyByName . put ( ipd . getName ( ) , property ) ; } Method readMethod = getPublicMethod ( pd . getReadMethod ( ) ) ; Method writeMethod = getPublicMethod ( pd . getWriteMethod ( ) ) ; BeanInfoProperty property = new BeanInfoProperty ( readMethod , writeMethod , pd ) ; mPropertyByName . put ( pd . getName ( ) , property ) ; } mEventSetByName = new HashMap ( ) ; EventSetDescriptor [ ] esds = mBeanInfo . getEventSetDescriptors ( ) ; for ( int i = 0 ; esds != null && i < esds . length ; i ++ ) { EventSetDescriptor esd = esds [ i ] ; mEventSetByName . put ( esd . getName ( ) , esd ) ; } } catch ( IntrospectionException exc ) { if ( pLogger . isLoggingWarning ( ) ) { pLogger . logWarning ( Constants . EXCEPTION_GETTING_BEANINFO , exc , mBeanClass . getName ( ) ) ; } } } | Initializes by mapping property names to BeanInfoProperties |
12,103 | public BeanInfoProperty getProperty ( String pPropertyName , Logger pLogger ) throws ELException { checkInitialized ( pLogger ) ; return ( BeanInfoProperty ) mPropertyByName . get ( pPropertyName ) ; } | Returns the BeanInfoProperty for the given property name or null if not found . |
12,104 | public BeanInfoIndexedProperty getIndexedProperty ( String pIndexedPropertyName , Logger pLogger ) throws ELException { checkInitialized ( pLogger ) ; return ( BeanInfoIndexedProperty ) mIndexedPropertyByName . get ( pIndexedPropertyName ) ; } | Returns the BeanInfoIndexedProperty for the given property name or null if not found . |
12,105 | public EventSetDescriptor getEventSet ( String pEventSetName , Logger pLogger ) throws ELException { checkInitialized ( pLogger ) ; return ( EventSetDescriptor ) mEventSetByName . get ( pEventSetName ) ; } | Returns the EventSetDescriptor for the given event set name or null if not found . |
12,106 | static Method getPublicMethod ( Method pMethod ) { if ( pMethod == null ) { return null ; } Class cl = pMethod . getDeclaringClass ( ) ; if ( Modifier . isPublic ( cl . getModifiers ( ) ) ) { return pMethod ; } Method ret = getPublicMethod ( cl , pMethod ) ; if ( ret != null ) { return ret ; } else { return pMethod ; } } | Returns a publicly - accessible version of the given method by searching for a public declaring class . |
12,107 | static Method getPublicMethod ( Class pClass , Method pMethod ) { if ( Modifier . isPublic ( pClass . getModifiers ( ) ) ) { try { Method m ; try { m = pClass . getDeclaredMethod ( pMethod . getName ( ) , pMethod . getParameterTypes ( ) ) ; } catch ( java . security . AccessControlException ex ) { m = pClass . getMethod ( pMethod . getName ( ) , pMethod . getParameterTypes ( ) ) ; } if ( Modifier . isPublic ( m . getModifiers ( ) ) ) { return m ; } } catch ( NoSuchMethodException exc ) { } } { Class [ ] interfaces = pClass . getInterfaces ( ) ; if ( interfaces != null ) { for ( int i = 0 ; i < interfaces . length ; i ++ ) { Method m = getPublicMethod ( interfaces [ i ] , pMethod ) ; if ( m != null ) { return m ; } } } } { Class superclass = pClass . getSuperclass ( ) ; if ( superclass != null ) { Method m = getPublicMethod ( superclass , pMethod ) ; if ( m != null ) { return m ; } } } return null ; } | If the given class is public and has a Method that declares the same name and arguments as the given method then that method is returned . Otherwise the superclass and interfaces are searched recursively . |
12,108 | public int doStartTag ( ) throws JspException { if ( context != null && ( ! context . startsWith ( "/" ) || ! url . startsWith ( "/" ) ) ) { throw new JspTagException ( Resources . getMessage ( "IMPORT_BAD_RELATIVE" ) ) ; } urlWithParams = null ; params = new ParamSupport . ParamManager ( ) ; if ( url == null || url . equals ( "" ) ) { throw new NullAttributeException ( "import" , "url" ) ; } isAbsoluteUrl = UrlUtil . isAbsoluteUrl ( url ) ; try { if ( varReader != null ) { r = acquireReader ( ) ; pageContext . setAttribute ( varReader , r ) ; } } catch ( IOException ex ) { throw new JspTagException ( ex . toString ( ) , ex ) ; } return EVAL_BODY_INCLUDE ; } | determines what kind of import and variable exposure to perform |
12,109 | public void doFinally ( ) { try { if ( varReader != null ) { if ( r != null ) { r . close ( ) ; } pageContext . removeAttribute ( varReader , PageContext . PAGE_SCOPE ) ; } } catch ( IOException ex ) { } } | cleans up if appropriate |
12,110 | public static void setSyncCache ( String name , Cache cache ) { if ( null == name || "" . equals ( name . trim ( ) ) || null == cache ) { return ; } GlobalSyncRedis . caches . put ( name , cache ) ; } | Set cache to the memory . |
12,111 | public static void removeSyncCache ( String name ) { if ( StrKit . isBlank ( name ) ) { return ; } if ( GlobalSyncRedis . caches . containsKey ( name ) ) { GlobalSyncRedis . caches . remove ( name ) ; } } | remove cache from memory . |
12,112 | public static Cache getSyncCache ( String name ) { if ( StrKit . isBlank ( name ) || ! GlobalSyncRedis . caches . containsKey ( name ) ) { return Redis . use ( ) ; } return GlobalSyncRedis . caches . get ( name ) ; } | Get cache from memory . |
12,113 | private String redisColumnKey ( SqlpKit . FLAG flag ) { StringBuilder key = new StringBuilder ( this . _getUsefulClass ( ) . toGenericString ( ) ) ; String [ ] attrs = this . _getAttrNames ( ) ; Object val ; for ( String attr : attrs ) { val = this . get ( attr ) ; if ( null == val ) { continue ; } key . append ( val . toString ( ) ) ; } key = new StringBuilder ( HashKit . md5 ( key . toString ( ) ) ) ; if ( flag . equals ( SqlpKit . FLAG . ONE ) ) { return "data:" + key ; } return "datas:" + key ; } | redis key for attrs values |
12,114 | private List < M > fetchDatasFromRedis ( String ... columns ) { String key = this . redisColumnKey ( SqlpKit . FLAG . ALL ) ; List < M > fetchDatas = this . redis ( ) . get ( key ) ; if ( null == fetchDatas ) { fetchDatas = this . find ( SqlpKit . select ( this , this . primaryKeys ( ) ) ) ; } if ( null == fetchDatas || fetchDatas . size ( ) == 0 ) { return fetchDatas ; } this . redis ( ) . setex ( key , GlobalSyncRedis . syncExpire ( ) , fetchDatas ) ; for ( M m : fetchDatas ) { if ( null == m ) { continue ; } m = this . fetchOne ( m , columns ) ; } return fetchDatas ; } | Use the columns that must contains primary keys fetch Data from db and use the fetched primary keys fetch from redis . |
12,115 | public Class < ? > attrType ( String attr ) { Table table = this . table ( ) ; if ( null != table ) { return table . getColumnType ( attr ) ; } Method [ ] methods = this . _getUsefulClass ( ) . getMethods ( ) ; String methodName ; for ( Method method : methods ) { methodName = method . getName ( ) ; if ( methodName . startsWith ( "set" ) && methodName . substring ( 3 ) . toLowerCase ( ) . equals ( attr ) ) { return method . getParameterTypes ( ) [ 0 ] ; } } return null ; } | Get attr type |
12,116 | public List < String > attrNames ( ) { String [ ] names = this . _getAttrNames ( ) ; if ( null != names && names . length != 0 ) { return Arrays . asList ( names ) ; } Method [ ] methods = this . _getUsefulClass ( ) . getMethods ( ) ; String methodName ; List < String > attrs = new ArrayList < String > ( ) ; for ( Method method : methods ) { methodName = method . getName ( ) ; if ( methodName . startsWith ( "set" ) ) { String attr = methodName . substring ( 3 ) . toLowerCase ( ) ; if ( StrKit . notBlank ( attr ) ) { attrs . add ( attr ) ; } } } return attrs ; } | Get attr names |
12,117 | public Map < Object , Object > attrsCp ( ) { Map < Object , Object > attrs = new HashMap < Object , Object > ( ) ; String [ ] attrNames = this . _getAttrNames ( ) ; for ( String attr : attrNames ) { attrs . put ( attr , this . get ( attr ) ) ; } return attrs ; } | Model attr copy version the model just use default DbKit . brokenConfig |
12,118 | public void shotCacheName ( String cacheName ) { if ( StrKit . notBlank ( cacheName ) && ! cacheName . equals ( this . cacheName ) ) { GlobalSyncRedis . removeSyncCache ( this . cacheName ) ; } this . cacheName = cacheName ; this . syncToRedis = true ; ModelRedisMapping . me ( ) . put ( this . tableName ( ) , this . cacheName ) ; } | shot cache s name . if current cacheName ! = the old cacheName will reset old cache update cache use the current cacheName and open syncToRedis . |
12,119 | public boolean save ( ) { for ( CallbackListener callbackListener : this . callbackListeners ) { callbackListener . beforeSave ( this ) ; } boolean ret = super . save ( ) ; if ( this . syncToRedis && ret ) { this . saveToRedis ( ) ; } for ( CallbackListener callbackListener : this . callbackListeners ) { callbackListener . afterSave ( this ) ; } return ret ; } | save to db if syncToRedis is true this model will save to redis in the same time . |
12,120 | public boolean delete ( ) { for ( CallbackListener callbackListener : this . callbackListeners ) { callbackListener . beforeDelete ( this ) ; } boolean ret = super . delete ( ) ; if ( this . syncToRedis && ret ) { this . redis ( ) . del ( this . redisKey ( this ) ) ; } for ( CallbackListener callbackListener : this . callbackListeners ) { callbackListener . afterDelete ( this ) ; } return ret ; } | delete from db if syncToRedis is true this model will delete from redis in the same time . |
12,121 | public boolean update ( ) { for ( CallbackListener callbackListener : this . callbackListeners ) { callbackListener . beforeUpdate ( this ) ; } boolean ret = super . update ( ) ; if ( this . syncToRedis && ret ) { this . saveToRedis ( ) ; } for ( CallbackListener callbackListener : this . callbackListeners ) { callbackListener . afterUpdate ( this ) ; } return ret ; } | update db if syncToRedis is true this model will update redis in the same time . |
12,122 | public int hcode ( ) { final int prime = 31 ; int result = 1 ; Table table = this . table ( ) ; Set < Entry < String , Object > > attrsEntrySet = this . _getAttrsEntrySet ( ) ; for ( Entry < String , Object > entry : attrsEntrySet ) { String key = entry . getKey ( ) ; Object value = entry . getValue ( ) ; Class < ? > clazz = table . getColumnType ( key ) ; if ( clazz == Integer . class ) { result = prime * result + ( Integer ) value ; } else if ( clazz == Short . class ) { result = prime * result + ( Short ) value ; } else if ( clazz == Long . class ) { result = prime * result + ( int ) ( ( Long ) value ^ ( ( Long ) value >>> 32 ) ) ; } else if ( clazz == Float . class ) { result = prime * result + Float . floatToIntBits ( ( Float ) value ) ; } else if ( clazz == Double . class ) { long temp = Double . doubleToLongBits ( ( Double ) value ) ; result = prime * result + ( int ) ( temp ^ ( temp >>> 32 ) ) ; } else if ( clazz == Boolean . class ) { result = prime * result + ( ( Boolean ) value ? 1231 : 1237 ) ; } else if ( clazz == Model . class ) { result = this . hcode ( ) ; } else { result = prime * result + ( ( value == null ) ? 0 : value . hashCode ( ) ) ; } } return result ; } | wrapper hash code |
12,123 | public static Class < ? > define ( ClassLoader loader ) { try { SecurityManager sm = System . getSecurityManager ( ) ; if ( sm != null ) { String packageName = DriverManagerAccessor . class . getPackage ( ) . getName ( ) ; RuntimePermission permission = new RuntimePermission ( "defineClassInPackage." + packageName ) ; sm . checkPermission ( permission ) ; } byte [ ] b = loadBytes ( ) ; Object [ ] args = new Object [ ] { DriverManagerAccessor . class . getName ( ) . replace ( '/' , '.' ) , b , new Integer ( 0 ) , new Integer ( b . length ) } ; Class < ? > clazz = ( Class < ? > ) defineClass . invoke ( loader , args ) ; return clazz ; } catch ( RuntimeException e ) { try { return loader . loadClass ( DriverManagerAccessor . class . getName ( ) ) ; } catch ( ClassNotFoundException ex ) { } throw e ; } catch ( Exception e ) { try { return loader . loadClass ( DriverManagerAccessor . class . getName ( ) ) ; } catch ( ClassNotFoundException ex ) { } throw new RuntimeException ( e ) ; } } | Definines the class using the given ClassLoader and ProtectionDomain |
12,124 | public synchronized ValidationMessage [ ] validate ( int type , String prefix , String uri , PageData page ) { try { this . tlvType = type ; this . uri = uri ; messageVector = new Vector ( ) ; this . prefix = prefix ; try { if ( config == null ) { configure ( ( String ) getInitParameters ( ) . get ( EXP_ATT_PARAM ) ) ; } } catch ( NoSuchElementException ex ) { return vmFromString ( Resources . getMessage ( "TLV_PARAMETER_ERROR" , EXP_ATT_PARAM ) ) ; } DefaultHandler h = getHandler ( ) ; XMLReader xmlReader = XmlUtil . newXMLReader ( null ) ; xmlReader . setContentHandler ( h ) ; InputStream inputStream = page . getInputStream ( ) ; try { xmlReader . parse ( new InputSource ( inputStream ) ) ; } finally { try { inputStream . close ( ) ; } catch ( IOException e ) { } } if ( messageVector . size ( ) == 0 ) { return null ; } else { return vmFromVector ( messageVector ) ; } } catch ( SAXException ex ) { return vmFromString ( ex . toString ( ) ) ; } catch ( IOException ex ) { return vmFromString ( ex . toString ( ) ) ; } catch ( ParserConfigurationException ex ) { return vmFromString ( ex . toString ( ) ) ; } } | do the validation . |
12,125 | protected boolean isTag ( String tagUri , String tagLn , String matchUri , String matchLn ) { if ( tagUri == null || tagUri . length ( ) == 0 || tagLn == null || matchUri == null || matchLn == null ) { return false ; } if ( tagUri . length ( ) > matchUri . length ( ) ) { return ( tagUri . startsWith ( matchUri ) && tagLn . equals ( matchLn ) ) ; } else { return ( matchUri . startsWith ( tagUri ) && tagLn . equals ( matchLn ) ) ; } } | utility methods to help us match elements in our tagset |
12,126 | protected boolean condition ( ) throws JspTagException { try { Object r = ExpressionEvaluatorManager . evaluate ( "test" , test , Boolean . class , this , pageContext ) ; if ( r == null ) { throw new NullAttributeException ( "when" , "test" ) ; } else { return ( ( ( Boolean ) r ) . booleanValue ( ) ) ; } } catch ( JspException ex ) { throw new JspTagException ( ex . toString ( ) , ex ) ; } } | Supplied conditional logic |
12,127 | public String logicalColumnName ( String columnName , String propertyName ) { return ! isNullOrEmpty ( columnName ) ? columnName : unqualify ( propertyName ) ; } | Return the column name or the unqualified property name |
12,128 | static DataSource getDataSource ( Object rawDataSource , PageContext pc ) throws JspException { DataSource dataSource = null ; if ( rawDataSource == null ) { rawDataSource = Config . find ( pc , Config . SQL_DATA_SOURCE ) ; } if ( rawDataSource == null ) { return null ; } if ( rawDataSource instanceof String ) { try { Context ctx = new InitialContext ( ) ; Context envCtx = ( Context ) ctx . lookup ( "java:comp/env" ) ; dataSource = ( DataSource ) envCtx . lookup ( ( String ) rawDataSource ) ; } catch ( NamingException ex ) { dataSource = getDataSource ( ( String ) rawDataSource ) ; } } else if ( rawDataSource instanceof DataSource ) { dataSource = ( DataSource ) rawDataSource ; } else { throw new JspException ( Resources . getMessage ( "SQL_DATASOURCE_INVALID_TYPE" ) ) ; } return dataSource ; } | If dataSource is a String first do JNDI lookup . If lookup fails parse String like it was a set of JDBC parameters Otherwise check to see if dataSource is a DataSource object and use as is |
12,129 | private static DataSource getDataSource ( String params ) throws JspException { DataSourceWrapper dataSource = new DataSourceWrapper ( ) ; String [ ] paramString = new String [ 4 ] ; int escCount = 0 ; int aryCount = 0 ; int begin = 0 ; for ( int index = 0 ; index < params . length ( ) ; index ++ ) { char nextChar = params . charAt ( index ) ; if ( TOKEN . indexOf ( nextChar ) != - 1 ) { if ( escCount == 0 ) { paramString [ aryCount ] = params . substring ( begin , index ) . trim ( ) ; begin = index + 1 ; if ( ++ aryCount > 4 ) { throw new JspTagException ( Resources . getMessage ( "JDBC_PARAM_COUNT" ) ) ; } } } if ( ESCAPE . indexOf ( nextChar ) != - 1 ) { escCount ++ ; } else { escCount = 0 ; } } paramString [ aryCount ] = params . substring ( begin ) . trim ( ) ; dataSource . setJdbcURL ( paramString [ 0 ] ) ; if ( paramString [ 1 ] != null ) { try { dataSource . setDriverClassName ( paramString [ 1 ] ) ; } catch ( Exception ex ) { throw new JspTagException ( Resources . getMessage ( "DRIVER_INVALID_CLASS" , ex . toString ( ) ) , ex ) ; } } dataSource . setUserName ( paramString [ 2 ] ) ; dataSource . setPassword ( paramString [ 3 ] ) ; return dataSource ; } | Parse JDBC parameters and setup dataSource appropriately |
12,130 | public static void main ( String args [ ] ) throws ParseException { SPathParser parser = new SPathParser ( System . in ) ; Path p = parser . expression ( ) ; java . util . List l = p . getSteps ( ) ; System . out . println ( ) ; if ( p instanceof AbsolutePath ) System . out . println ( "Root: /" ) ; for ( int i = 0 ; i < l . size ( ) ; i ++ ) { Step s = ( Step ) l . get ( i ) ; System . out . print ( "Step: " + s . getName ( ) ) ; if ( s . isDepthUnlimited ( ) ) System . out . print ( "(*)" ) ; System . out . println ( ) ; } } | Simple command - line parser interface primarily for testing . |
12,131 | final public Path expression ( ) throws ParseException { Path expr ; if ( jj_2_1 ( 2147483647 ) ) { expr = absolutePath ( ) ; jj_consume_token ( 0 ) ; } else { switch ( ( jj_ntk == - 1 ) ? jj_ntk ( ) : jj_ntk ) { case QNAME : case NSWILDCARD : case SLASH : case STAR : expr = relativePath ( ) ; jj_consume_token ( 0 ) ; break ; default : jj_la1 [ 0 ] = jj_gen ; jj_consume_token ( - 1 ) ; throw new ParseException ( ) ; } } { if ( true ) return expr ; } throw new Error ( "Missing return statement in function" ) ; } | Actual SPath grammar |
12,132 | final public RelativePath relativePath ( ) throws ParseException { RelativePath relPath = null ; Step step ; step = step ( ) ; switch ( ( jj_ntk == - 1 ) ? jj_ntk ( ) : jj_ntk ) { case SLASH : jj_consume_token ( SLASH ) ; relPath = relativePath ( ) ; break ; default : jj_la1 [ 1 ] = jj_gen ; ; } { if ( true ) return new RelativePath ( step , relPath ) ; } throw new Error ( "Missing return statement in function" ) ; } | as an example we use recursion here to handle a list |
12,133 | public static DocumentBuilder newDocumentBuilder ( ) { try { return PARSER_FACTORY . newDocumentBuilder ( ) ; } catch ( ParserConfigurationException e ) { throw ( Error ) new AssertionError ( ) . initCause ( e ) ; } } | Create a new DocumentBuilder configured for namespaces but not validating . |
12,134 | public static Transformer newTransformer ( Source source , JstlUriResolver uriResolver ) throws TransformerConfigurationException { TRANSFORMER_FACTORY . setURIResolver ( uriResolver ) ; Transformer transformer = TRANSFORMER_FACTORY . newTransformer ( source ) ; if ( transformer == null ) { throw new TransformerConfigurationException ( "newTransformer returned null. XSLT may be invalid." ) ; } return transformer ; } | Create a new Transformer from an XSLT . |
12,135 | public static InputSource newInputSource ( Reader reader , String systemId ) { InputSource source = new InputSource ( reader ) ; source . setSystemId ( wrapSystemId ( systemId ) ) ; return source ; } | Create an InputSource from a Reader . |
12,136 | public static XMLReader newXMLReader ( JstlEntityResolver entityResolver ) throws ParserConfigurationException , SAXException { XMLReader xmlReader = SAXPARSER_FACTORY . newSAXParser ( ) . getXMLReader ( ) ; xmlReader . setEntityResolver ( entityResolver ) ; return xmlReader ; } | Create an XMLReader that resolves entities using JSTL semantics . |
12,137 | public static SAXSource newSAXSource ( Reader reader , String systemId , JstlEntityResolver entityResolver ) throws ParserConfigurationException , SAXException { SAXSource source = new SAXSource ( newXMLReader ( entityResolver ) , new InputSource ( reader ) ) ; source . setSystemId ( wrapSystemId ( systemId ) ) ; return source ; } | Create a SAXSource from a Reader . Any entities will be resolved using JSTL semantics . |
12,138 | private static < T , E extends Exception > T runWithOurClassLoader ( final Callable < T > action , Class < E > allowed ) throws E { PrivilegedExceptionAction < T > actionWithClassloader = new PrivilegedExceptionAction < T > ( ) { public T run ( ) throws Exception { ClassLoader original = Thread . currentThread ( ) . getContextClassLoader ( ) ; ClassLoader ours = XmlUtil . class . getClassLoader ( ) ; if ( original == ours ) { return action . call ( ) ; } else { try { Thread . currentThread ( ) . setContextClassLoader ( ours ) ; return action . call ( ) ; } finally { Thread . currentThread ( ) . setContextClassLoader ( original ) ; } } } } ; try { return AccessController . doPrivileged ( actionWithClassloader ) ; } catch ( PrivilegedActionException e ) { Throwable cause = e . getCause ( ) ; if ( allowed . isInstance ( cause ) ) { throw allowed . cast ( cause ) ; } else { throw ( Error ) new AssertionError ( ) . initCause ( cause ) ; } } } | Performs an action using this Class s ClassLoader as the Thread context ClassLoader . |
12,139 | public SelectRootClauseBuilder < ? extends QueryForNumber > count ( ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "SELECT count(*)" ) ; sb . append ( " FROM " ) . append ( definition . getSqlName ( ) ) ; SelectRootClauseBuilder < ? extends QueryForNumber > r = SelectRootClauseBuilder . newInstance ( new RootClauseHandoff < CountBuilder < T > > ( sb . toString ( ) ) { protected CountBuilder < T > createBuilder ( String sql ) { return new CountBuilder < T > ( SelectBuilderFactory . this , sql ) ; } public CountBuilder < T > transform ( SelectRootClauseBuilder < CountBuilder < T > > clause ) { clause . where ( ) . limit ( 1 ) ; return super . transform ( clause ) ; } } ) ; return r ; } | FIXME This may not work . |
12,140 | protected void prepare ( ) throws JspTagException { if ( rawItems == null ) { items = new ToEndIterator ( end ) ; } else if ( rawItems instanceof ValueExpression ) { deferredExpression = ( ValueExpression ) rawItems ; Object o = deferredExpression . getValue ( pageContext . getELContext ( ) ) ; Iterator iterator = toIterator ( o ) ; if ( isIndexed ( o ) ) { items = new IndexedDeferredIterator ( iterator , deferredExpression ) ; } else { items = new IteratedDeferredIterator ( iterator , new IteratedExpression ( deferredExpression , getDelims ( ) ) ) ; } } else { items = toIterator ( rawItems ) ; } } | our raw items |
12,141 | void exportToVariable ( Object result ) throws JspTagException { int scopeValue = Util . getScope ( scope ) ; ELContext myELContext = pageContext . getELContext ( ) ; VariableMapper vm = myELContext . getVariableMapper ( ) ; if ( result != null ) { if ( result instanceof ValueExpression ) { if ( scopeValue != PageContext . PAGE_SCOPE ) { throw new JspTagException ( Resources . getMessage ( "SET_BAD_DEFERRED_SCOPE" , scope ) ) ; } vm . setVariable ( var , ( ValueExpression ) result ) ; } else { if ( scopeValue == PageContext . PAGE_SCOPE && vm . resolveVariable ( var ) != null ) { vm . setVariable ( var , null ) ; } pageContext . setAttribute ( var , result , scopeValue ) ; } } else { if ( vm . resolveVariable ( var ) != null ) { vm . setVariable ( var , null ) ; } if ( scope != null ) { pageContext . removeAttribute ( var , Util . getScope ( scope ) ) ; } else { pageContext . removeAttribute ( var ) ; } } } | Export the result into a scoped variable . |
12,142 | void exportToMapProperty ( Object target , String property , Object result ) { @ SuppressWarnings ( "unchecked" ) Map < Object , Object > map = ( Map < Object , Object > ) target ; if ( result == null ) { map . remove ( property ) ; } else { map . put ( property , result ) ; } } | Export the result into a Map . |
12,143 | void exportToBeanProperty ( Object target , String property , Object result ) throws JspTagException { PropertyDescriptor [ ] descriptors ; try { descriptors = Introspector . getBeanInfo ( target . getClass ( ) ) . getPropertyDescriptors ( ) ; } catch ( IntrospectionException ex ) { throw new JspTagException ( ex ) ; } for ( PropertyDescriptor pd : descriptors ) { if ( pd . getName ( ) . equals ( property ) ) { Method m = pd . getWriteMethod ( ) ; if ( m == null ) { throw new JspTagException ( Resources . getMessage ( "SET_NO_SETTER_METHOD" , property ) ) ; } try { m . invoke ( target , convertToExpectedType ( result , m ) ) ; } catch ( ELException ex ) { throw new JspTagException ( ex ) ; } catch ( IllegalAccessException ex ) { throw new JspTagException ( ex ) ; } catch ( InvocationTargetException ex ) { throw new JspTagException ( ex ) ; } return ; } } throw new JspTagException ( Resources . getMessage ( "SET_INVALID_PROPERTY" , property ) ) ; } | Export the result into a bean property . |
12,144 | private Object convertToExpectedType ( final Object value , Method m ) throws ELException { if ( value == null ) { return null ; } Class < ? > expectedType = m . getParameterTypes ( ) [ 0 ] ; return getExpressionFactory ( ) . coerceToType ( value , expectedType ) ; } | Convert an object to an expected type of the method parameter according to the conversion rules of the Expression Language . |
12,145 | private static Class < ? > [ ] types ( Object ... values ) { if ( values == null ) { return new Class [ 0 ] ; } Class < ? > [ ] result = new Class [ values . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) { Object value = values [ i ] ; result [ i ] = value == null ? Object . class : value . getClass ( ) ; } return result ; } | Get an array of types for an array of objects |
12,146 | public ValidationMessage [ ] validate ( String prefix , String uri , PageData page ) { return super . validate ( TYPE_CORE , prefix , uri , page ) ; } | set its type and delegate validation to super - class |
12,147 | @ SuppressWarnings ( "unchecked" ) public static < K , V > Map < K , V > jsonToMap ( String json ) { return FastJsonKit . parse ( json , HashMap . class ) ; } | json string to map |
12,148 | public static Record jsonToRecord ( String json ) { Map < String , Object > map = jsonToMap ( json ) ; return new Record ( ) . setColumns ( map ) ; } | json to Record |
12,149 | public static Object coerce ( Object pValue , Class pClass , Logger pLogger ) throws ELException { if ( pClass == String . class ) { return coerceToString ( pValue , pLogger ) ; } else if ( isPrimitiveNumberClass ( pClass ) ) { return coerceToPrimitiveNumber ( pValue , pClass , pLogger ) ; } else if ( pClass == Character . class || pClass == Character . TYPE ) { return coerceToCharacter ( pValue , pLogger ) ; } else if ( pClass == Boolean . class || pClass == Boolean . TYPE ) { return coerceToBoolean ( pValue , pLogger ) ; } else { return coerceToObject ( pValue , pClass , pLogger ) ; } } | Coerces the given value to the specified class . |
12,150 | static boolean isPrimitiveNumberClass ( Class pClass ) { return pClass == Byte . class || pClass == Byte . TYPE || pClass == Short . class || pClass == Short . TYPE || pClass == Integer . class || pClass == Integer . TYPE || pClass == Long . class || pClass == Long . TYPE || pClass == Float . class || pClass == Float . TYPE || pClass == Double . class || pClass == Double . TYPE ; } | Returns true if the given class is Byte Short Integer Long Float Double |
12,151 | public static String coerceToString ( Object pValue , Logger pLogger ) throws ELException { if ( pValue == null ) { return "" ; } else if ( pValue instanceof String ) { return ( String ) pValue ; } else { try { return pValue . toString ( ) ; } catch ( Exception exc ) { if ( pLogger . isLoggingError ( ) ) { pLogger . logError ( Constants . TOSTRING_EXCEPTION , exc , pValue . getClass ( ) . getName ( ) ) ; } return "" ; } } } | Coerces the specified value to a String |
12,152 | public static Number coerceToPrimitiveNumber ( Object pValue , Class pClass , Logger pLogger ) throws ELException { if ( pValue == null || "" . equals ( pValue ) ) { return coerceToPrimitiveNumber ( 0 , pClass ) ; } else if ( pValue instanceof Character ) { char val = ( ( Character ) pValue ) . charValue ( ) ; return coerceToPrimitiveNumber ( ( short ) val , pClass ) ; } else if ( pValue instanceof Boolean ) { if ( pLogger . isLoggingError ( ) ) { pLogger . logError ( Constants . BOOLEAN_TO_NUMBER , pValue , pClass . getName ( ) ) ; } return coerceToPrimitiveNumber ( 0 , pClass ) ; } else if ( pValue . getClass ( ) == pClass ) { return ( Number ) pValue ; } else if ( pValue instanceof Number ) { return coerceToPrimitiveNumber ( ( Number ) pValue , pClass ) ; } else if ( pValue instanceof String ) { try { return coerceToPrimitiveNumber ( ( String ) pValue , pClass ) ; } catch ( Exception exc ) { if ( pLogger . isLoggingError ( ) ) { pLogger . logError ( Constants . STRING_TO_NUMBER_EXCEPTION , ( String ) pValue , pClass . getName ( ) ) ; } return coerceToPrimitiveNumber ( 0 , pClass ) ; } } else { if ( pLogger . isLoggingError ( ) ) { pLogger . logError ( Constants . COERCE_TO_NUMBER , pValue . getClass ( ) . getName ( ) , pClass . getName ( ) ) ; } return coerceToPrimitiveNumber ( 0 , pClass ) ; } } | Coerces a value to the given primitive number class |
12,153 | public static Integer coerceToInteger ( Object pValue , Logger pLogger ) throws ELException { if ( pValue == null ) { return null ; } else if ( pValue instanceof Character ) { return PrimitiveObjects . getInteger ( ( int ) ( ( ( Character ) pValue ) . charValue ( ) ) ) ; } else if ( pValue instanceof Boolean ) { if ( pLogger . isLoggingWarning ( ) ) { pLogger . logWarning ( Constants . BOOLEAN_TO_NUMBER , pValue , Integer . class . getName ( ) ) ; } return PrimitiveObjects . getInteger ( ( ( Boolean ) pValue ) . booleanValue ( ) ? 1 : 0 ) ; } else if ( pValue instanceof Integer ) { return ( Integer ) pValue ; } else if ( pValue instanceof Number ) { return PrimitiveObjects . getInteger ( ( ( Number ) pValue ) . intValue ( ) ) ; } else if ( pValue instanceof String ) { try { return Integer . valueOf ( ( String ) pValue ) ; } catch ( Exception exc ) { if ( pLogger . isLoggingWarning ( ) ) { pLogger . logWarning ( Constants . STRING_TO_NUMBER_EXCEPTION , ( String ) pValue , Integer . class . getName ( ) ) ; } return null ; } } else { if ( pLogger . isLoggingWarning ( ) ) { pLogger . logWarning ( Constants . COERCE_TO_NUMBER , pValue . getClass ( ) . getName ( ) , Integer . class . getName ( ) ) ; } return null ; } } | Coerces a value to an Integer returning null if the coercion isn t possible . |
12,154 | static Number coerceToPrimitiveNumber ( long pValue , Class pClass ) throws ELException { if ( pClass == Byte . class || pClass == Byte . TYPE ) { return PrimitiveObjects . getByte ( ( byte ) pValue ) ; } else if ( pClass == Short . class || pClass == Short . TYPE ) { return PrimitiveObjects . getShort ( ( short ) pValue ) ; } else if ( pClass == Integer . class || pClass == Integer . TYPE ) { return PrimitiveObjects . getInteger ( ( int ) pValue ) ; } else if ( pClass == Long . class || pClass == Long . TYPE ) { return PrimitiveObjects . getLong ( ( long ) pValue ) ; } else if ( pClass == Float . class || pClass == Float . TYPE ) { return PrimitiveObjects . getFloat ( ( float ) pValue ) ; } else if ( pClass == Double . class || pClass == Double . TYPE ) { return PrimitiveObjects . getDouble ( ( double ) pValue ) ; } else { return PrimitiveObjects . getInteger ( 0 ) ; } } | Coerces a long to the given primitive number class |
12,155 | static Number coerceToPrimitiveNumber ( Number pValue , Class pClass ) throws ELException { if ( pClass == Byte . class || pClass == Byte . TYPE ) { return PrimitiveObjects . getByte ( pValue . byteValue ( ) ) ; } else if ( pClass == Short . class || pClass == Short . TYPE ) { return PrimitiveObjects . getShort ( pValue . shortValue ( ) ) ; } else if ( pClass == Integer . class || pClass == Integer . TYPE ) { return PrimitiveObjects . getInteger ( pValue . intValue ( ) ) ; } else if ( pClass == Long . class || pClass == Long . TYPE ) { return PrimitiveObjects . getLong ( pValue . longValue ( ) ) ; } else if ( pClass == Float . class || pClass == Float . TYPE ) { return PrimitiveObjects . getFloat ( pValue . floatValue ( ) ) ; } else if ( pClass == Double . class || pClass == Double . TYPE ) { return PrimitiveObjects . getDouble ( pValue . doubleValue ( ) ) ; } else { return PrimitiveObjects . getInteger ( 0 ) ; } } | Coerces a Number to the given primitive number class |
12,156 | static Number coerceToPrimitiveNumber ( String pValue , Class pClass ) throws ELException { if ( pClass == Byte . class || pClass == Byte . TYPE ) { return Byte . valueOf ( pValue ) ; } else if ( pClass == Short . class || pClass == Short . TYPE ) { return Short . valueOf ( pValue ) ; } else if ( pClass == Integer . class || pClass == Integer . TYPE ) { return Integer . valueOf ( pValue ) ; } else if ( pClass == Long . class || pClass == Long . TYPE ) { return Long . valueOf ( pValue ) ; } else if ( pClass == Float . class || pClass == Float . TYPE ) { return Float . valueOf ( pValue ) ; } else if ( pClass == Double . class || pClass == Double . TYPE ) { return Double . valueOf ( pValue ) ; } else { return PrimitiveObjects . getInteger ( 0 ) ; } } | Coerces a String to the given primitive number class |
12,157 | public static Character coerceToCharacter ( Object pValue , Logger pLogger ) throws ELException { if ( pValue == null || "" . equals ( pValue ) ) { return PrimitiveObjects . getCharacter ( ( char ) 0 ) ; } else if ( pValue instanceof Character ) { return ( Character ) pValue ; } else if ( pValue instanceof Boolean ) { if ( pLogger . isLoggingError ( ) ) { pLogger . logError ( Constants . BOOLEAN_TO_CHARACTER , pValue ) ; } return PrimitiveObjects . getCharacter ( ( char ) 0 ) ; } else if ( pValue instanceof Number ) { return PrimitiveObjects . getCharacter ( ( char ) ( ( Number ) pValue ) . shortValue ( ) ) ; } else if ( pValue instanceof String ) { String str = ( String ) pValue ; return PrimitiveObjects . getCharacter ( str . charAt ( 0 ) ) ; } else { if ( pLogger . isLoggingError ( ) ) { pLogger . logError ( Constants . COERCE_TO_CHARACTER , pValue . getClass ( ) . getName ( ) ) ; } return PrimitiveObjects . getCharacter ( ( char ) 0 ) ; } } | Coerces a value to a Character |
12,158 | public static Boolean coerceToBoolean ( Object pValue , Logger pLogger ) throws ELException { if ( pValue == null || "" . equals ( pValue ) ) { return Boolean . FALSE ; } else if ( pValue instanceof Boolean ) { return ( Boolean ) pValue ; } else if ( pValue instanceof String ) { String str = ( String ) pValue ; try { return Boolean . valueOf ( str ) ; } catch ( Exception exc ) { if ( pLogger . isLoggingError ( ) ) { pLogger . logError ( Constants . STRING_TO_BOOLEAN , exc , ( String ) pValue ) ; } return Boolean . FALSE ; } } else { if ( pLogger . isLoggingError ( ) ) { pLogger . logError ( Constants . COERCE_TO_BOOLEAN , pValue . getClass ( ) . getName ( ) ) ; } return Boolean . TRUE ; } } | Coerces a value to a Boolean |
12,159 | public static Object coerceToObject ( Object pValue , Class pClass , Logger pLogger ) throws ELException { if ( pValue == null ) { return null ; } else if ( pClass . isAssignableFrom ( pValue . getClass ( ) ) ) { return pValue ; } else if ( pValue instanceof String ) { String str = ( String ) pValue ; PropertyEditor pe = PropertyEditorManager . findEditor ( pClass ) ; if ( pe == null ) { if ( "" . equals ( str ) ) { return null ; } else { if ( pLogger . isLoggingError ( ) ) { pLogger . logError ( Constants . NO_PROPERTY_EDITOR , str , pClass . getName ( ) ) ; } return null ; } } try { pe . setAsText ( str ) ; return pe . getValue ( ) ; } catch ( IllegalArgumentException exc ) { if ( "" . equals ( str ) ) { return null ; } else { if ( pLogger . isLoggingError ( ) ) { pLogger . logError ( Constants . PROPERTY_EDITOR_ERROR , exc , pValue , pClass . getName ( ) ) ; } return null ; } } } else { if ( pLogger . isLoggingError ( ) ) { pLogger . logError ( Constants . COERCE_TO_OBJECT , pValue . getClass ( ) . getName ( ) , pClass . getName ( ) ) ; } return null ; } } | Coerces a value to the specified Class that is not covered by any of the above cases |
12,160 | public static boolean isFloatingPointType ( Class pClass ) { return pClass == Float . class || pClass == Float . TYPE || pClass == Double . class || pClass == Double . TYPE ; } | Returns true if the given class is of a floating point type |
12,161 | public static boolean isFloatingPointString ( Object pObject ) { if ( pObject instanceof String ) { String str = ( String ) pObject ; int len = str . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { char ch = str . charAt ( i ) ; if ( ch == '.' || ch == 'e' || ch == 'E' ) { return true ; } } return false ; } else { return false ; } } | Returns true if the given string might contain a floating point number - i . e . it contains . e or E |
12,162 | public static boolean isIntegerType ( Class pClass ) { return pClass == Byte . class || pClass == Byte . TYPE || pClass == Short . class || pClass == Short . TYPE || pClass == Character . class || pClass == Character . TYPE || pClass == Integer . class || pClass == Integer . TYPE || pClass == Long . class || pClass == Long . TYPE ; } | Returns true if the given class is of an integer type |
12,163 | public List < UploadFile > getFilesSaveToDatePath ( Integer maxPostSize , String encoding ) { return super . getFiles ( UploadPathKit . getDatePath ( ) , maxPostSize , encoding ) ; } | Get upload file save to date path . |
12,164 | public BigInteger getParaToBigInteger ( String name , BigInteger defaultValue ) { return this . toBigInteger ( getPara ( name ) , defaultValue ) ; } | Returns the value of a request parameter and convert to BigInteger with a default value if it is null . |
12,165 | public Object resolveVariable ( String pName , Object pContext ) throws ELException { PageContext ctx = ( PageContext ) pContext ; if ( "pageContext" . equals ( pName ) ) { return ctx ; } else if ( "pageScope" . equals ( pName ) ) { return ImplicitObjects . getImplicitObjects ( ctx ) . getPageScopeMap ( ) ; } else if ( "requestScope" . equals ( pName ) ) { return ImplicitObjects . getImplicitObjects ( ctx ) . getRequestScopeMap ( ) ; } else if ( "sessionScope" . equals ( pName ) ) { return ImplicitObjects . getImplicitObjects ( ctx ) . getSessionScopeMap ( ) ; } else if ( "applicationScope" . equals ( pName ) ) { return ImplicitObjects . getImplicitObjects ( ctx ) . getApplicationScopeMap ( ) ; } else if ( "param" . equals ( pName ) ) { return ImplicitObjects . getImplicitObjects ( ctx ) . getParamMap ( ) ; } else if ( "paramValues" . equals ( pName ) ) { return ImplicitObjects . getImplicitObjects ( ctx ) . getParamsMap ( ) ; } else if ( "header" . equals ( pName ) ) { return ImplicitObjects . getImplicitObjects ( ctx ) . getHeaderMap ( ) ; } else if ( "headerValues" . equals ( pName ) ) { return ImplicitObjects . getImplicitObjects ( ctx ) . getHeadersMap ( ) ; } else if ( "initParam" . equals ( pName ) ) { return ImplicitObjects . getImplicitObjects ( ctx ) . getInitParamMap ( ) ; } else if ( "cookie" . equals ( pName ) ) { return ImplicitObjects . getImplicitObjects ( ctx ) . getCookieMap ( ) ; } else { return ctx . findAttribute ( pName ) ; } } | Resolves the specified variable within the given context . Returns null if the variable is not found . |
12,166 | public List getSteps ( ) { List l ; if ( next != null ) l = next . getSteps ( ) ; else l = new Vector ( ) ; l . add ( 0 , step ) ; return l ; } | inherit JavaDoc comment |
12,167 | public static String marshal ( Object jaxbElement ) { StringWriter sw ; try { Marshaller fm = JAXBContext . newInstance ( jaxbElement . getClass ( ) ) . createMarshaller ( ) ; fm . setProperty ( Marshaller . JAXB_FORMATTED_OUTPUT , true ) ; sw = new StringWriter ( ) ; fm . marshal ( jaxbElement , sw ) ; } catch ( JAXBException e ) { throw new RuntimeException ( e ) ; } return sw . toString ( ) ; } | object - > string |
12,168 | public void setInitParameters ( Map < java . lang . String , java . lang . Object > initParms ) { super . setInitParameters ( initParms ) ; String declarationsParm = ( String ) initParms . get ( "allowDeclarations" ) ; String scriptletsParm = ( String ) initParms . get ( "allowScriptlets" ) ; String expressionsParm = ( String ) initParms . get ( "allowExpressions" ) ; String rtExpressionsParm = ( String ) initParms . get ( "allowRTExpressions" ) ; allowDeclarations = "true" . equalsIgnoreCase ( declarationsParm ) ; allowScriptlets = "true" . equalsIgnoreCase ( scriptletsParm ) ; allowExpressions = "true" . equalsIgnoreCase ( expressionsParm ) ; allowRTExpressions = "true" . equalsIgnoreCase ( rtExpressionsParm ) ; } | Sets the values of the initialization parameters as supplied in the TLD . |
12,169 | public ValidationMessage [ ] validate ( String prefix , String uri , PageData page ) { try { MyContentHandler handler = new MyContentHandler ( ) ; parser . parse ( page , handler ) ; return handler . reportResults ( ) ; } catch ( ParserConfigurationException e ) { return vmFromString ( e . toString ( ) ) ; } catch ( SAXException e ) { return vmFromString ( e . toString ( ) ) ; } catch ( IOException e ) { return vmFromString ( e . toString ( ) ) ; } } | Validates a single JSP page . |
12,170 | public boolean apply ( String pLeft , String pRight , Logger pLogger ) { return pLeft . compareTo ( pRight ) <= 0 ; } | Applies the operator to the given String values |
12,171 | @ Before ( "@within(org.audit4j.core.annotation.Audit) || @annotation(org.audit4j.core.annotation.Audit)" ) public void audit ( final JoinPoint jointPoint ) throws Throwable { MethodSignature methodSignature = ( MethodSignature ) jointPoint . getSignature ( ) ; Method method = methodSignature . getMethod ( ) ; if ( method . getDeclaringClass ( ) . isInterface ( ) ) { try { method = jointPoint . getTarget ( ) . getClass ( ) . getDeclaredMethod ( jointPoint . getSignature ( ) . getName ( ) , method . getParameterTypes ( ) ) ; } catch ( final SecurityException exception ) { throw new Audit4jRuntimeException ( "Exception occured while proceding Audit Aspect in Audit4j Spring Integration" , exception ) ; } catch ( final NoSuchMethodException exception ) { throw new Audit4jRuntimeException ( "Exception occured while proceding Audit Aspect in Audit4j Spring Integration" , exception ) ; } } AuditManager . getInstance ( ) . audit ( jointPoint . getTarget ( ) . getClass ( ) , method , jointPoint . getArgs ( ) ) ; } | Audit Aspect . |
12,172 | final public Expression ValuePrefix ( ) throws ParseException { Expression ret ; switch ( ( jj_ntk == - 1 ) ? jj_ntk ( ) : jj_ntk ) { case INTEGER_LITERAL : case FLOATING_POINT_LITERAL : case STRING_LITERAL : case TRUE : case FALSE : case NULL : ret = Literal ( ) ; break ; case LPAREN : jj_consume_token ( LPAREN ) ; ret = Expression ( ) ; jj_consume_token ( RPAREN ) ; break ; default : jj_la1 [ 27 ] = jj_gen ; if ( jj_2_1 ( 2147483647 ) ) { ret = FunctionInvocation ( ) ; } else { switch ( ( jj_ntk == - 1 ) ? jj_ntk ( ) : jj_ntk ) { case IDENTIFIER : ret = NamedValue ( ) ; break ; default : jj_la1 [ 28 ] = jj_gen ; jj_consume_token ( - 1 ) ; throw new ParseException ( ) ; } } } { if ( true ) return ret ; } throw new Error ( "Missing return statement in function" ) ; } | This is an element that can start a value |
12,173 | public Object evaluate ( String pExpressionString , Object pContext , Class pExpectedType , Map functions , String defaultPrefix ) throws ELException { return evaluate ( pExpressionString , pContext , pExpectedType , functions , defaultPrefix , sLogger ) ; } | Evaluates the given expression String |
12,174 | Object evaluate ( String pExpressionString , Object pContext , Class pExpectedType , Map functions , String defaultPrefix , Logger pLogger ) throws ELException { if ( pExpressionString == null ) { throw new ELException ( Constants . NULL_EXPRESSION_STRING ) ; } pageContext = ( PageContext ) pContext ; Object parsedValue = parseExpressionString ( pExpressionString ) ; if ( parsedValue instanceof String ) { String strValue = ( String ) parsedValue ; return convertStaticValueToExpectedType ( strValue , pExpectedType , pLogger ) ; } else if ( parsedValue instanceof Expression ) { Object value = ( ( Expression ) parsedValue ) . evaluate ( pContext , mResolver , functions , defaultPrefix , pLogger ) ; return convertToExpectedType ( value , pExpectedType , pLogger ) ; } else if ( parsedValue instanceof ExpressionString ) { String strValue = ( ( ExpressionString ) parsedValue ) . evaluate ( pContext , mResolver , functions , defaultPrefix , pLogger ) ; return convertToExpectedType ( strValue , pExpectedType , pLogger ) ; } else { return null ; } } | Evaluates the given expression string |
12,175 | Object convertToExpectedType ( Object pValue , Class pExpectedType , Logger pLogger ) throws ELException { return Coercions . coerce ( pValue , pExpectedType , pLogger ) ; } | Converts the given value to the specified expected type . |
12,176 | Object convertStaticValueToExpectedType ( String pValue , Class pExpectedType , Logger pLogger ) throws ELException { if ( pExpectedType == String . class || pExpectedType == Object . class ) { return pValue ; } Map valueByString = getOrCreateExpectedTypeMap ( pExpectedType ) ; if ( ! mBypassCache && valueByString . containsKey ( pValue ) ) { return valueByString . get ( pValue ) ; } else { Object ret = Coercions . coerce ( pValue , pExpectedType , pLogger ) ; valueByString . put ( pValue , ret ) ; return ret ; } } | Converts the given String specified as a static expression string to the given expected type . The conversion is cached . |
12,177 | static Map getOrCreateExpectedTypeMap ( Class pExpectedType ) { synchronized ( sCachedExpectedTypes ) { Map ret = ( Map ) sCachedExpectedTypes . get ( pExpectedType ) ; if ( ret == null ) { ret = Collections . synchronizedMap ( new HashMap ( ) ) ; sCachedExpectedTypes . put ( pExpectedType , ret ) ; } return ret ; } } | Creates or returns the Map that maps string literals to parsed values for the specified expected type . |
12,178 | private synchronized void createExpressionStringMap ( ) { if ( sCachedExpressionStrings != null ) { return ; } final int maxSize ; if ( ( pageContext != null ) && ( pageContext . getServletContext ( ) != null ) ) { String value = pageContext . getServletContext ( ) . getInitParameter ( EXPR_CACHE_PARAM ) ; if ( value != null ) { maxSize = Integer . valueOf ( value ) ; } else { maxSize = MAX_SIZE ; } } else { maxSize = MAX_SIZE ; } sCachedExpressionStrings = Collections . synchronizedMap ( new LinkedHashMap ( ) { protected boolean removeEldestEntry ( Map . Entry eldest ) { return size ( ) > maxSize ; } } ) ; } | Creates LRU map of expression strings . If context parameter specifying cache size is present use that as the maximum size of the LRU map otherwise use default . |
12,179 | static String formatParseException ( String pExpressionString , ParseException pExc ) { StringBuffer expectedBuf = new StringBuffer ( ) ; int maxSize = 0 ; boolean printedOne = false ; if ( pExc . expectedTokenSequences == null ) { return pExc . toString ( ) ; } for ( int i = 0 ; i < pExc . expectedTokenSequences . length ; i ++ ) { if ( maxSize < pExc . expectedTokenSequences [ i ] . length ) { maxSize = pExc . expectedTokenSequences [ i ] . length ; } for ( int j = 0 ; j < pExc . expectedTokenSequences [ i ] . length ; j ++ ) { if ( printedOne ) { expectedBuf . append ( ", " ) ; } expectedBuf . append ( pExc . tokenImage [ pExc . expectedTokenSequences [ i ] [ j ] ] ) ; printedOne = true ; } } String expected = expectedBuf . toString ( ) ; StringBuffer encounteredBuf = new StringBuffer ( ) ; Token tok = pExc . currentToken . next ; for ( int i = 0 ; i < maxSize ; i ++ ) { if ( i != 0 ) { encounteredBuf . append ( " " ) ; } if ( tok . kind == 0 ) { encounteredBuf . append ( pExc . tokenImage [ 0 ] ) ; break ; } encounteredBuf . append ( addEscapes ( tok . image ) ) ; tok = tok . next ; } String encountered = encounteredBuf . toString ( ) ; return MessageFormat . format ( Constants . PARSE_EXCEPTION , new Object [ ] { expected , encountered , } ) ; } | Formats a ParseException into an error message suitable for displaying on a web page |
12,180 | public String parseAndRender ( String pExpressionString ) throws ELException { Object val = parseExpressionString ( pExpressionString ) ; if ( val instanceof String ) { return ( String ) val ; } else if ( val instanceof Expression ) { return "${" + ( ( Expression ) val ) . getExpressionString ( ) + "}" ; } else if ( val instanceof ExpressionString ) { return ( ( ExpressionString ) val ) . getExpressionString ( ) ; } else { return "" ; } } | Parses the given expression string then converts it back to a String in its canonical form . This is used to test parsing . |
12,181 | Source getSourceFromXmlAttribute ( ) throws JspTagException , SAXException , ParserConfigurationException { Object xml = this . xml ; if ( xml == null ) { throw new JspTagException ( Resources . getMessage ( "TRANSFORM_XML_IS_NULL" ) ) ; } if ( xml instanceof List ) { List < ? > list = ( List < ? > ) xml ; if ( list . size ( ) != 1 ) { throw new JspTagException ( Resources . getMessage ( "TRANSFORM_XML_LIST_SIZE" ) ) ; } xml = list . get ( 0 ) ; } if ( xml instanceof Source ) { return ( Source ) xml ; } if ( xml instanceof String ) { String s = ( String ) xml ; s = s . trim ( ) ; if ( s . length ( ) == 0 ) { throw new JspTagException ( Resources . getMessage ( "TRANSFORM_XML_IS_EMPTY" ) ) ; } return XmlUtil . newSAXSource ( new StringReader ( s ) , xmlSystemId , entityResolver ) ; } if ( xml instanceof Reader ) { return XmlUtil . newSAXSource ( ( Reader ) xml , xmlSystemId , entityResolver ) ; } if ( xml instanceof Node ) { return new DOMSource ( ( Node ) xml , xmlSystemId ) ; } throw new JspTagException ( Resources . getMessage ( "TRANSFORM_XML_UNSUPPORTED_TYPE" , xml . getClass ( ) ) ) ; } | Return the Source for a document specified in the doc or xml attribute . |
12,182 | Source getSourceFromBodyContent ( ) throws JspTagException , SAXException , ParserConfigurationException { if ( bodyContent == null ) { throw new JspTagException ( Resources . getMessage ( "TRANSFORM_BODY_IS_NULL" ) ) ; } String s = bodyContent . getString ( ) ; if ( s == null ) { throw new JspTagException ( Resources . getMessage ( "TRANSFORM_BODY_CONTENT_IS_NULL" ) ) ; } s = s . trim ( ) ; if ( s . length ( ) == 0 ) { throw new JspTagException ( Resources . getMessage ( "TRANSFORM_BODY_IS_EMPTY" ) ) ; } return XmlUtil . newSAXSource ( new StringReader ( s ) , xmlSystemId , entityResolver ) ; } | Return the Source for a document specified as body content . |
12,183 | public String validate ( String pAttributeName , String pAttributeValue ) { try { sEvaluator . setBypassCache ( true ) ; sEvaluator . parseExpressionString ( pAttributeValue ) ; sEvaluator . setBypassCache ( false ) ; return null ; } catch ( ELException exc ) { return MessageFormat . format ( Constants . ATTRIBUTE_PARSE_EXCEPTION , "" + pAttributeName , "" + pAttributeValue , exc . getMessage ( ) ) ; } } | Translation time validation of an attribute value . This method will return a null String if the attribute value is valid ; otherwise an error message . |
12,184 | public Object evaluate ( String pAttributeName , String pAttributeValue , Class pExpectedType , Tag pTag , PageContext pPageContext , Map functions , String defaultPrefix ) throws JspException { try { return sEvaluator . evaluate ( pAttributeValue , pPageContext , pExpectedType , functions , defaultPrefix ) ; } catch ( ELException exc ) { throw new JspException ( MessageFormat . format ( Constants . ATTRIBUTE_EVALUATION_EXCEPTION , "" + pAttributeName , "" + pAttributeValue , exc . getMessage ( ) , exc . getRootCause ( ) ) , exc . getRootCause ( ) ) ; } } | Evaluates the expression at request time |
12,185 | public Object evaluate ( String pAttributeName , String pAttributeValue , Class pExpectedType , Tag pTag , PageContext pPageContext ) throws JspException { return evaluate ( pAttributeName , pAttributeValue , pExpectedType , pTag , pPageContext , null , null ) ; } | Conduit to old - style call for convenience . |
12,186 | public static String parseAndRender ( String pAttributeValue ) throws JspException { try { return sEvaluator . parseAndRender ( pAttributeValue ) ; } catch ( ELException exc ) { throw new JspException ( MessageFormat . format ( Constants . ATTRIBUTE_PARSE_EXCEPTION , "test" , "" + pAttributeValue , exc . getMessage ( ) ) ) ; } } | Parses the given attribute value then converts it back to a String in its canonical form . |
12,187 | public VariableInfo [ ] getVariableInfo ( TagData data ) { VariableInfo id = new VariableInfo ( data . getAttributeString ( "id" ) , data . getAttributeString ( "type" ) == null ? "java.lang.Object" : data . getAttributeString ( "type" ) , true , VariableInfo . AT_END ) ; return new VariableInfo [ ] { id } ; } | purposely inherit JavaDoc and semantics from TagExtraInfo |
12,188 | public void setScope ( String scopeName ) { if ( "page" . equals ( scopeName ) ) { scope = PageContext . PAGE_SCOPE ; } else if ( "request" . equals ( scopeName ) ) { scope = PageContext . REQUEST_SCOPE ; } else if ( "session" . equals ( scopeName ) ) { scope = PageContext . SESSION_SCOPE ; } else if ( "application" . equals ( scopeName ) ) { scope = PageContext . APPLICATION_SCOPE ; } } | Setter method for the scope of the variable to hold the result . |
12,189 | public void afterPropertiesSet ( ) throws Exception { Configuration configuration = Configuration . INSTANCE ; configuration . setLayout ( layout ) ; configuration . setHandlers ( handlers ) ; configuration . setFilters ( filters ) ; configuration . setCommands ( commands ) ; configuration . setJmx ( jmx ) ; configuration . setProperties ( properties ) ; if ( metaData == null ) { if ( actorSessionAttributeName == null ) { configuration . setMetaData ( new SpringSecurityWebAuditMetaData ( ) ) ; } else { configuration . setMetaData ( new WebSessionAuditMetaData ( ) ) ; } } else { configuration . setMetaData ( metaData ) ; } if ( annotationTransformer != null ) { configuration . setAnnotationTransformer ( annotationTransformer ) ; } AuditManager . startWithConfiguration ( configuration ) ; } | Initialize audit4j when starting spring application context . |
12,190 | public static String escape ( String src ) { int length = 0 ; for ( int i = 0 ; i < src . length ( ) ; i ++ ) { char c = src . charAt ( i ) ; String escape = getEscape ( c ) ; if ( escape != null ) { length += escape . length ( ) ; } else { length += 1 ; } } if ( length == src . length ( ) ) { return src ; } StringBuilder buf = new StringBuilder ( length ) ; for ( int i = 0 ; i < src . length ( ) ; i ++ ) { char c = src . charAt ( i ) ; String escape = getEscape ( c ) ; if ( escape != null ) { buf . append ( escape ) ; } else { buf . append ( c ) ; } } return buf . toString ( ) ; } | Escape a string . |
12,191 | public static void emit ( Object src , boolean escapeXml , JspWriter out ) throws IOException { if ( src instanceof Reader ) { emit ( ( Reader ) src , escapeXml , out ) ; } else { emit ( String . valueOf ( src ) , escapeXml , out ) ; } } | Emit the supplied object to the specified writer escaping characters if needed . |
12,192 | public static void emit ( String src , boolean escapeXml , JspWriter out ) throws IOException { if ( escapeXml ) { emit ( src , out ) ; } else { out . write ( src ) ; } } | Emit the supplied String to the specified writer escaping characters if needed . |
12,193 | public static void emit ( Reader src , boolean escapeXml , JspWriter out ) throws IOException { int bufferSize = out . getBufferSize ( ) ; if ( bufferSize == 0 ) { bufferSize = 4096 ; } char [ ] buffer = new char [ bufferSize ] ; int count ; while ( ( count = src . read ( buffer ) ) > 0 ) { if ( escapeXml ) { emit ( buffer , 0 , count , out ) ; } else { out . write ( buffer , 0 , count ) ; } } } | Copy the content of a Reader into the specified JSPWriter escaping characters if needed . |
12,194 | public void addSQLParameter ( Object o ) { if ( parameters == null ) { parameters = new ArrayList ( ) ; } parameters . add ( o ) ; } | Called by nested parameter elements to add PreparedStatement parameter values . |
12,195 | public Object evaluate ( Object pContext , VariableResolver pResolver , Map functions , String defaultPrefix , Logger pLogger ) throws ELException { Object ret = mPrefix . evaluate ( pContext , pResolver , functions , defaultPrefix , pLogger ) ; for ( int i = 0 ; mSuffixes != null && i < mSuffixes . size ( ) ; i ++ ) { ValueSuffix suffix = ( ValueSuffix ) mSuffixes . get ( i ) ; ret = suffix . evaluate ( ret , pContext , pResolver , functions , defaultPrefix , pLogger ) ; } return ret ; } | Evaluates by evaluating the prefix then applying the suffixes |
12,196 | public void configInterceptor ( Interceptors me ) { me . add ( new ExceptionInterceptor ( ) ) ; if ( this . getHttpPostMethod ( ) ) { me . add ( new POST ( ) ) ; } configMoreInterceptors ( me ) ; } | Config interceptor applied to all actions . |
12,197 | public int doStartTag ( ) throws JspException { try { XPathContext context = XalanUtil . getContext ( this , pageContext ) ; String result = select . execute ( context , context . getCurrentNode ( ) , null ) . str ( ) ; EscapeXML . emit ( result , escapeXml , pageContext . getOut ( ) ) ; return SKIP_BODY ; } catch ( IOException ex ) { throw new JspTagException ( ex . toString ( ) , ex ) ; } catch ( TransformerException e ) { throw new JspTagException ( e ) ; } } | applies XPath expression from select and prints the result |
12,198 | public static ImplicitObjects getImplicitObjects ( PageContext pContext ) { ImplicitObjects objs = ( ImplicitObjects ) pContext . getAttribute ( sAttributeName , PageContext . PAGE_SCOPE ) ; if ( objs == null ) { objs = new ImplicitObjects ( pContext ) ; pContext . setAttribute ( sAttributeName , objs , PageContext . PAGE_SCOPE ) ; } return objs ; } | Finds the ImplicitObjects associated with the PageContext creating it if it doesn t yet exist . |
12,199 | public static Map createSessionScopeMap ( PageContext pContext ) { final PageContext context = pContext ; return new EnumeratedMap ( ) { public Enumeration enumerateKeys ( ) { return context . getAttributeNamesInScope ( PageContext . SESSION_SCOPE ) ; } public Object getValue ( Object pKey ) { if ( pKey instanceof String ) { return context . getAttribute ( ( String ) pKey , PageContext . SESSION_SCOPE ) ; } else { return null ; } } public boolean isMutable ( ) { return true ; } } ; } | Creates the Map that wraps session - scoped attributes |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.