idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
12,300 | public synchronized boolean hasNext ( ) { while ( nexting ) { if ( logger . isInfoEnabled ( ) ) { logger . info ( "[" + this + "] Waiting for another thread to pull item..." ) ; } try { wait ( 150L ) ; } catch ( InterruptedException e ) { } } if ( loadException != null ) { throw new JiteratorLoadException ( loadException ) ; } nexting = true ; try { if ( waiting == null ) { return false ; } if ( ! waiting . isEmpty ( ) ) { return true ; } waitForPush ( ) ; if ( loadException != null ) { throw new JiteratorLoadException ( loadException ) ; } return ( waiting != null && ! waiting . isEmpty ( ) ) ; } finally { nexting = false ; notifyAll ( ) ; } } | Checks to see if there are more elements to be processed in the jiterator . If this method is called prior to the jiterator being loaded with an item it will hang until either an item is added into the jiterator or the jiterator is marked as complete . |
12,301 | public synchronized T next ( ) throws JiteratorLoadException { while ( nexting ) { if ( logger . isInfoEnabled ( ) ) { logger . info ( "[" + this + "] Waiting for another thread to pull item..." ) ; } try { wait ( 150L ) ; } catch ( InterruptedException e ) { } } if ( loadException != null ) { throw new JiteratorLoadException ( loadException ) ; } nexting = true ; try { T t ; if ( waiting == null ) { throw new NoSuchElementException ( "Invalid attempt to get another element from empty iterator." ) ; } if ( ! waiting . isEmpty ( ) ) { t = waiting . get ( 0 ) ; waiting . remove ( 0 ) ; if ( waiting . isEmpty ( ) && loaded ) { waiting = null ; } return t ; } waitForPush ( ) ; if ( loadException != null ) { throw new JiteratorLoadException ( loadException ) ; } if ( waiting == null || waiting . isEmpty ( ) ) { throw new NoSuchElementException ( "Invalid attempt to get another element from empty iterator." ) ; } t = waiting . get ( 0 ) ; waiting . remove ( 0 ) ; if ( waiting . isEmpty ( ) && loaded ) { waiting = null ; } return t ; } finally { nexting = false ; notifyAll ( ) ; } } | Provides the next element in the jiterator . If this method is called prior to the jiterator being loaded with an item it will hang until either an item is added into the jiterator or the jiterator is marked as complete . |
12,302 | private synchronized void waitForPush ( ) { long waitStart = - 1L ; while ( waiting != null && waiting . isEmpty ( ) && ! loaded ) { long untouched = System . currentTimeMillis ( ) - lastTouch ; if ( untouched > timeout . longValue ( ) ) { logger . error ( "[" + this + "] Jiterator timeout for " + getName ( ) ) ; setLoadException ( new TimeoutException ( "Jiterator " + getName ( ) + " timed out while loading" ) ) ; } if ( waitStart == - 1L ) { waitStart = System . currentTimeMillis ( ) ; } else { if ( ( System . currentTimeMillis ( ) - waitStart ) > CalendarWrapper . MINUTE ) { if ( ( System . currentTimeMillis ( ) - scream ) > CalendarWrapper . MINUTE ) { scream = System . currentTimeMillis ( ) ; logger . warn ( "[" + this + "] " + ( ( System . currentTimeMillis ( ) - lastTouch ) / 1000 ) + " seconds since last touch." ) ; } } } long multiplier = ( untouched / ( 15 * CalendarWrapper . SECOND ) ) + 1 ; try { wait ( 150L * multiplier ) ; } catch ( InterruptedException ignore ) { } } } | Waits for a new item to be put into the jiterator or for the jiterator to be marked empty . |
12,303 | public ConnectionParams copy ( ) { ConnectionParams copy = new ConnectionParams ( host , username , password , schema ) ; return copy ; } | Constructs a new object that copies the fields from this instance . |
12,304 | static public DataTypeFactory < ? > getInstance ( String tname ) { DataTypeFactory < ? > factory = factories . get ( tname ) ; if ( factory == null ) { throw new InvalidAttributeException ( "Unknown type name: " + tname ) ; } return factory ; } | Provides access to the data type factory associated with the specified type name . |
12,305 | static public Collection < DataTypeFactory < ? > > getTypes ( ) { ArrayList < DataTypeFactory < ? > > list = new ArrayList < DataTypeFactory < ? > > ( ) ; for ( Map . Entry < String , DataTypeFactory < ? > > entry : factories . entrySet ( ) ) { list . add ( entry . getValue ( ) ) ; } return list ; } | Lists all types known to the system . |
12,306 | public String getDisplayValue ( Locale loc , Object ob ) { if ( ob == null ) { return "" ; } if ( ob instanceof Translator ) { @ SuppressWarnings ( "rawtypes" ) Translation trans = ( ( Translator ) ob ) . get ( loc ) ; if ( trans == null ) { return null ; } return getDisplayValue ( trans . getData ( ) ) ; } else { return getDisplayValue ( ob ) ; } } | Provides a display version of the specified value translated for the target locale . |
12,307 | private String removeBlocks ( String originalSql ) { StringBuilder cleanedSql = new StringBuilder ( originalSql . length ( ) ) ; Pattern regexPattern = null ; Matcher regexMatcher = null ; regexPattern = Pattern . compile ( getRegexSkipBlockSearch ( ) , Pattern . CASE_INSENSITIVE ) ; regexMatcher = regexPattern . matcher ( originalSql + "\n" ) ; int prevBlockEnd = 0 ; int blockStart = 0 ; int blockEnd = 0 ; String block = null ; while ( regexMatcher . find ( ) == true ) { blockStart = regexMatcher . start ( ) ; blockEnd = Math . min ( originalSql . length ( ) , regexMatcher . end ( ) ) ; block = originalSql . substring ( blockStart , blockEnd ) ; cleanedSql . append ( originalSql . substring ( prevBlockEnd , blockStart ) ) ; prevBlockEnd = blockEnd ; cleanedSql . append ( fill ( FILL_SYMBOL , block . length ( ) ) ) ; } cleanedSql . append ( originalSql . substring ( prevBlockEnd , originalSql . length ( ) ) ) ; return cleanedSql . toString ( ) ; } | Removes blocks - such as comments and other possible blocks |
12,308 | private String fill ( char symbol , int times ) { char [ ] result = new char [ times ] ; for ( int i = 0 ; i < times ; i ++ ) { result [ i ] = symbol ; } return new String ( result ) ; } | Returns string of specified length filled with specified symbol |
12,309 | private void putProcessedInputToCache ( ProcessedInput processedInput ) { if ( MjdbcConfig . isQueryInputProcessorUseCache ( ) == true ) { ProcessedInput clonedProcessedInput = new ProcessedInput ( processedInput ) ; synchronized ( this . processedInputCache ) { clonedProcessedInput . setSqlParameterValues ( null ) ; this . processedInputCache . put ( processedInput . getOriginalSql ( ) , clonedProcessedInput ) ; } } } | Puts ProcessedInput instance into Cache . Original SQL would be served as key |
12,310 | public static Object convertArray ( Connection conn , Object [ ] array ) throws SQLException { Object result = null ; result = createArrayOf ( conn , convertJavaClassToSqlType ( array . getClass ( ) . getComponentType ( ) . getSimpleName ( ) ) , array ) ; return result ; } | Converts array of Object into sql . Array |
12,311 | public static Object convertArray ( Connection conn , Collection < ? > array ) throws SQLException { return convertArray ( conn , array . toArray ( ) ) ; } | Converts Collection into sql . Array |
12,312 | public static Object convertClob ( Object clob , String value ) throws SQLException { return convertClob ( clob , value . getBytes ( ) ) ; } | Transfers data from String into sql . Clob |
12,313 | public static String convertJavaClassToSqlType ( String simpleClassName ) throws SQLException { if ( "String" . equals ( simpleClassName ) == true ) { return "VARCHAR" ; } throw new SQLException ( String . format ( "Could not convert java class %s" , simpleClassName ) ) ; } | Converts Java Class name into SQL Type name |
12,314 | public static byte [ ] toByteArray ( InputStream input ) throws SQLException { byte [ ] result = null ; ByteArrayOutputStream output = new ByteArrayOutputStream ( ) ; try { copy ( input , output ) ; result = output . toByteArray ( ) ; } catch ( IOException ex ) { throw new MjdbcSQLException ( ex ) ; } TypeHandlerUtils . closeQuietly ( output ) ; return result ; } | Transfers data from InputStream into byte array |
12,315 | public static boolean isJDBC3 ( Overrider overrider ) { boolean result = false ; if ( overrider . hasOverride ( MjdbcConstants . OVERRIDE_INT_JDBC3 ) == true ) { result = ( Boolean ) overrider . getOverride ( MjdbcConstants . OVERRIDE_INT_JDBC3 ) ; } return result ; } | Returns if JDBC3 driver is used . Actual check is done during QueryRunner instance initialization . |
12,316 | private static long copy ( Reader input , StringBuilder output , char [ ] buffer ) throws IOException { long bytesTransferred = 0 ; int bytesRead = 0 ; while ( EOF != ( bytesRead = input . read ( buffer ) ) ) { output . append ( buffer , 0 , bytesRead ) ; bytesTransferred += bytesRead ; } return bytesTransferred ; } | Transfers data from Reader into StringBuilder |
12,317 | public OAuth2StoreBuilder addAdditionalParameter ( String key , String value ) { oAuth2Store . getAdditionalParameters ( ) . put ( key , value ) ; return this ; } | Add an additional parameter which will be included in the token request |
12,318 | private ProcessedInput getProcessedInputsFromCache ( String originalSql ) { ProcessedInput processedInput = null ; synchronized ( this . processedInputCache ) { processedInput = this . processedInputCache . get ( originalSql ) ; if ( processedInput == null || MjdbcConfig . isQueryInputProcessorUseCache ( ) == false ) { processedInput = new ProcessedInput ( originalSql ) ; } else { processedInput = new ProcessedInput ( processedInput ) ; } return processedInput ; } } | Searches cache by original SQL as key and returned cached ProcessedInput instance |
12,319 | public Checkbox setChecked ( boolean checked ) { if ( checked ) { String valueEnabledString = this . getEnabledValueString ( ) ; this . setValue ( valueEnabledString ) ; } else { this . setValue ( "" ) ; } return this ; } | Checks or unchecks this checkbox element . |
12,320 | public < T extends AbstractJsonMapping > T getResponse ( Class < T > clazz , Map < String , String > properties ) throws RottenTomatoesException { String url = ApiBuilder . create ( properties ) ; try { T wrapper = clazz . cast ( MAPPER . readValue ( getContent ( url ) , clazz ) ) ; int retry = 1 ; while ( ! wrapper . isValid ( ) && "Account Over Queries Per Second Limit" . equalsIgnoreCase ( wrapper . getError ( ) ) && retry <= retryLimit ) { LOG . trace ( "Account over queries limit, waiting for {}ms." , retryDelay * retry ) ; sleeper ( retry ++ ) ; wrapper = MAPPER . readValue ( getContent ( url ) , clazz ) ; } if ( wrapper . isValid ( ) ) { return wrapper ; } else { throw new RottenTomatoesException ( ApiExceptionType . MAPPING_FAILED , wrapper . getError ( ) , url ) ; } } catch ( IOException ex ) { throw new RottenTomatoesException ( ApiExceptionType . MAPPING_FAILED , "Failed to map response" , url , ex ) ; } } | Get the wrapper for the passed properties |
12,321 | private String getContent ( String url ) throws RottenTomatoesException { LOG . trace ( "Requesting: {}" , url ) ; try { final HttpGet httpGet = new HttpGet ( url ) ; httpGet . addHeader ( "accept" , "application/json" ) ; final DigestedResponse response = DigestedResponseReader . requestContent ( httpClient , httpGet , charset ) ; if ( response . getStatusCode ( ) >= HTTP_STATUS_500 ) { throw new RottenTomatoesException ( ApiExceptionType . HTTP_503_ERROR , response . getContent ( ) , response . getStatusCode ( ) , url ) ; } else if ( response . getStatusCode ( ) >= HTTP_STATUS_300 ) { throw new RottenTomatoesException ( ApiExceptionType . HTTP_404_ERROR , response . getContent ( ) , response . getStatusCode ( ) , url ) ; } return response . getContent ( ) ; } catch ( IOException ex ) { throw new RottenTomatoesException ( ApiExceptionType . CONNECTION_ERROR , "Error retrieving URL" , url , ex ) ; } } | Get the content from a string decoding it if it is in GZIP format |
12,322 | private void sleeper ( int count ) { try { Thread . sleep ( retryDelay * ( long ) count ) ; } catch ( InterruptedException ex ) { LOG . trace ( "Sleep interrupted" , ex ) ; } } | Sleep for a short period |
12,323 | public < T > DefaultOverride < T > override ( final T proxiedMethodCall ) { final MethodIdProxyFactory . MethodAndScope lastProxyMethodAndScope = MethodIdProxyFactory . getLastIdentifiedMethodAndScope ( ) ; if ( lastProxyMethodAndScope == null ) { throw new ConfigException ( "Failed to identify config method previous to calling overrideDefault" ) ; } if ( ! lastProxyMethodAndScope . getScopeOpt ( ) . equals ( scopeNameOpt ) ) { throw new ConfigException ( "Identified config method is not using proxy for the same scope name. Scope expected: {}, from last proxy call: {}" , scopeNameOpt , lastProxyMethodAndScope . getScopeOpt ( ) ) ; } final ConfigDescriptor desc = ConfigSystem . descriptorFactory . buildDescriptor ( lastProxyMethodAndScope . getMethod ( ) , scopeNameOpt ) ; final PropertyIdentifier propertyId = ConfigSystem . getIdentifier ( desc ) ; return value -> { ConstantValuePropertyAccessor cvProp = ConstantValuePropertyAccessor . fromRawValue ( value ) ; OverrideModule . this . bind ( ConstantValuePropertyAccessor . class ) . annotatedWith ( propertyId ) . toInstance ( cvProp ) ; log . trace ( "Bound default override on method {}.{} scope {} to {}" , lastProxyMethodAndScope . getMethod ( ) . getDeclaringClass ( ) . getName ( ) , lastProxyMethodAndScope . getMethod ( ) . getName ( ) , scopeNameOpt , value . toString ( ) ) ; } ; } | Setup an override binding builder for a configuration interface . |
12,324 | public void addPlaceholder ( String placeholder , String value ) { placeholderMap . put ( placeholder , value ) ; } | Add a placeholder to the strategy |
12,325 | public static < K > void incrementCount ( Map < K , Integer > map , K k ) { map . put ( k , getCount ( map , k ) + 1 ) ; } | Increments the value that is stored for the given key in the given map by one or sets it to 1 if there was no value stored for the given key . |
12,326 | public static < K > Integer getCount ( Map < K , Integer > map , K k ) { Integer count = map . get ( k ) ; if ( count == null ) { count = 0 ; map . put ( k , count ) ; } return count ; } | Returns the value that is stored for the given key in the given map . If there is no value stored then 0 will be inserted into the map and returned |
12,327 | static < K , E > List < E > getList ( Map < K , List < E > > map , K k ) { List < E > list = map . get ( k ) ; if ( list == null ) { list = new ArrayList < E > ( ) ; map . put ( k , list ) ; } return list ; } | Returns the list that is stored under the given key in the given map . If there is no list stored then a new list will be created inserted and returned |
12,328 | public static < K , E > void addToList ( Map < K , List < E > > map , K k , E e ) { getList ( map , k ) . add ( e ) ; } | Adds the given element to the list that is stored under the given key . If the list does not yet exist it is created and inserted into the map . |
12,329 | static < K , E > void removeFromList ( Map < K , List < E > > map , K k , E e ) { List < E > list = map . get ( k ) ; if ( list != null ) { list . remove ( e ) ; if ( list . isEmpty ( ) ) { map . remove ( k ) ; } } } | Removes the given element from the list that is stored under the given key . If the list becomes empty it is removed from the map . |
12,330 | public static < K , V > void fillValues ( Map < K , V > map , Iterable < ? extends V > values ) { Iterator < ? extends V > iterator = values . iterator ( ) ; for ( K k : map . keySet ( ) ) { if ( ! iterator . hasNext ( ) ) { break ; } V value = iterator . next ( ) ; map . put ( k , value ) ; } } | Fill the given map sequentially with the values from the given sequence . This method will iterate over all keys of the given map and put the corresponding value element into the map . If the map is larger than the sequence then the remaining entries will remain unaffected . |
12,331 | public static < T > Map < Integer , T > fromElements ( T ... elements ) { return fromIterable ( Arrays . asList ( elements ) ) ; } | Creates a map that maps consecutive integer values to the corresponding elements in the given array . |
12,332 | public static < T > Map < Integer , T > fromIterable ( Iterable < ? extends T > iterable ) { Map < Integer , T > map = new LinkedHashMap < Integer , T > ( ) ; int i = 0 ; for ( T t : iterable ) { map . put ( i , t ) ; i ++ ; } return map ; } | Creates a map that maps consecutive integer values to the elements in the given sequence in the order in which they appear . |
12,333 | public static < K , V > Map < K , V > fromIterables ( Iterable < ? extends K > iterable0 , Iterable < ? extends V > iterable1 ) { Map < K , V > map = new LinkedHashMap < K , V > ( ) ; Iterator < ? extends K > i0 = iterable0 . iterator ( ) ; Iterator < ? extends V > i1 = iterable1 . iterator ( ) ; while ( i0 . hasNext ( ) && i1 . hasNext ( ) ) { K k = i0 . next ( ) ; V v = i1 . next ( ) ; map . put ( k , v ) ; } return map ; } | Creates a map that maps the elements of the first sequence to the corresponding elements in the second sequence . If the given sequences have different lengths then only the elements of the shorter sequence will be contained in the map . |
12,334 | public static < K , V > Map < K , V > unmodifiableCopy ( Map < ? extends K , ? extends V > map ) { return Collections . < K , V > unmodifiableMap ( new LinkedHashMap < K , V > ( map ) ) ; } | Creates an unmodifiable copy of the given map |
12,335 | public void write ( DataOutputStream dos ) throws IOException { dos . writeInt ( MAGIC_NUMBER ) ; dos . writeShort ( fileFormatVersion . getVersion ( ) ) ; } | Writes this preamble out to the specified output stream . |
12,336 | public static MethodAndScope getLastIdentifiedMethodAndScope ( ) { final MethodAndScope mas = lastIdentifiedMethodAndScope . get ( ) ; lastIdentifiedMethodAndScope . set ( null ) ; return mas ; } | Retrieves the most recently called method on any configuration impl proxy generated by this factory along with the scope of the proxy . Note that the identified method is only returned once . Subsequent calls return null until another proxy method is called and identified . |
12,337 | private static Object defaultForType ( Class < ? > type ) { if ( ! type . isPrimitive ( ) ) { return null ; } if ( type . equals ( boolean . class ) ) { return false ; } if ( type . equals ( long . class ) ) { return ( long ) 0L ; } if ( type . equals ( int . class ) ) { return ( int ) 0 ; } if ( type . equals ( short . class ) ) { return ( short ) 0 ; } if ( type . equals ( byte . class ) ) { return ( byte ) 0 ; } if ( type . equals ( char . class ) ) { return ( char ) '\u0000' ; } if ( type . equals ( float . class ) ) { return ( float ) 0.0f ; } if ( type . equals ( double . class ) ) { return ( double ) 0.0d ; } throw new IllegalStateException ( "Unknown primitive type: " + type . getName ( ) ) ; } | Provide the default value for any given type . |
12,338 | public T load ( Object ... args ) { try { T item = target . newInstance ( ) ; Map vals = ( Map ) args [ 0 ] ; load ( item , vals ) ; return item ; } catch ( InstantiationException e ) { throw new CacheManagementException ( e ) ; } catch ( IllegalAccessException e ) { throw new CacheManagementException ( e ) ; } } | Creates a new instance of the class this map loader is governing and loads it with values . |
12,339 | public void load ( T item , Map vals ) { for ( Object k : vals . keySet ( ) ) { Class cls = item . getClass ( ) ; String key = ( String ) k ; Object val = vals . get ( key ) ; Field f = null ; int mod ; while ( f == null ) { try { f = cls . getDeclaredField ( key ) ; } catch ( NoSuchFieldException e ) { } if ( f == null ) { cls = cls . getSuperclass ( ) ; if ( cls == null || cls . getName ( ) . equals ( Object . class . getName ( ) ) ) { break ; } } } if ( f == null ) { continue ; } mod = f . getModifiers ( ) ; if ( Modifier . isTransient ( mod ) || Modifier . isStatic ( mod ) ) { continue ; } try { f . setAccessible ( true ) ; f . set ( item , val ) ; } catch ( IllegalAccessException e ) { String msg = "Error setting value for " + key + ":\n" ; if ( val == null ) { msg = msg + " (null)" ; } else { msg = msg + " (" + val + ":" + val . getClass ( ) . getName ( ) + ")" ; } msg = msg + ":\n" + e . getClass ( ) . getName ( ) + ":\n" ; throw new CacheManagementException ( msg + e . getMessage ( ) ) ; } catch ( IllegalArgumentException e ) { String msg = "Error setting value for " + key ; if ( val == null ) { msg = msg + " (null)" ; } else { msg = msg + " (" + val + ":" + val . getClass ( ) . getName ( ) + ")" ; } msg = msg + ":\n" + e . getClass ( ) . getName ( ) + ":\n" ; throw new CacheManagementException ( msg + e . getMessage ( ) ) ; } } } | Loads the specified values into the specified object instance . |
12,340 | public static boolean isFunctionCall ( String decodedSql ) { Pattern regexPattern = null ; Matcher regexMatcher = null ; regexPattern = Pattern . compile ( REGEX_IS_FUNCTION , Pattern . CASE_INSENSITIVE ) ; regexMatcher = regexPattern . matcher ( decodedSql ) ; return regexMatcher . find ( ) ; } | Checks if SQL String represents function call |
12,341 | private String getProcessName ( ProcessTextProvider textProvider ) { if ( ! quotedString ( '"' , textProvider ) ) { return "P" + ( textProvider . incrementProcessCount ( ) ) ; } if ( textProvider . getLastToken ( ) . contains ( "_" ) ) { throw new ParserException ( "Process names nust not include underbar: " + textProvider . getLastToken ( ) ) ; } return textProvider . getLastToken ( ) ; } | Method getProcessName . The process name is normally enclosed in quotes but it might be omitted in which case we generate a unique one . |
12,342 | private ProcessDefinition processProcess ( ProcessTextProvider textProvider ) { int start = textProvider . getPos ( ) ; if ( ! JavaClass ( textProvider ) ) { throw new ParserException ( "Missing class name" , textProvider ) ; } textProvider . accumulate ( " " ) ; String className = textProvider . getLastToken ( ) ; textProvider . setCurrentScope ( className ) ; String processName = getProcessName ( textProvider ) ; textProvider . addTOCElement ( null , processName , start , textProvider . getPos ( ) , TYPE_PROCESS ) ; String launchForm = null ; String queueName = null ; String description = "" ; if ( quotedString ( '"' , textProvider ) ) { description = textProvider . getLastToken ( ) ; } if ( exact ( "launchForm" , textProvider ) ) { exactOrError ( "=" , textProvider ) ; if ( ! CVariable ( textProvider ) ) { throw new ParserException ( "Missing launch form name" , textProvider ) ; } launchForm = textProvider . getLastToken ( ) ; if ( exact ( "queue" , textProvider ) ) { exactOrError ( "=" , textProvider ) ; if ( ! quotedString ( '"' , textProvider ) ) { throw new ParserException ( "Missing queue name" , textProvider ) ; } queueName = textProvider . getLastToken ( ) ; if ( textProvider . getWorkflowManager ( ) . getQueue ( queueName ) == null ) { throw new ParserException ( "Missing queue definition for " + queueName , textProvider ) ; } } } ProcessDefinition ret = new ProcessDefinition ( processName , className , textProvider . getWorkflowManager ( ) , launchForm , queueName , textProvider . getPackageName ( ) , description ) ; ret . addTask ( new TaskStart ( ret ) ) ; log . debug ( ret . getName ( ) ) ; textProvider . accumulate ( "\n" ) ; processTaskList ( ret , textProvider ) ; commit ( textProvider ) ; return ret ; } | Parse the process . |
12,343 | public int register ( T component ) { if ( component == null ) { throw new IllegalArgumentException ( "Null component object passed." ) ; } if ( components . contains ( component ) ) { throw new IllegalArgumentException ( "Duplicate component registering: " + component . getId ( ) ) ; } this . components . add ( component ) ; return this . components . size ( ) - 1 ; } | Registra um novo componente nesta factory . |
12,344 | public void each ( Consumer < T > operation ) { for ( T component : components ) { operation . accept ( component ) ; } } | Executa um consumer para cada componente registrado . |
12,345 | public String toJSON ( ) { StringBuilder json = new StringBuilder ( ) ; json . append ( "[" ) ; for ( int t = 0 ; t < components . size ( ) ; t ++ ) { if ( t > 0 ) json . append ( "," ) ; T component = components . get ( t ) ; json . append ( "{" ) . append ( "\"label\":\"" ) . append ( component . getDisplayName ( ) ) . append ( "\"" ) . append ( ",\"id\":\"" ) . append ( component . getId ( ) ) . append ( "\"" ) . append ( "}" ) ; } json . append ( "]" ) ; return json . toString ( ) ; } | Serializa os componentes registrados em JSON . |
12,346 | public static String validateInput ( final String context , final String input , final String type , final int maxLength , final boolean allowNull , final boolean canonicalize ) throws ValidationException { return validator . getValidInput ( context , input , type , maxLength , allowNull , canonicalize ) ; } | Regular Expression Validation |
12,347 | public < T > void putCustom ( String key , T value ) { custom . put ( key , value ) ; } | Put a custom value into context . |
12,348 | @ SuppressWarnings ( "unchecked" ) public < T > T getCustom ( String key ) { return ( T ) custom . get ( key ) ; } | Get the custom value in context . |
12,349 | private static List < PropertyDescriptor > getPropertyDescriptorsOptional ( Class < ? > beanClass ) { BeanInfo beanInfo = getBeanInfoOptional ( beanClass ) ; if ( beanInfo == null ) { return Collections . emptyList ( ) ; } PropertyDescriptor propertyDescriptors [ ] = beanInfo . getPropertyDescriptors ( ) ; if ( propertyDescriptors == null ) { return Collections . emptyList ( ) ; } return Collections . unmodifiableList ( new ArrayList < PropertyDescriptor > ( Arrays . asList ( propertyDescriptors ) ) ) ; } | Returns an unmodifiable list containing the PropertyDescriptors of the given bean class . Returns an empty list if either the BeanInfo or the PropertyDescriptors could not be obtained . |
12,350 | public static List < String > getMutablePropertyNamesOptional ( Class < ? > beanClass ) { List < PropertyDescriptor > propertyDescriptors = getPropertyDescriptorsOptional ( beanClass ) ; List < String > result = new ArrayList < String > ( ) ; for ( PropertyDescriptor propertyDescriptor : propertyDescriptors ) { String propertyName = propertyDescriptor . getName ( ) ; Method readMethod = getReadMethodOptional ( beanClass , propertyName ) ; Method writeMethod = getWriteMethodOptional ( beanClass , propertyName ) ; if ( readMethod != null && writeMethod != null ) { result . add ( propertyName ) ; } } return Collections . unmodifiableList ( result ) ; } | Returns an unmodifiable list of all property names of the given bean class for which a read method and a write method exists . If the bean class can not be introspected an empty list will be returned . |
12,351 | public static Method getWriteMethodOptional ( Class < ? > beanClass , String propertyName ) { PropertyDescriptor propertyDescriptor = getPropertyDescriptorOptional ( beanClass , propertyName ) ; if ( propertyDescriptor == null ) { return null ; } return propertyDescriptor . getWriteMethod ( ) ; } | Returns the write method for the property with the given name in the given bean class . |
12,352 | public static Method getReadMethodOptional ( Class < ? > beanClass , String propertyName ) { PropertyDescriptor propertyDescriptor = getPropertyDescriptorOptional ( beanClass , propertyName ) ; if ( propertyDescriptor == null ) { return null ; } return propertyDescriptor . getReadMethod ( ) ; } | Returns the read method for the property with the given name in the given bean class . |
12,353 | public List < FoxHttpAuthorization > getAuthorization ( URLConnection connection , FoxHttpAuthorizationScope foxHttpAuthorizationScope , FoxHttpClient foxHttpClient ) { ArrayList < FoxHttpAuthorization > foxHttpAuthorizationList = new ArrayList < > ( ) ; for ( Map . Entry < String , ArrayList < FoxHttpAuthorization > > entry : foxHttpAuthorizations . entrySet ( ) ) { if ( RegexUtil . doesURLMatch ( foxHttpAuthorizationScope . toString ( ) , foxHttpClient . getFoxHttpPlaceholderStrategy ( ) . processPlaceholders ( entry . getKey ( ) , foxHttpClient ) ) ) { foxHttpAuthorizationList . addAll ( entry . getValue ( ) ) ; } } if ( foxHttpAuthorizations . containsKey ( FoxHttpAuthorizationScope . ANY . toString ( ) ) && ( foxHttpAuthorizationList . isEmpty ( ) ) ) { foxHttpAuthorizationList . addAll ( foxHttpAuthorizations . get ( FoxHttpAuthorizationScope . ANY . toString ( ) ) ) ; } return foxHttpAuthorizationList ; } | Returns a list of matching FoxHttpAuthorizations based on the given FoxHttpAuthorizationScope |
12,354 | public void addAuthorization ( FoxHttpAuthorizationScope foxHttpAuthorizationScope , FoxHttpAuthorization foxHttpAuthorization ) { if ( foxHttpAuthorizations . containsKey ( foxHttpAuthorizationScope . toString ( ) ) ) { foxHttpAuthorizations . get ( foxHttpAuthorizationScope . toString ( ) ) . add ( foxHttpAuthorization ) ; } else { foxHttpAuthorizations . put ( foxHttpAuthorizationScope . toString ( ) , new ArrayList < > ( Collections . singletonList ( foxHttpAuthorization ) ) ) ; } } | Add a new FoxHttpAuthorization to the AuthorizationStrategy |
12,355 | public void removeAuthorization ( FoxHttpAuthorizationScope foxHttpAuthorizationScope , FoxHttpAuthorization foxHttpAuthorization ) { ArrayList < FoxHttpAuthorization > authorizations = foxHttpAuthorizations . get ( foxHttpAuthorizationScope . toString ( ) ) ; ArrayList < FoxHttpAuthorization > cleandAuthorizations = new ArrayList < > ( ) ; for ( FoxHttpAuthorization authorization : authorizations ) { if ( authorization . getClass ( ) != foxHttpAuthorization . getClass ( ) ) { cleandAuthorizations . add ( authorization ) ; } } foxHttpAuthorizations . put ( foxHttpAuthorizationScope . toString ( ) , cleandAuthorizations ) ; } | Remove a defined FoxHttpAuthorization from the AuthorizationStrategy |
12,356 | public ServiceResult < T > setContent ( T serviceResultContent ) { content = serviceResultContent ; setHash ( ObjectHasher . hash ( content ) ) ; return this ; } | Set the content of the ServiceResult |
12,357 | public ServiceResult < T > addMetadata ( String key , Metadata metadata ) { this . getMetadata ( ) . put ( key , metadata ) ; return this ; } | Add a new set of Metadata |
12,358 | public T handle ( List < QueryParameters > outputList ) throws MjdbcException { return ( T ) this . outputProcessor . toBean ( outputList , this . type ) ; } | Converts first row of query output into Bean |
12,359 | public ArtifactResult resolveArtifact ( Artifact artifact ) throws ArtifactResolutionException { return resolveArtifact ( new ArtifactRequest ( artifact , remoteRepositories , null ) ) ; } | Resolves a single artifact and returns it . |
12,360 | public List < ArtifactResult > resolveArtifacts ( Collection < ? extends ArtifactRequest > requests ) throws ArtifactResolutionException { return repository . resolveArtifacts ( session , requests ) ; } | Resolves the paths for a collection of artifacts . Artifacts will be downloaded if necessary . Artifacts that are already resolved will be skipped and are not re - resolved . Note that this method assumes that any relocations have already been processed . |
12,361 | public List < MetadataResult > resolveMetadata ( Collection < ? extends MetadataRequest > requests ) { return repository . resolveMetadata ( session , requests ) ; } | Resolves the paths for a collection of metadata . Metadata will be downloaded if necessary . |
12,362 | public static void addAll ( Document document ) { List < Element > elementList = getElements ( document ) ; List < String > elementIds = getElementsId ( elementList ) ; addAll ( elementList ) ; } | Adds all queries from XML file into Repository |
12,363 | public static void removeAll ( Document document ) { List < String > elementsId = null ; elementsId = getElementsId ( document ) ; removeAll ( elementsId ) ; } | Removes all queries in the XML file from the Repository |
12,364 | private static List < String > getElementsId ( Document document ) { List < String > result = new ArrayList < String > ( ) ; List < Element > elementList = getElements ( document ) ; result = getElementsId ( elementList ) ; return result ; } | Reads XML document and returns it content as list of query names |
12,365 | private static OutputHandler createBeanOutputHandler ( AbstractXmlInputOutputHandler inputHandler , String className ) { OutputHandler result = null ; Constructor constructor = null ; try { Class clazz = Class . forName ( className ) ; Class outputClass = inputHandler . getOutputType ( ) ; AssertUtils . assertNotNull ( outputClass , "Since output handler was used which handles Beans - Bean.class should be set via constructor of XmlInputOutputHandler" ) ; constructor = clazz . getConstructor ( Class . class ) ; result = ( OutputHandler ) constructor . newInstance ( outputClass ) ; } catch ( Exception ex ) { throw new MjdbcRuntimeException ( "Cannot initialize bean output handler: " + className + "\nIf you are trying to use non-standard output handler - please add it to allowed map " + "\nvia getDefaultOutputHandlers of MjdbcConfig class" , ex ) ; } return result ; } | Unlike standard output handlers - beans output handlers require bean type via constructor hence cannot be prototyped . This function is invoked to create new instance of Bean output handler |
12,366 | public URL getImageUrl ( BaseType baseType , String id ) throws FanartTvException { StringBuilder url = getBaseUrl ( baseType ) ; url . append ( id ) ; url . append ( DELIMITER_APIKEY ) . append ( apiKey ) ; if ( StringUtils . isNotBlank ( clientKey ) ) { url . append ( DELIMITER_CLIENT_KEY ) . append ( clientKey ) ; } return convertUrl ( url ) ; } | Generate the URL for the artwork requests |
12,367 | private URL convertUrl ( StringBuilder searchUrl ) throws FanartTvException { try { LOG . trace ( "URL: {}" , searchUrl . toString ( ) ) ; return new URL ( searchUrl . toString ( ) ) ; } catch ( MalformedURLException ex ) { LOG . warn ( FAILED_TO_CREATE_URL , searchUrl . toString ( ) , ex . toString ( ) ) ; throw new FanartTvException ( ApiExceptionType . INVALID_URL , "Unable to conver String to URL" , 0 , searchUrl . toString ( ) , ex ) ; } } | Convert the string into a URL |
12,368 | public final Collection < String > getParameters ( ) { ArrayList < String > params = new ArrayList < String > ( ) ; if ( parameters == null ) { return params ; } params . addAll ( Arrays . asList ( parameters ) ) ; return params ; } | Type parameters tell a data type how to constrain values . What these parameters are and how they are interpreted are left entirely up to the implementing classes . |
12,369 | @ SuppressWarnings ( "unchecked" ) public Collection < V > getValues ( Object src ) { ArrayList < V > values = new ArrayList < V > ( ) ; if ( src instanceof String ) { String [ ] words = ( ( String ) src ) . split ( "," ) ; if ( words . length < 1 ) { values . add ( getValue ( src ) ) ; } else { for ( String word : words ) { values . add ( getValue ( word ) ) ; } } return values ; } else if ( src instanceof Collection ) { for ( Object ob : ( Collection < Object > ) src ) { values . add ( getValue ( ob ) ) ; } return values ; } throw new InvalidAttributeException ( "Invalid attribute: " + src ) ; } | When a data type is multi - valued this method is called to convert raw data into a collection of values matching this data type . If the raw value is a string this method assumes that the string represents a comma - delimited multi - value attribute . |
12,370 | public String getModuleExtension ( ) { if ( value >= moduleExtensions . length ) return Integer . toString ( value ) ; return moduleExtensions [ value ] ; } | Get the file extension for this module |
12,371 | public static Resilience createRunOnceResilience ( int retry_count , int retry_interval ) { Resilience resilience = new RunOnlyOnce ( ) ; RunFiniteTimes failure_occurrence = new RunFiniteTimes ( retry_count ) ; resilience . setFailureSchedule ( failure_occurrence ) ; for ( int i = 0 ; i < retry_count ; i ++ ) { RelativeScheduleBuilder rsb = failure_occurrence . newRelativeScheduleBuilder ( ) ; rsb . setRunDelayMinutes ( retry_interval * ( i + 1 ) ) ; rsb . createSchedule ( ) ; } return resilience ; } | create a simple Resilience object so process can restart - runs once with retries as parameters |
12,372 | public T handle ( List < QueryParameters > output ) { T result = null ; String parameterName = null ; Object parameterValue = null ; if ( output . size ( ) > 1 ) { if ( this . columnName == null ) { parameterName = output . get ( 1 ) . getNameByPosition ( columnIndex ) ; parameterValue = output . get ( 1 ) . getValue ( parameterName ) ; result = ( T ) parameterValue ; } else { parameterValue = output . get ( 1 ) . getValue ( this . columnName ) ; result = ( T ) parameterValue ; } } return result ; } | Reads specified column of first row of Query output |
12,373 | private < O > void setValue ( Map < String , O > nameValueMap , String name , O value ) { checkForNull ( name , value ) ; nameValueMap . put ( name , value ) ; } | Sets the value of an attribute . |
12,374 | private < O > O getValue ( Map < String , O > nameValueMap , String attributeName , O defaultValue ) { if ( attributeName == null ) { throw new NullPointerException ( "name must not be null" ) ; } if ( nameValueMap == null ) { return defaultValue ; } O value = nameValueMap . get ( attributeName ) ; if ( value == null ) { return defaultValue ; } return value ; } | Gets the value or default value of an attribute . |
12,375 | public BinaryOWLMetadata createCopy ( ) { BinaryOWLMetadata copy = new BinaryOWLMetadata ( ) ; copy . stringAttributes . putAll ( stringAttributes ) ; copy . intAttributes . putAll ( intAttributes ) ; copy . longAttributes . putAll ( longAttributes ) ; copy . doubleAttributes . putAll ( doubleAttributes ) ; copy . booleanAttributes . putAll ( booleanAttributes ) ; copy . byteArrayAttributes . putAll ( byteArrayAttributes ) ; for ( String key : owlObjectAttributes . keySet ( ) ) { List < OWLObject > objectList = new ArrayList < OWLObject > ( owlObjectAttributes . get ( key ) ) ; copy . owlObjectAttributes . put ( key , objectList ) ; } return copy ; } | Creates a copy of this metadata object . Modifications to this object don t affect the copy and vice versa . |
12,376 | public String getStringAttribute ( String name , String defaultValue ) { return getValue ( stringAttributes , name , defaultValue ) ; } | Gets the string value of an attribute . |
12,377 | public Integer getIntAttribute ( String name , Integer defaultValue ) { return getValue ( intAttributes , name , defaultValue ) ; } | Gets the int value of an attribute . |
12,378 | public Long getLongAttribute ( String name , Long defaultValue ) { return getValue ( longAttributes , name , defaultValue ) ; } | Gets the long value of an attribute . |
12,379 | public Boolean getBooleanAttribute ( String name , Boolean defaultValue ) { return getValue ( booleanAttributes , name , defaultValue ) ; } | Gets the boolean value of an attribute . |
12,380 | public Double getDoubleAttribute ( String name , Double defaultValue ) { return getValue ( doubleAttributes , name , defaultValue ) ; } | Gets the double value of an attribute . |
12,381 | private Integer waitFor ( Process process ) { try { return process . waitFor ( ) ; } catch ( InterruptedException e ) { log . info ( "interrupted in Process.waitFor" ) ; return null ; } } | Wait for a given process . |
12,382 | private List < File > loadFromCache ( Properties props ) { String ts = props . getProperty ( "timestamp" ) ; if ( ts == null ) return null ; long timestamp = Long . valueOf ( ts ) ; if ( isStale ( timestamp ) ) return null ; List < File > files = new ArrayList < File > ( ) ; for ( Object k : props . keySet ( ) ) { String key = k . toString ( ) ; if ( key . startsWith ( "pom." ) ) { File f = new File ( props . getProperty ( key ) ) ; if ( ! isUpToDate ( f , timestamp ) ) return null ; } if ( key . startsWith ( "jar." ) ) { File f = new File ( props . getProperty ( key ) ) ; if ( ! isUpToDate ( f , timestamp ) ) return null ; files . add ( f ) ; } } return files ; } | Loads a list of jars from the cache with up - to - date check . |
12,383 | public static < R extends JCGLResourceUsableType > R checkNotDeleted ( final R r ) throws JCGLExceptionDeleted { NullCheck . notNull ( r , "Resource" ) ; if ( r . isDeleted ( ) ) { throw new JCGLExceptionDeleted ( String . format ( "Cannot perform operation: OpenGL object %s has been deleted." , r ) ) ; } return r ; } | Check that the current object has not been deleted . |
12,384 | public int hashValue ( Object object ) { int x ; if ( object instanceof Boolean || object instanceof Character || object instanceof String || object instanceof Number || object instanceof Date ) { x = object . hashCode ( ) ; } else if ( object . getClass ( ) . isArray ( ) ) { Object [ ] array = ( Object [ ] ) object ; x = Arrays . toString ( array ) . hashCode ( ) ; } else { x = object . toString ( ) . hashCode ( ) ; } int hash = ( a * x + b ) >>> d ; return hash ; } | This method generates a hash value for the specified object using the universal hash function parameters specified in the constructor . The result will be a hash value containing the hash width number of bits . |
12,385 | void reset ( ) { sessionLock . writeLock ( ) . lock ( ) ; try { LOGGER . debug ( "Resetting managed JMS session {}" , this ) ; session = null ; for ( ManagedMessageConsumer managedMessageConsumer : messageConsumers ) { managedMessageConsumer . reset ( ) ; } } finally { sessionLock . writeLock ( ) . unlock ( ) ; } } | Reset the session and the message consumers in cascade . |
12,386 | public static void translate ( Syntax syntax , Definition source , Definition target ) throws GenericException { List < Definition > targets ; IntBitSet stopper ; targets = new ArrayList < Definition > ( ) ; targets . add ( target ) ; stopper = new IntBitSet ( ) ; stopper . add ( target . getAttribute ( ) . symbol ) ; translate ( syntax , ISOLATED , source , targets , new int [ ] { } , new IntBitSet [ ] { stopper } ) ; } | Creates a path with no steps |
12,387 | public static void translate ( Syntax syntax , Definition source , int [ ] moves , int [ ] symbols , Definition target , int modifier ) throws GenericException { IntBitSet [ ] stoppers ; List < Definition > targets ; int i ; if ( moves . length - 1 != symbols . length ) { throw new IllegalArgumentException ( ) ; } stoppers = new IntBitSet [ moves . length ] ; targets = new ArrayList < Definition > ( ) ; targets . add ( target ) ; for ( i = 0 ; i < symbols . length ; i ++ ) { stoppers [ i ] = new IntBitSet ( ) ; stoppers [ i ] . add ( symbols [ i ] ) ; } stoppers [ i ] = new IntBitSet ( ) ; stoppers [ i ] . add ( target . getAttribute ( ) . symbol ) ; translate ( syntax , modifier , source , targets , moves , stoppers ) ; } | Creates a path with 1 + steps |
12,388 | private static void translate ( Syntax syntax , int modifier , Definition source , List < Definition > targets , int [ ] moves , IntBitSet [ ] stoppers ) throws GenericException { Path path ; int count ; path = new Path ( syntax . getGrammar ( ) , modifier , source , targets , moves , stoppers ) ; count = path . translate ( ) ; if ( count == 0 && source . getAttribute ( ) . symbol != syntax . getGrammar ( ) . getStart ( ) ) { throw new GenericException ( "dead-end path for attribute " + source . getName ( ) ) ; } } | The method actually doing the work |
12,389 | public static Map < String , String > calc ( File dataFile , String ... algos ) throws IOException { Map < String , String > results = new LinkedHashMap < String , String > ( ) ; Map < String , MessageDigest > digests = new LinkedHashMap < String , MessageDigest > ( ) ; for ( String algo : algos ) { try { digests . put ( algo , MessageDigest . getInstance ( algo ) ) ; } catch ( NoSuchAlgorithmException e ) { results . put ( algo , null ) ; } } FileInputStream fis = new FileInputStream ( dataFile ) ; try { for ( byte [ ] buffer = new byte [ 32 * 1024 ] ; ; ) { int read = fis . read ( buffer ) ; if ( read < 0 ) { break ; } for ( MessageDigest digest : digests . values ( ) ) { digest . update ( buffer , 0 , read ) ; } } } finally { closeQuietly ( fis ) ; } for ( Map . Entry < String , MessageDigest > entry : digests . entrySet ( ) ) { byte [ ] bytes = entry . getValue ( ) . digest ( ) ; results . put ( entry . getKey ( ) , toHexString ( bytes ) ) ; } return results ; } | Calculates checksums for the specified file . |
12,390 | public static String uniqueEnvironment ( String prefix , String suffix , File directory ) throws IOException { File tmpDir = UNIQUE_DIRECTORY_CREATOR . create ( prefix , suffix , directory ) ; String randomFilename = UUID . randomUUID ( ) . toString ( ) ; File envNameAsFile = new File ( tmpDir , randomFilename ) ; return envNameAsFile . getAbsolutePath ( ) ; } | Creates a unique directory for housing a BDB environment and returns its name . |
12,391 | public int add ( Object label ) { ensureCapacity ( used ) ; states [ used ] = new State ( label ) ; return used ++ ; } | Inserts a new states to the automaton . New states are allocated at the end . |
12,392 | public void not ( ) { IntBitSet tmp ; tmp = new IntBitSet ( ) ; tmp . addRange ( 0 , used - 1 ) ; tmp . removeAll ( ends ) ; ends = tmp ; } | Negates normal states and end states . If the automaton is deterministic the accepted language is negated . |
12,393 | private int append ( FA add ) { int relocation ; int idx ; relocation = used ; ensureCapacity ( used + add . used ) ; for ( idx = 0 ; idx < add . used ; idx ++ ) { states [ relocation + idx ] = new State ( add . states [ idx ] , relocation ) ; } used += add . used ; return relocation ; } | Adds a copy of all states and transitions from the automaton specified . No transition is added between old and new states . States and transitions are relocated with the offsets specified . |
12,394 | public IntBitSet [ ] epsilonClosures ( ) { int si ; int nextSize ; IntBitSet [ ] result ; IntBitSet tmp ; int [ ] size ; boolean repeat ; result = new IntBitSet [ used ] ; size = new int [ used ] ; for ( si = 0 ; si < used ; si ++ ) { tmp = new IntBitSet ( ) ; states [ si ] . epsilonClosure ( tmp ) ; result [ si ] = tmp ; size [ si ] = tmp . size ( ) ; } do { repeat = false ; for ( si = 0 ; si < used ; si ++ ) { result [ si ] . addAllSets ( result ) ; nextSize = result [ si ] . size ( ) ; if ( nextSize > size [ si ] ) { size [ si ] = nextSize ; repeat = true ; } } } while ( repeat ) ; return result ; } | Its too expensive to compute a single epsilong closure . |
12,395 | private void synchronize ( String pkg , File path , Configuration conf ) { if ( ! path . isDirectory ( ) ) { throw new IllegalArgumentException ( path . getAbsolutePath ( ) . concat ( " is not a directory." ) ) ; } for ( File file : path . listFiles ( ) ) { if ( file . isDirectory ( ) ) { synchronize ( combine ( pkg , file . getName ( ) ) , file , conf ) ; } else { String fileName = file . getName ( ) ; int extensionSeparator = fileName . lastIndexOf ( '.' ) ; if ( extensionSeparator >= 0 ) { String extension = fileName . substring ( extensionSeparator + 1 ) ; if ( extension . equals ( "class" ) ) { String className = combine ( pkg , fileName . substring ( 0 , extensionSeparator ) ) ; try { byte [ ] digest = conf . getJobService ( ) . getClassDigest ( className ) ; byte [ ] def = FileUtil . getFileContents ( file ) ; byte [ ] localDigest = getDigest ( def , conf ) ; if ( digest == null || ! Arrays . equals ( digest , localDigest ) ) { conf . getJobService ( ) . setClassDefinition ( className , def ) ; System . out . print ( digest == null ? "+ " : "U " ) ; System . out . println ( className ) ; } else if ( conf . verbose ) { System . out . print ( "= " ) ; System . out . println ( className ) ; } } catch ( FileNotFoundException e ) { throw new UnexpectedException ( e ) ; } catch ( IOException e ) { System . out . print ( "E " ) ; System . out . println ( className ) ; } } } } } } | Synchronizes all classes in the given directory tree to the server . |
12,396 | private String combine ( String parent , String child ) { if ( parent . length ( ) > 0 ) { return parent . concat ( "." ) . concat ( child ) ; } else { return child ; } } | Combines package path . |
12,397 | protected T createNewBean ( ) throws InstantiationException { try { return beanClass . getConstructor ( ) . newInstance ( ) ; } catch ( final InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e ) { throw new InstantiationException ( e . getMessage ( ) ) ; } } | Creates a new bean . |
12,398 | protected void setForm ( final T bean , final AjaxRequestTarget target ) { LOG . debug ( "Setting form to {}" , bean ) ; formModel . setObject ( bean ) ; target . add ( form ) ; updateSaveButton . setModel ( Model . of ( "Update" ) ) ; target . add ( updateSaveButton ) ; } | Sets the form to the bean passed in updating the form via AJAX . |
12,399 | private Object invokeMapper ( File source ) throws IOException { Object [ ] results ; String name ; Reader src ; name = source . getPath ( ) ; mork . output . verbose ( "mapping " + name ) ; results = run ( name ) ; mork . output . verbose ( "finished mapping " + name ) ; if ( results == null ) { return null ; } else { return results [ 0 ] ; } } | Read input . Wraps mapper . read with Mork - specific error handling . Return type depends on the mapper actually used . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.