idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
146,100
public Set < Method > findAnnotatedMethods ( String scanBase , Class < ? extends Annotation > annotationClass ) { Set < BeanDefinition > filteredComponents = findCandidateBeans ( scanBase , annotationClass ) ; return extractAnnotatedMethods ( filteredComponents , annotationClass ) ; }
Find all methods on classes under scanBase that are annotated with annotationClass .
146,101
public void reset ( ) { state = BreakerState . CLOSED ; isHardTrip = false ; byPass = false ; isAttemptLive = false ; notifyBreakerStateChange ( getStatus ( ) ) ; }
Manually set the breaker to be reset and ready for use . This is only useful after a manual trip otherwise the breaker will trip automatically again if the service is still unavailable . Just like a real breaker . WOOT!!!
146,102
public WebMBeanAdapter createWebMBeanAdapter ( String mBeanName , String encoding ) throws JMException , UnsupportedEncodingException { return new WebMBeanAdapter ( mBeanServer , mBeanName , encoding ) ; }
Create a WebMBeanAdaptor for a specified MBean name .
146,103
public void mark ( ) { final long currentTimeMillis = clock . currentTimeMillis ( ) ; synchronized ( queue ) { if ( queue . size ( ) == capacity ) { queue . removeFirst ( ) ; } queue . addLast ( currentTimeMillis ) ; } }
Record a new event .
146,104
public int tally ( ) { long currentTimeMillis = clock . currentTimeMillis ( ) ; final long removeTimesBeforeMillis = currentTimeMillis - windowMillis ; synchronized ( queue ) { while ( ! queue . isEmpty ( ) && queue . peek ( ) < removeTimesBeforeMillis ) { queue . removeFirst ( ) ; } return queue . size ( ) ; } }
Returns a count of in - window events .
146,105
public void setCapacity ( int capacity ) { if ( capacity <= 0 ) { throw new IllegalArgumentException ( "capacity must be greater than 0" ) ; } synchronized ( queue ) { if ( capacity < this . capacity ) { while ( queue . size ( ) > capacity ) { queue . removeFirst ( ) ; } } } this . capacity = capacity ; }
Specifies the maximum capacity of the counter .
146,106
@ Around ( "@annotation(retryableAnnotation)" ) public Object call ( final ProceedingJoinPoint pjp , Retryable retryableAnnotation ) throws Throwable { final int maxTries = retryableAnnotation . maxTries ( ) ; final int retryDelayMillies = retryableAnnotation . retryDelayMillis ( ) ; final Class < ? extends Throwable >...
Runs a method call with retries .
146,107
public Map < String , MBeanAttributeInfo > getAttributeMetadata ( ) { MBeanAttributeInfo [ ] attributeList = mBeanInfo . getAttributes ( ) ; Map < String , MBeanAttributeInfo > attributeMap = new TreeMap < String , MBeanAttributeInfo > ( ) ; for ( MBeanAttributeInfo attribute : attributeList ) { attributeMap . put ( at...
Get the Attribute metadata for an MBean by name .
146,108
public Map < String , MBeanOperationInfo > getOperationMetadata ( ) { MBeanOperationInfo [ ] operations = mBeanInfo . getOperations ( ) ; Map < String , MBeanOperationInfo > operationMap = new TreeMap < String , MBeanOperationInfo > ( ) ; for ( MBeanOperationInfo operation : operations ) { operationMap . put ( operatio...
Get the Operation metadata for an MBean by name .
146,109
public MBeanOperationInfo getOperationInfo ( String operationName ) throws OperationNotFoundException , UnsupportedEncodingException { String decodedOperationName = sanitizer . urlDecode ( operationName , encoding ) ; Map < String , MBeanOperationInfo > operationMap = getOperationMetadata ( ) ; if ( operationMap . cont...
Get the Operation metadata for a single operation on an MBean by name .
146,110
public Map < String , Object > getAttributeValues ( ) throws AttributeNotFoundException , InstanceNotFoundException , ReflectionException { HashSet < String > attributeSet = new HashSet < String > ( ) ; for ( MBeanAttributeInfo attributeInfo : mBeanInfo . getAttributes ( ) ) { attributeSet . add ( attributeInfo . getNa...
Get all the attribute values for an MBean by name . The values are HTML escaped .
146,111
public String getAttributeValue ( String attributeName ) throws JMException , UnsupportedEncodingException { String decodedAttributeName = sanitizer . urlDecode ( attributeName , encoding ) ; return sanitizer . escapeValue ( mBeanServer . getAttribute ( objectName , decodedAttributeName ) ) ; }
Get the value for a single attribute on an MBean by name .
146,112
public String invokeOperation ( String operationName , Map < String , String [ ] > parameterMap ) throws JMException , UnsupportedEncodingException { MBeanOperationInfo operationInfo = getOperationInfo ( operationName ) ; MBeanOperationInvoker invoker = createMBeanOperationInvoker ( mBeanServer , objectName , operation...
Invoke an operation on an MBean by name . Note that only basic data types are supported for parameter values .
146,113
String urlDecode ( String name , String encoding ) throws UnsupportedEncodingException { return URLDecoder . decode ( name , encoding ) ; }
Convert a URL Encoded name back to the original form .
146,114
String escapeValue ( Object value ) { return HtmlUtils . htmlEscape ( value != null ? value . toString ( ) : "<null>" ) ; }
Escape a value to be HTML friendly .
146,115
private void registerProxyCreator ( Node source , BeanDefinitionHolder holder , ParserContext context ) { String beanName = holder . getBeanName ( ) ; String proxyName = beanName + "Proxy" ; String interceptorName = beanName + "PerformanceMonitorInterceptor" ; BeanDefinitionBuilder initializer = BeanDefinitionBuilder ....
Registers a BeanNameAutoProxyCreator class that wraps the bean being monitored . The proxy is associated with the PerformanceMonitorInterceptor for the bean which is created when parsing the methods attribute from the springconfiguration xml file .
146,116
private Integer getIntegerPropertyOverrideValue ( String name , String key ) { if ( properties != null ) { String propertyName = getPropertyName ( name , key ) ; String propertyOverrideValue = properties . getProperty ( propertyName ) ; if ( propertyOverrideValue != null ) { try { return Integer . parseInt ( propertyOv...
Get an integer property override value .
146,117
private boolean shouldWrapMethodCall ( String methodName ) { if ( methodList == null ) { return true ; } if ( methodList . contains ( methodName ) ) { return true ; } return false ; }
Checks if the method being invoked should be wrapped by a service . It looks the method name up in the methodList . If its in the list then the method should be wrapped . If the list is null then all methods are wrapped .
146,118
public Object invokeOperation ( Map < String , String [ ] > parameterMap ) throws JMException { MBeanParameterInfo [ ] parameterInfoArray = operationInfo . getSignature ( ) ; Object [ ] values = new Object [ parameterInfoArray . length ] ; String [ ] types = new String [ parameterInfoArray . length ] ; MBeanValueConver...
Invoke the operation .
146,119
private void registerInterceptor ( Node source , String beanName , BeanDefinitionRegistry registry ) { List < String > methodList = buildMethodList ( source ) ; BeanDefinitionBuilder initializer = BeanDefinitionBuilder . rootBeanDefinition ( SingleServiceWrapperInterceptor . class ) ; initializer . addPropertyValue ( "...
Register a new SingleServiceWrapperInterceptor for the bean being wrapped associate it with the PerformanceMonitor and tell it which methods to intercept .
146,120
public List < String > parseMethodList ( String methods ) { String [ ] methodArray = StringUtils . delimitedListToStringArray ( methods , "," ) ; List < String > methodList = new ArrayList < String > ( ) ; for ( String methodName : methodArray ) { methodList . add ( methodName . trim ( ) ) ; } return methodList ; }
Parse a comma - delimited list of method names into a List of strings . Whitespace is ignored .
146,121
private void registerPerformanceMonitor ( String beanName , BeanDefinitionRegistry registry ) { String perfMonitorName = beanName + "PerformanceMonitor" ; if ( ! registry . containsBeanDefinition ( perfMonitorName ) ) { BeanDefinitionBuilder initializer = BeanDefinitionBuilder . rootBeanDefinition ( PerformanceMonitorB...
Register a new PerformanceMonitor with Spring if it does not already exist .
146,122
public static void forceDelete ( final Path path ) throws IOException { if ( ! java . nio . file . Files . isDirectory ( path ) ) { java . nio . file . Files . delete ( path ) ; } else { java . nio . file . Files . walkFileTree ( path , DeleteDirVisitor . getInstance ( ) ) ; } }
Deletes a path from the filesystem
146,123
public PreparedStatementCreator count ( final Dialect dialect ) { return new PreparedStatementCreator ( ) { public PreparedStatement createPreparedStatement ( Connection con ) throws SQLException { return getPreparedStatementCreator ( ) . setSql ( dialect . createCountSelect ( builder . toString ( ) ) ) . createPrepare...
Returns a PreparedStatementCreator that returns a count of the rows that this creator would return .
146,124
public PreparedStatementCreator page ( final Dialect dialect , final int limit , final int offset ) { return new PreparedStatementCreator ( ) { public PreparedStatement createPreparedStatement ( Connection con ) throws SQLException { return getPreparedStatementCreator ( ) . setSql ( dialect . createPageSelect ( builder...
Returns a PreparedStatementCreator that returns a page of the underlying result set .
146,125
private static String toColumnName ( String fieldName ) { int lastDot = fieldName . indexOf ( '.' ) ; if ( lastDot > - 1 ) { return fieldName . substring ( lastDot + 1 ) ; } else { return fieldName ; } }
Returns the portion of the field name after the last dot as field names may actually be paths .
146,126
public static Predicate anyBitsSet ( final String expr , final long bits ) { return new Predicate ( ) { private String param ; public void init ( AbstractSqlCreator creator ) { param = creator . allocateParameter ( ) ; creator . setParameter ( param , bits ) ; } public String toSql ( ) { return String . format ( "(%s &...
Adds a clause that checks whether ANY set bits in a bitmask are present in a numeric expression .
146,127
public static Predicate is ( final String sql ) { return new Predicate ( ) { public String toSql ( ) { return sql ; } public void init ( AbstractSqlCreator creator ) { } } ; }
Returns a predicate that takes no parameters . The given SQL expression is used directly .
146,128
private static Predicate join ( final String joinWord , final List < Predicate > preds ) { return new Predicate ( ) { public void init ( AbstractSqlCreator creator ) { for ( Predicate p : preds ) { p . init ( creator ) ; } } public String toSql ( ) { StringBuilder sb = new StringBuilder ( ) . append ( "(" ) ; boolean f...
Factory for and and or predicates .
146,129
public Mapping < T > addFields ( ) { if ( idColumn == null ) { throw new RuntimeException ( "Map ID column before adding class fields" ) ; } for ( Field f : ReflectionUtils . getDeclaredFieldsInHierarchy ( clazz ) ) { if ( ! Modifier . isStatic ( f . getModifiers ( ) ) && ! isFieldMapped ( f . getName ( ) ) && ! ignore...
Adds mappings for each declared field in the mapped class . Any fields already mapped by addColumn are skipped .
146,130
protected T createInstance ( ) { try { Constructor < T > ctor = clazz . getDeclaredConstructor ( ) ; ctor . setAccessible ( true ) ; return ctor . newInstance ( ) ; } catch ( InstantiationException e ) { throw new RuntimeException ( e ) ; } catch ( IllegalAccessException e ) { throw new RuntimeException ( e ) ; } catch...
Creates instance of the entity class . This method is called to create the object instances when returning query results .
146,131
public void deleteById ( Object id ) { int count = beginDelete ( ) . whereEquals ( idColumn . getColumnName ( ) , id ) . delete ( ) ; if ( count == 0 ) { throw new RowNotFoundException ( table , id ) ; } }
Deletes an entity by its primary key .
146,132
public T findById ( Object id ) throws RowNotFoundException , TooManyRowsException { return findWhere ( eq ( idColumn . getColumnName ( ) , id ) ) . getSingleResult ( ) ; }
Finds an entity given its primary key .
146,133
public T insert ( T entity ) { if ( ! hasPrimaryKey ( entity ) ) { throw new RuntimeException ( String . format ( "Tried to insert entity of type %s with null or zero primary key" , entity . getClass ( ) . getSimpleName ( ) ) ) ; } InsertCreator insert = new InsertCreator ( table ) ; insert . setValue ( idColumn . getC...
Insert entity object . The caller must first initialize the primary key field .
146,134
private boolean hasPrimaryKey ( T entity ) { Object pk = getPrimaryKey ( entity ) ; if ( pk == null ) { return false ; } else { if ( pk instanceof Number && ( ( Number ) pk ) . longValue ( ) == 0 ) { return false ; } } return true ; }
Returns true if this entity s primary key is not null and for numeric fields is non - zero .
146,135
public T update ( T entity ) throws RowNotFoundException , OptimisticLockException { if ( ! hasPrimaryKey ( entity ) ) { throw new RuntimeException ( String . format ( "Tried to update entity of type %s without a primary key" , entity . getClass ( ) . getSimpleName ( ) ) ) ; } UpdateCreator update = new UpdateCreator (...
Updates value of entity in the table .
146,136
public AbstractSqlCreator setParameter ( String name , Object value ) { ppsc . setParameter ( name , value ) ; return this ; }
Sets a parameter for the creator .
146,137
public InsertBuilder set ( String column , String value ) { columns . add ( column ) ; values . add ( value ) ; return this ; }
Inserts a column name value pair into the SQL .
146,138
public SelectBuilder orderBy ( String name , boolean ascending ) { if ( ascending ) { orderBys . add ( name + " asc" ) ; } else { orderBys . add ( name + " desc" ) ; } return this ; }
Adds an ORDER BY item with a direction indicator .
146,139
public List < String > split ( String s ) { List < String > result = new ArrayList < String > ( ) ; if ( s == null ) { return result ; } boolean seenEscape = false ; boolean seenSeparator = false ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { seenSeparator = false ; char c ...
Splits the given string .
146,140
public String join ( List < String > list ) { if ( list == null ) { return null ; } StringBuilder sb = new StringBuilder ( ) ; boolean first = true ; for ( String s : list ) { if ( s == null ) { if ( convertEmptyToNull ) { s = "" ; } else { throw new IllegalArgumentException ( "StringListFlattener does not support null...
Joins the given list into a single string .
146,141
protected void appendList ( StringBuilder sql , List < ? > list , String init , String sep ) { boolean first = true ; for ( Object s : list ) { if ( first ) { sql . append ( init ) ; } else { sql . append ( sep ) ; } sql . append ( s ) ; first = false ; } }
Constructs a list of items with given separators .
146,142
public static < E extends Enum < E > > EnumStringConverter < E > create ( Class < E > enumType ) { return new EnumStringConverter < E > ( enumType ) ; }
Factory method to create EnumStringConverter
146,143
public static Field [ ] getDeclaredFieldsInHierarchy ( Class < ? > clazz ) { if ( clazz . isPrimitive ( ) ) { throw new IllegalArgumentException ( "Primitive types not supported." ) ; } List < Field > result = new ArrayList < Field > ( ) ; while ( true ) { if ( clazz == Object . class ) { break ; } result . addAll ( Ar...
Returns an array of all declared fields in the given class and all super - classes .
146,144
public static Field getDeclaredFieldWithPath ( Class < ? > clazz , String path ) { int lastDot = path . lastIndexOf ( '.' ) ; if ( lastDot > - 1 ) { String parentPath = path . substring ( 0 , lastDot ) ; String fieldName = path . substring ( lastDot + 1 ) ; Field parentField = getDeclaredFieldWithPath ( clazz , parentP...
Returns the Field for a given parent class and a dot - separated path of field names .
146,145
public static Object getFieldValue ( Object object , String fieldName ) { try { return getDeclaredFieldInHierarchy ( object . getClass ( ) , fieldName ) . get ( object ) ; } catch ( IllegalArgumentException e ) { throw new RuntimeException ( e ) ; } catch ( IllegalAccessException e ) { throw new RuntimeException ( e ) ...
Convenience method for getting the value of a private object field without the stress of checked exceptions in the reflection API .
146,146
public static void setFieldValue ( Object object , String fieldName , Object value ) { try { getDeclaredFieldInHierarchy ( object . getClass ( ) , fieldName ) . set ( object , value ) ; } catch ( IllegalArgumentException e ) { throw new RuntimeException ( e ) ; } catch ( IllegalAccessException e ) { throw new RuntimeEx...
Convenience method for setting the value of a private object field without the stress of checked exceptions in the reflection API .
146,147
private static void checkPreconditions ( final long min , final long max ) { if ( max < min ) { throw new IllegalArgumentException ( String . format ( "max (%d) should not be < min (%d)" , max , min ) ) ; } }
Checks the preconditions for creating a new LMinMax processor .
146,148
public static Method findGetter ( final Object object , final String fieldName ) { if ( object == null ) { throw new NullPointerException ( "object should not be null" ) ; } else if ( fieldName == null ) { throw new NullPointerException ( "fieldName should not be null" ) ; } final Class < ? > clazz = object . getClass ...
Returns the getter method associated with the object s field .
146,149
public static < T > void filterListToMap ( final Map < String , T > destinationMap , final String [ ] nameMapping , final List < ? extends T > sourceList ) { if ( destinationMap == null ) { throw new NullPointerException ( "destinationMap should not be null" ) ; } else if ( nameMapping == null ) { throw new NullPointer...
Converts a List to a Map using the elements of the nameMapping array as the keys of the Map .
146,150
public static List < Object > filterMapToList ( final Map < String , ? > map , final String [ ] nameMapping ) { if ( map == null ) { throw new NullPointerException ( "map should not be null" ) ; } else if ( nameMapping == null ) { throw new NullPointerException ( "nameMapping should not be null" ) ; } final List < Obje...
Returns a List of all of the values in the Map whose key matches an entry in the nameMapping array .
146,151
public static Object [ ] filterMapToObjectArray ( final Map < String , ? > values , final String [ ] nameMapping ) { if ( values == null ) { throw new NullPointerException ( "values should not be null" ) ; } else if ( nameMapping == null ) { throw new NullPointerException ( "nameMapping should not be null" ) ; } final ...
Converts a Map to an array of objects adding only those entries whose key is in the nameMapping array .
146,152
private static void checkPreconditions ( final Set < Object > possibleValues ) { if ( possibleValues == null ) { throw new NullPointerException ( "possibleValues Set should not be null" ) ; } else if ( possibleValues . isEmpty ( ) ) { throw new IllegalArgumentException ( "possibleValues Set should not be empty" ) ; } }
Checks the preconditions for creating a new IsIncludedIn processor with a Set of Objects .
146,153
private static void checkPreconditions ( final int maxSize , final String suffix ) { if ( maxSize <= 0 ) { throw new IllegalArgumentException ( String . format ( "maxSize should be > 0 but was %d" , maxSize ) ) ; } if ( suffix == null ) { throw new NullPointerException ( "suffix should not be null" ) ; } }
Checks the preconditions for creating a new Truncate processor .
146,154
protected void writeRow ( final String ... columns ) throws IOException { if ( columns == null ) { throw new NullPointerException ( String . format ( "columns to write should not be null on line %d" , lineNumber ) ) ; } else if ( columns . length == 0 ) { throw new IllegalArgumentException ( String . format ( "columns ...
Writes one or more String columns as a line to the CsvWriter .
146,155
private static void checkPreconditions ( final Map < Object , Object > mapping ) { if ( mapping == null ) { throw new NullPointerException ( "mapping should not be null" ) ; } else if ( mapping . isEmpty ( ) ) { throw new IllegalArgumentException ( "mapping should not be empty" ) ; } }
Checks the preconditions for creating a new HashMapper processor .
146,156
private static void checkPreconditions ( final String dateFormat , final Locale locale ) { if ( dateFormat == null ) { throw new NullPointerException ( "dateFormat should not be null" ) ; } else if ( locale == null ) { throw new NullPointerException ( "locale should not be null" ) ; } }
Checks the preconditions for creating a new ParseDateTimeAbstract processor with date format and locale .
146,157
private static void checkPreconditions ( final String regex , final String replacement ) { if ( regex == null ) { throw new NullPointerException ( "regex should not be null" ) ; } else if ( regex . length ( ) == 0 ) { throw new IllegalArgumentException ( "regex should not be empty" ) ; } if ( replacement == null ) { th...
Checks the preconditions for creating a new StrRegExReplace processor .
146,158
public V get ( final K1 firstKey , final K2 secondKey ) { final HashMap < K2 , V > innerMap = map . get ( firstKey ) ; if ( innerMap == null ) { return null ; } return innerMap . get ( secondKey ) ; }
Fetch a value from the Hashmap .
146,159
public Method getGetMethod ( final Object object , final String fieldName ) { if ( object == null ) { throw new NullPointerException ( "object should not be null" ) ; } else if ( fieldName == null ) { throw new NullPointerException ( "fieldName should not be null" ) ; } Method method = getCache . get ( object . getClas...
Returns the getter method for field on an object .
146,160
public < T > Method getSetMethod ( final Object object , final String fieldName , final Class < ? > argumentType ) { if ( object == null ) { throw new NullPointerException ( "object should not be null" ) ; } else if ( fieldName == null ) { throw new NullPointerException ( "fieldName should not be null" ) ; } else if ( ...
Returns the setter method for the field on an object .
146,161
private static void invokeSetter ( final Object bean , final Method setMethod , final Object fieldValue ) { try { setMethod . setAccessible ( true ) ; setMethod . invoke ( bean , fieldValue ) ; } catch ( final Exception e ) { throw new SuperCsvReflectionException ( String . format ( "error invoking method %s()" , setMe...
Invokes the setter on the bean with the supplied value .
146,162
private < T > T populateBean ( final T resultBean , final String [ ] nameMapping ) { for ( int i = 0 ; i < nameMapping . length ; i ++ ) { final Object fieldValue = processedColumns . get ( i ) ; if ( nameMapping [ i ] == null || fieldValue == null ) { continue ; } Method setMethod = cache . getSetMethod ( resultBean ,...
Populates the bean by mapping the processed columns to the fields of the bean .
146,163
private < T > T readIntoBean ( final T bean , final String [ ] nameMapping , final CellProcessor [ ] processors ) throws IOException { if ( readRow ( ) ) { if ( nameMapping . length != length ( ) ) { throw new IllegalArgumentException ( String . format ( "the nameMapping array and the number of columns read " + "should...
Reads a row of a CSV file and populates the bean using the supplied name mapping to map column values to the appropriate fields . If processors are supplied then they are used otherwise the raw String values will be used .
146,164
private void checkAndAddLengths ( final int ... requiredLengths ) { for ( final int length : requiredLengths ) { if ( length < 0 ) { throw new IllegalArgumentException ( String . format ( "required length cannot be negative but was %d" , length ) ) ; } this . requiredLengths . add ( length ) ; } }
Adds each required length ensuring it isn t negative .
146,165
private static void checkPreconditions ( List < String > requiredSubStrings ) { if ( requiredSubStrings == null ) { throw new NullPointerException ( "requiredSubStrings List should not be null" ) ; } else if ( requiredSubStrings . isEmpty ( ) ) { throw new IllegalArgumentException ( "requiredSubStrings List should not ...
Checks the preconditions for creating a new RequireSubStr processor with a List of Strings .
146,166
private void checkAndAddRequiredSubStrings ( final List < String > requiredSubStrings ) { for ( String required : requiredSubStrings ) { if ( required == null ) { throw new NullPointerException ( "required substring should not be null" ) ; } this . requiredSubStrings . add ( required ) ; } }
Adds each required substring checking that it s not null .
146,167
private static void checkPreconditions ( final List < String > forbiddenSubStrings ) { if ( forbiddenSubStrings == null ) { throw new NullPointerException ( "forbiddenSubStrings list should not be null" ) ; } else if ( forbiddenSubStrings . isEmpty ( ) ) { throw new IllegalArgumentException ( "forbiddenSubStrings list ...
Checks the preconditions for creating a new ForbidSubStr processor with a List of forbidden substrings .
146,168
private void checkAndAddForbiddenStrings ( final List < String > forbiddenSubStrings ) { for ( String forbidden : forbiddenSubStrings ) { if ( forbidden == null ) { throw new NullPointerException ( "forbidden substring should not be null" ) ; } this . forbiddenSubStrings . add ( forbidden ) ; } }
Adds each forbidden substring checking that it s not null .
146,169
public HashMap < K2 , HashMap < K3 , V > > get ( final K1 firstKey ) { return map . get ( firstKey ) ; }
Fetch the outermost Hashmap .
146,170
public TwoDHashMap < K2 , K3 , V > getAs2d ( final K1 firstKey ) { final HashMap < K2 , HashMap < K3 , V > > innerMap1 = map . get ( firstKey ) ; if ( innerMap1 != null ) { return new TwoDHashMap < K2 , K3 , V > ( innerMap1 ) ; } else { return new TwoDHashMap < K2 , K3 , V > ( ) ; } }
Fetch the outermost Hashmap as a TwoDHashMap .
146,171
public int size ( final K1 firstKey ) { final HashMap < K2 , HashMap < K3 , V > > innerMap = map . get ( firstKey ) ; if ( innerMap == null ) { return 0 ; } return innerMap . size ( ) ; }
Returns the number of key - value mappings in this map for the second key .
146,172
public int size ( final K1 firstKey , final K2 secondKey ) { final HashMap < K2 , HashMap < K3 , V > > innerMap1 = map . get ( firstKey ) ; if ( innerMap1 == null ) { return 0 ; } final HashMap < K3 , V > innerMap2 = innerMap1 . get ( secondKey ) ; if ( innerMap2 == null ) { return 0 ; } return innerMap2 . size ( ) ; }
Returns the number of key - value mappings in this map for the third key .
146,173
public static < T > T createProxy ( final Class < T > proxyInterface ) { if ( proxyInterface == null ) { throw new NullPointerException ( "proxyInterface should not be null" ) ; } return proxyInterface . cast ( Proxy . newProxyInstance ( proxyInterface . getClassLoader ( ) , new Class [ ] { proxyInterface } , new BeanI...
Creates a proxy object which implements a given bean interface .
146,174
private static String getUnexpectedTypeMessage ( final Class < ? > expectedType , final Object actualValue ) { if ( expectedType == null ) { throw new NullPointerException ( "expectedType should not be null" ) ; } String expectedClassName = expectedType . getName ( ) ; String actualClassName = ( actualValue != null ) ?...
Assembles the exception message when the value received by a CellProcessor isn t of the correct type .
146,175
protected List < Object > executeProcessors ( final List < Object > processedColumns , final CellProcessor [ ] processors ) { Util . executeCellProcessors ( processedColumns , getColumns ( ) , processors , getLineNumber ( ) , getRowNumber ( ) ) ; return processedColumns ; }
Executes the supplied cell processors on the last row of CSV that was read and populates the supplied List of processed columns .
146,176
public void stopListenting ( ) { if ( channel != null ) { log . info ( "closing server channel" ) ; channel . close ( ) . syncUninterruptibly ( ) ; channel = null ; } }
Closes the server socket . No new clients are accepted afterwards .
146,177
Document convertSelectorToDocument ( Document selector ) { Document document = new Document ( ) ; for ( String key : selector . keySet ( ) ) { if ( key . startsWith ( "$" ) ) { continue ; } Object value = selector . get ( key ) ; if ( ! Utils . containsQueryExpression ( value ) ) { Utils . changeSubdocumentValue ( docu...
convert selector used in an upsert statement into a document
146,178
String decodeCString ( ByteBuf buffer ) throws IOException { int length = buffer . bytesBefore ( BsonConstants . STRING_TERMINATION ) ; if ( length < 0 ) throw new IOException ( "string termination not found" ) ; String result = buffer . toString ( buffer . readerIndex ( ) , length , StandardCharsets . UTF_8 ) ; buffer...
default visibility for unit test
146,179
protected int _countPeriods ( String str ) { int commas = 0 ; for ( int i = 0 , end = str . length ( ) ; i < end ; ++ i ) { int ch = str . charAt ( i ) ; if ( ch < '0' || ch > '9' ) { if ( ch == '.' ) { ++ commas ; } else { return - 1 ; } } } return commas ; }
Helper method to find Strings of form all digits and digits - comma - digits
146,180
protected DateTimeException _peelDTE ( DateTimeException e ) { while ( true ) { Throwable t = e . getCause ( ) ; if ( t != null && t instanceof DateTimeException ) { e = ( DateTimeException ) t ; continue ; } break ; } return e ; }
Helper method used to peel off spurious wrappings of DateTimeException
146,181
protected void _acceptTimestampVisitor ( JsonFormatVisitorWrapper visitor , JavaType typeHint ) throws JsonMappingException { SerializerProvider prov = visitor . getProvider ( ) ; if ( ( prov != null ) && useNanoseconds ( prov ) ) { JsonNumberFormatVisitor v2 = visitor . expectNumberFormat ( typeHint ) ; if ( v2 != nul...
Overridden to ensure that our timestamp handling is as expected
146,182
public static void applyHyperLinkToElement ( DynamicJasperDesign design , DJHyperLink djlink , JRDesignChart chart , String name ) { JRDesignExpression hlpe = ExpressionUtils . createAndRegisterExpression ( design , name , djlink . getExpression ( ) ) ; chart . setHyperlinkReferenceExpression ( hlpe ) ; chart . setHype...
Creates necessary objects to make a chart an hyperlink
146,183
private void setCrosstabOptions ( ) { if ( djcross . isUseFullWidth ( ) ) { jrcross . setWidth ( layoutManager . getReport ( ) . getOptions ( ) . getPrintableWidth ( ) ) ; } else { jrcross . setWidth ( djcross . getWidth ( ) ) ; } jrcross . setHeight ( djcross . getHeight ( ) ) ; jrcross . setColumnBreakOffset ( djcros...
Sets the options contained in the DJCrosstab to the JRDesignCrosstab . Also fits the correct width
146,184
private void setExpressionForPrecalculatedTotalValue ( DJCrosstabColumn [ ] auxCols , DJCrosstabRow [ ] auxRows , JRDesignExpression measureExp , DJCrosstabMeasure djmeasure , DJCrosstabColumn crosstabColumn , DJCrosstabRow crosstabRow , String meausrePrefix ) { String rowValuesExp = "new Object[]{" ; String rowPropsEx...
set proper expression text invoking the DJCRosstabMeasurePrecalculatedTotalProvider for the cell
146,185
private Style getRowTotalStyle ( DJCrosstabRow crosstabRow ) { return crosstabRow . getTotalStyle ( ) == null ? this . djcross . getRowTotalStyle ( ) : crosstabRow . getTotalStyle ( ) ; }
MOVED INSIDE ExpressionUtils
146,186
private void registerRows ( ) { for ( int i = 0 ; i < rows . length ; i ++ ) { DJCrosstabRow crosstabRow = rows [ i ] ; JRDesignCrosstabRowGroup ctRowGroup = new JRDesignCrosstabRowGroup ( ) ; ctRowGroup . setWidth ( crosstabRow . getHeaderWidth ( ) ) ; ctRowGroup . setName ( crosstabRow . getProperty ( ) . getProperty...
Register the Rowgroup buckets and places the header cells for the rows
146,187
private void registerColumns ( ) { for ( int i = 0 ; i < cols . length ; i ++ ) { DJCrosstabColumn crosstabColumn = cols [ i ] ; JRDesignCrosstabColumnGroup ctColGroup = new JRDesignCrosstabColumnGroup ( ) ; ctColGroup . setName ( crosstabColumn . getProperty ( ) . getProperty ( ) ) ; ctColGroup . setHeight ( crosstabC...
Registers the Columngroup Buckets and creates the header cell for the columns
146,188
private int calculateRowHeaderMaxWidth ( DJCrosstabColumn crosstabColumn ) { int auxWidth = 0 ; boolean firstTime = true ; List < DJCrosstabColumn > auxList = new ArrayList < DJCrosstabColumn > ( djcross . getColumns ( ) ) ; Collections . reverse ( auxList ) ; for ( DJCrosstabColumn col : auxList ) { if ( col . equals ...
The max possible width can be calculated doing the sum of of the inner cells and its totals
146,189
protected static JRDesignExpression getExpressionFromVariable ( JRDesignVariable var ) { JRDesignExpression exp = new JRDesignExpression ( ) ; exp . setText ( "$V{" + var . getName ( ) + "}" ) ; exp . setValueClass ( var . getValueClass ( ) ) ; return exp ; }
Generates an expression from a variable
146,190
public static JasperPrint generateJasperPrint ( DynamicReport dr , LayoutManager layoutManager , JRDataSource ds , Map < String , Object > _parameters ) throws JRException { log . info ( "generating JasperPrint" ) ; JasperPrint jp ; JasperReport jr = DynamicJasperHelper . generateJasperReport ( dr , layoutManager , _pa...
Compiles and fills the reports design .
146,191
public static JasperPrint generateJasperPrint ( DynamicReport dr , LayoutManager layoutManager , Connection con , Map < String , Object > _parameters ) throws JRException { log . info ( "generating JasperPrint" ) ; JasperPrint jp ; if ( _parameters == null ) _parameters = new HashMap < String , Object > ( ) ; visitSubr...
For running queries embebed in the report design
146,192
public static void generateJRXML ( DynamicReport dr , LayoutManager layoutManager , Map _parameters , String xmlEncoding , OutputStream outputStream ) throws JRException { JasperReport jr = generateJasperReport ( dr , layoutManager , _parameters ) ; if ( xmlEncoding == null ) xmlEncoding = DEFAULT_XML_ENCODING ; JRXmlW...
Creates a jrxml file
146,193
public static void registerParams ( DynamicJasperDesign jd , Map _parameters ) { for ( Object key : _parameters . keySet ( ) ) { if ( key instanceof String ) { try { Object value = _parameters . get ( key ) ; if ( jd . getParametersMap ( ) . get ( key ) != null ) { log . warn ( "Parameter \"" + key + "\" already regist...
For every String key it registers the object as a parameter to make it available in the report .
146,194
@ SuppressWarnings ( "unchecked" ) protected static void visitSubreports ( DynamicReport dr , Map _parameters ) { for ( DJGroup group : dr . getColumnsGroups ( ) ) { for ( Subreport subreport : group . getHeaderSubreports ( ) ) { if ( subreport . getDynamicReport ( ) != null ) { visitSubreport ( dr , subreport ) ; visi...
Performs any needed operation on subreports after they are built like ensuring proper subreport with if fitToParentPrintableArea flag is set to true
146,195
public static JRDesignExpression getDataSourceExpression ( DJDataSource ds ) { JRDesignExpression exp = new JRDesignExpression ( ) ; exp . setValueClass ( JRDataSource . class ) ; String dsType = getDataSourceTypeStr ( ds . getDataSourceType ( ) ) ; String expText = null ; if ( ds . getDataSourceOrigin ( ) == DJConstan...
Returns the expression string required
146,196
public static JRDesignExpression getReportConnectionExpression ( ) { JRDesignExpression connectionExpression = new JRDesignExpression ( ) ; connectionExpression . setText ( "$P{" + JRDesignParameter . REPORT_CONNECTION + "}" ) ; connectionExpression . setValueClass ( Connection . class ) ; return connectionExpression ;...
Returns a JRDesignExpression that points to the main report connection
146,197
public static String getVariablesMapExpression ( Collection variables ) { StringBuilder variablesMap = new StringBuilder ( "new " + PropertiesMap . class . getName ( ) + "()" ) ; for ( Object variable : variables ) { JRVariable jrvar = ( JRVariable ) variable ; String varname = jrvar . getName ( ) ; variablesMap . app...
Collection of JRVariable
146,198
public static String createCustomExpressionInvocationText ( CustomExpression customExpression , String customExpName , boolean usePreviousFieldValues ) { String stringExpression ; if ( customExpression instanceof DJSimpleExpression ) { DJSimpleExpression varexp = ( DJSimpleExpression ) customExpression ; String symbol ...
If you register a CustomExpression with the name customExpName then this will create the text needed to invoke it in a JRDesignExpression
146,199
private void addProperties ( final PropertyDescriptor [ ] _properties ) throws ColumnBuilderException , ClassNotFoundException { for ( final PropertyDescriptor property : _properties ) { if ( isValidProperty ( property ) ) { addColumn ( getColumnTitle ( property ) , property . getName ( ) , property . getPropertyType (...
Adds columns for the specified properties .