idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
12,200
public static Map createParamMap ( PageContext pContext ) { final HttpServletRequest request = ( HttpServletRequest ) pContext . getRequest ( ) ; return new EnumeratedMap ( ) { public Enumeration enumerateKeys ( ) { return request . getParameterNames ( ) ; } public Object getValue ( Object pKey ) { if ( pKey instanceof String ) { return request . getParameter ( ( String ) pKey ) ; } else { return null ; } } public boolean isMutable ( ) { return false ; } } ; }
Creates the Map that maps parameter name to single parameter value .
12,201
public static Map createHeaderMap ( PageContext pContext ) { final HttpServletRequest request = ( HttpServletRequest ) pContext . getRequest ( ) ; return new EnumeratedMap ( ) { public Enumeration enumerateKeys ( ) { return request . getHeaderNames ( ) ; } public Object getValue ( Object pKey ) { if ( pKey instanceof String ) { return request . getHeader ( ( String ) pKey ) ; } else { return null ; } } public boolean isMutable ( ) { return false ; } } ; }
Creates the Map that maps header name to single header value .
12,202
public static Map createHeadersMap ( PageContext pContext ) { final HttpServletRequest request = ( HttpServletRequest ) pContext . getRequest ( ) ; return new EnumeratedMap ( ) { public Enumeration enumerateKeys ( ) { return request . getHeaderNames ( ) ; } public Object getValue ( Object pKey ) { if ( pKey instanceof String ) { List l = new ArrayList ( ) ; Enumeration enum_ = request . getHeaders ( ( String ) pKey ) ; if ( enum_ != null ) { while ( enum_ . hasMoreElements ( ) ) { l . add ( enum_ . nextElement ( ) ) ; } } String [ ] ret = ( String [ ] ) l . toArray ( new String [ l . size ( ) ] ) ; return ret ; } else { return null ; } } public boolean isMutable ( ) { return false ; } } ; }
Creates the Map that maps header name to an array of header values .
12,203
public static Map createInitParamMap ( PageContext pContext ) { final ServletContext context = pContext . getServletContext ( ) ; return new EnumeratedMap ( ) { public Enumeration enumerateKeys ( ) { return context . getInitParameterNames ( ) ; } public Object getValue ( Object pKey ) { if ( pKey instanceof String ) { return context . getInitParameter ( ( String ) pKey ) ; } else { return null ; } } public boolean isMutable ( ) { return false ; } } ; }
Creates the Map that maps init parameter name to single init parameter value .
12,204
public int doStartTag ( ) throws JspException { try { SPathFilter s = new SPathFilter ( new SPathParser ( select ) . expression ( ) ) ; pageContext . setAttribute ( var , s ) ; return SKIP_BODY ; } catch ( ParseException ex ) { throw new JspTagException ( ex . toString ( ) , ex ) ; } }
applies XPath expression from select and exposes a filter as var
12,205
public boolean isMatchingName ( String uri , String localPart ) { if ( localPart == null ) throw new IllegalArgumentException ( "need non-null localPart" ) ; if ( uri != null && uri . equals ( "" ) ) uri = null ; if ( this . localPart == null && this . uri == null ) parseStepName ( ) ; if ( this . uri == null && this . localPart . equals ( "*" ) ) return true ; if ( uri == null && this . uri == null && localPart . equals ( this . localPart ) ) return true ; if ( uri != null && this . uri != null && uri . equals ( this . uri ) ) { if ( localPart . equals ( this . localPart ) ) return true ; if ( this . localPart . equals ( "*" ) ) return true ; } return false ; }
Returns true if the given name matches the Step object s name taking into account the Step object s wildcards ; returns false otherwise .
12,206
private void parseStepName ( ) { String prefix ; int colonIndex = name . indexOf ( ":" ) ; if ( colonIndex == - 1 ) { prefix = null ; localPart = name ; } else { prefix = name . substring ( 0 , colonIndex ) ; localPart = name . substring ( colonIndex + 1 ) ; } uri = mapPrefix ( prefix ) ; }
Lazily computes some information about our name .
12,207
public static XPathContext getContext ( Tag child , PageContext pageContext ) { ForEachTag forEachTag = ( ForEachTag ) TagSupport . findAncestorWithClass ( child , ForEachTag . class ) ; if ( forEachTag != null ) { return forEachTag . getContext ( ) ; } XPathContext context = new XPathContext ( false ) ; VariableStack variableStack = new JSTLVariableStack ( pageContext ) ; context . setVarStack ( variableStack ) ; int dtm = context . getDTMHandleFromNode ( XmlUtil . newEmptyDocument ( ) ) ; context . pushCurrentNodeAndExpression ( dtm , dtm ) ; return context ; }
Return the XPathContext to be used for evaluating expressions .
12,208
static Object coerceToJava ( XObject xo ) throws TransformerException { if ( xo instanceof XBoolean ) { return xo . bool ( ) ; } else if ( xo instanceof XNumber ) { return xo . num ( ) ; } else if ( xo instanceof XString ) { return xo . str ( ) ; } else if ( xo instanceof XNodeSet ) { NodeList nodes = xo . nodelist ( ) ; if ( nodes . getLength ( ) == 1 ) { return nodes . item ( 0 ) ; } else { return nodes ; } } else { throw new AssertionError ( ) ; } }
Return the Java value corresponding to an XPath result .
12,209
public int doStartTag ( ) throws JspException { if ( end != - 1 && begin > end ) { return SKIP_BODY ; } index = 0 ; count = 1 ; last = false ; prepare ( ) ; discardIgnoreSubset ( begin ) ; if ( hasNext ( ) ) { item = next ( ) ; } else { return SKIP_BODY ; } discard ( step - 1 ) ; exposeVariables ( ) ; calibrateLast ( ) ; return EVAL_BODY_INCLUDE ; }
Begins iterating by processing the first item .
12,210
private void calibrateLast ( ) throws JspTagException { last = ! hasNext ( ) || atEnd ( ) || ( end != - 1 && ( begin + index + step > end ) ) ; }
Sets last appropriately .
12,211
public static String postHexString ( String url , Map < String , String > queryParas , byte [ ] data , Map < String , String > headers ) { return HttpKit . post ( url , queryParas , HexKit . byteToHexString ( data ) , headers ) ; }
Send Hex String request
12,212
public static String post ( String url , Map < String , String > queryParas , byte [ ] data , Map < String , String > headers ) { return HttpKit . post ( url , queryParas , ( new String ( data ) ) , headers ) ; }
Send byte data by post request
12,213
public static String toStringToken ( String pValue ) { if ( pValue . indexOf ( '\"' ) < 0 && pValue . indexOf ( '\\' ) < 0 ) { return "\"" + pValue + "\"" ; } else { StringBuffer buf = new StringBuffer ( ) ; buf . append ( '\"' ) ; int len = pValue . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { char ch = pValue . charAt ( i ) ; if ( ch == '\\' ) { buf . append ( '\\' ) ; buf . append ( '\\' ) ; } else if ( ch == '\"' ) { buf . append ( '\\' ) ; buf . append ( '\"' ) ; } else { buf . append ( ch ) ; } } buf . append ( '\"' ) ; return buf . toString ( ) ; } }
Converts the specified value to a String token using as the enclosing quotes and escaping any characters that need escaping .
12,214
static boolean isJavaIdentifier ( String pValue ) { int len = pValue . length ( ) ; if ( len == 0 ) { return false ; } else { if ( ! Character . isJavaIdentifierStart ( pValue . charAt ( 0 ) ) ) { return false ; } else { for ( int i = 1 ; i < len ; i ++ ) { if ( ! Character . isJavaIdentifierPart ( pValue . charAt ( i ) ) ) { return false ; } } return true ; } } }
Returns true if the specified value is a legal java identifier
12,215
public static ValueExpression createValueExpression ( PageContext pageContext , String expression , Class < ? > expectedType ) { ExpressionFactory factory = getExpressionFactory ( pageContext ) ; return factory . createValueExpression ( pageContext . getELContext ( ) , expression , expectedType ) ; }
Create a value expression .
12,216
public static ExpressionFactory getExpressionFactory ( PageContext pageContext ) { JspApplicationContext appContext = JspFactory . getDefaultFactory ( ) . getJspApplicationContext ( pageContext . getServletContext ( ) ) ; return appContext . getExpressionFactory ( ) ; }
Return the JSP s ExpressionFactory .
12,217
public static < T > T evaluate ( ValueExpression expression , PageContext pageContext ) { if ( expression == null ) { return null ; } @ SuppressWarnings ( "unchecked" ) T value = ( T ) expression . getValue ( pageContext . getELContext ( ) ) ; return value ; }
Evaluate a value expression . To support optional attributes if the expression is null then null will be returned .
12,218
public static ExpressionEvaluator getEvaluatorByName ( String name ) throws JspException { try { ExpressionEvaluator evaluator = nameMap . get ( name ) ; if ( evaluator == null ) { nameMap . putIfAbsent ( name , ( ExpressionEvaluator ) Class . forName ( name ) . newInstance ( ) ) ; evaluator = nameMap . get ( name ) ; } return evaluator ; } catch ( ClassCastException ex ) { throw new JspException ( "invalid ExpressionEvaluator: " + name , ex ) ; } catch ( ClassNotFoundException ex ) { throw new JspException ( "couldn't find ExpressionEvaluator: " + name , ex ) ; } catch ( IllegalAccessException ex ) { throw new JspException ( "couldn't access ExpressionEvaluator: " + name , ex ) ; } catch ( InstantiationException ex ) { throw new JspException ( "couldn't instantiate ExpressionEvaluator: " + name , ex ) ; } }
Gets an ExpressionEvaluator from the cache or seeds the cache if we haven t seen a particular ExpressionEvaluator before .
12,219
public static Object coerce ( Object value , Class classe ) throws JspException { try { return Coercions . coerce ( value , classe , logger ) ; } catch ( ELException ex ) { throw new JspException ( ex ) ; } }
Performs a type conversion according to the EL s rules .
12,220
public Connection getConnection ( ) throws SQLException { Connection conn = null ; if ( driver != null ) { Properties props = new Properties ( ) ; if ( userName != null ) { props . put ( "user" , userName ) ; } if ( password != null ) { props . put ( "password" , password ) ; } conn = driver . connect ( jdbcURL , props ) ; } if ( conn == null ) { if ( userName != null ) { conn = DriverManagerAccessor . getConnection ( jdbcURL , userName , password ) ; } else { conn = DriverManagerAccessor . getConnection ( jdbcURL ) ; } } return conn ; }
Returns a Connection using the DriverManager and all set properties .
12,221
public Connection getConnection ( String username , String password ) throws SQLException { throw new SQLException ( Resources . getMessage ( "NOT_SUPPORTED" ) ) ; }
Always throws a SQLException . Username and password are set in the constructor and can not be changed .
12,222
public boolean isMatchingAttribute ( org . xml . sax . Attributes a ) { String attValue = a . getValue ( "" , attribute ) ; return ( attValue != null && attValue . equals ( target ) ) ; }
Returns true if the given SAX AttributeList is suitable given our attribute name and target ; returns false otherwise .
12,223
public static String replace ( String input , String before , String after ) { if ( before . length ( ) == 0 ) { return input ; } return input . replace ( before , after ) ; }
Returns a string resulting from replacing all occurrences of a before substring with an after substring . The string is processed once and not reprocessed for further replacements .
12,224
public static Class getPrimitiveObjectClass ( Class pClass ) { if ( pClass == Boolean . TYPE ) { return Boolean . class ; } else if ( pClass == Byte . TYPE ) { return Byte . class ; } else if ( pClass == Short . TYPE ) { return Short . class ; } else if ( pClass == Character . TYPE ) { return Character . class ; } else if ( pClass == Integer . TYPE ) { return Integer . class ; } else if ( pClass == Long . TYPE ) { return Long . class ; } else if ( pClass == Float . TYPE ) { return Float . class ; } else if ( pClass == Double . TYPE ) { return Double . class ; } else { return pClass ; } }
If the given class is a primitive class returns the object version of that class . Otherwise the class is just returned .
12,225
public int doStartTag ( ) throws JspException { try { XPathContext context = XalanUtil . getContext ( this , pageContext ) ; XObject result = select . execute ( context , context . getCurrentNode ( ) , null ) ; pageContext . setAttribute ( var , XalanUtil . coerceToJava ( result ) , scope ) ; return SKIP_BODY ; } catch ( TransformerException e ) { throw new JspTagException ( e ) ; } }
applies XPath expression from select and stores the result in var
12,226
private boolean isPrivateIp ( String address ) { InetAddress ip ; try { ip = InetAddress . getByName ( address ) ; } catch ( UnknownHostException e ) { return false ; } return ip . isLoopbackAddress ( ) || ip . isLinkLocalAddress ( ) || ip . isSiteLocalAddress ( ) ; }
Determine whether or not the provided address is private .
12,227
private String getRedirectUrl ( HttpServletRequest request , String newScheme ) { String serverName = request . getServerName ( ) ; String uri = request . getRequestURI ( ) ; StringBuilder redirect = new StringBuilder ( 100 ) ; redirect . append ( newScheme ) ; redirect . append ( "://" ) ; redirect . append ( serverName ) ; redirect . append ( uri ) ; String query = request . getQueryString ( ) ; if ( query != null ) { redirect . append ( '?' ) ; redirect . append ( query ) ; } return redirect . toString ( ) ; }
Return the full URL that should be redirected to including query parameters .
12,228
public String format ( Comment comment ) { if ( comment == null ) { return "" ; } StringBuilder sb = new StringBuilder ( ) ; for ( CommentElement e : comment ) { if ( e instanceof CommentText ) { sb . append ( renderText ( ( CommentText ) e ) ) ; } else if ( e instanceof InlineLink ) { sb . append ( renderLink ( ( InlineLink ) e ) ) ; } else if ( e instanceof InlineValue ) { sb . append ( renderValue ( ( InlineValue ) e ) ) ; } else if ( e instanceof InlineTag ) { sb . append ( renderTag ( ( InlineTag ) e ) ) ; } else { sb . append ( renderUnrecognized ( e ) ) ; } } return sb . toString ( ) ; }
Render the comment as an HTML String .
12,229
public static void loadProps ( Properties props , File file ) throws IOException { FileInputStream fis = null ; try { fis = new FileInputStream ( file ) ; props . load ( fis ) ; } finally { if ( null != fis ) { fis . close ( ) ; } } }
Loads in the properties file
12,230
public static String normalize ( final CharSequence src , final Form form ) { return normalize ( src . toString ( ) , form ) ; }
Normalize a sequence of char values . The sequence will be normalized according to the specified normalization from .
12,231
public static boolean isNormalized ( final CharSequence src , final Form form ) { return StringUtils . equals ( src . toString ( ) , normalize ( src . toString ( ) , form ) ) ; }
Determines if the given sequence of char values is normalized .
12,232
public static void assertNotEmpty ( final String pstring , final String pmessage ) { if ( pstring == null || pstring . length ( ) == 0 ) { throw new IllegalArgumentException ( pmessage ) ; } }
check if a string is not empty .
12,233
public T getMin ( ) { if ( StringUtils . isEmpty ( getInputElement ( ) . getMin ( ) ) ) { return null ; } try { return this . numberParser . parse ( getInputElement ( ) . getMin ( ) ) ; } catch ( final ParseException e ) { return null ; } }
get minimum allowed value .
12,234
public T getMax ( ) { if ( StringUtils . isEmpty ( getInputElement ( ) . getMax ( ) ) ) { return null ; } try { return this . numberParser . parse ( getInputElement ( ) . getMax ( ) ) ; } catch ( final ParseException e ) { return null ; } }
get maximum allowed value .
12,235
private static boolean isIPv4MappedAddress ( final byte [ ] addr ) { if ( addr . length < INADDR16SZ ) { return false ; } return addr [ 0 ] == 0x00 && addr [ 1 ] == 0x00 && addr [ 2 ] == 0x00 && addr [ 3 ] == 0x00 && addr [ 4 ] == 0x00 && addr [ 5 ] == 0x00 && addr [ 6 ] == 0x00 && addr [ 7 ] == 0x00 && addr [ 8 ] == 0x00 && addr [ 9 ] == 0x00 && addr [ 10 ] == ( byte ) 0xff && addr [ 11 ] == ( byte ) 0xff ; }
Utility routine to check if the InetAddress is an IPv4 mapped IPv6 address .
12,236
public void copyFactor ( DDF ddf , List < String > columns ) throws DDFException { if ( columns == null ) { columns = new ArrayList < String > ( ) ; } for ( Schema . Column col : ddf . getSchema ( ) . getColumns ( ) ) { if ( this . getDDF ( ) . getColumn ( col . getName ( ) ) != null && col . getColumnClass ( ) == Schema . ColumnClass . FACTOR ) { this . getDDF ( ) . getSchemaHandler ( ) . setAsFactor ( col . getName ( ) ) ; if ( ! columns . contains ( col . getName ( ) ) ) { this . getDDF ( ) . getSchemaHandler ( ) . setFactorLevels ( col . getName ( ) , col . getOptionalFactor ( ) ) ; } } } this . getDDF ( ) . getSchemaHandler ( ) . computeFactorLevelsAndLevelCounts ( ) ; }
Transfer factor information from ddf to this DDF
12,237
public static < T > ValueBox < T > wrap ( final Element element , final Renderer < T > renderer , final Parser < T > parser ) { assert Document . get ( ) . getBody ( ) . isOrHasChild ( element ) ; final ValueBox < T > valueBox = new ValueBox < > ( element , renderer , parser ) ; valueBox . onAttach ( ) ; RootPanel . detachOnWindowClose ( valueBox ) ; return valueBox ; }
Creates a ValueBox widget that wraps an existing &lt ; input type = text &gt ; element .
12,238
public static < T > void fire ( final HasFormSubmitHandlers < T > source , final T value ) { if ( type != null ) { final FormSubmitEvent < T > event = new FormSubmitEvent < > ( value ) ; source . fireEvent ( event ) ; } }
Fires a form submit event on all registered handlers in the handler manager . If no such handlers exist this method will do nothing .
12,239
private boolean checkAtVatId ( final String pvatId ) { final int checkSum = pvatId . charAt ( 10 ) - '0' ; final int sum = pvatId . charAt ( 3 ) - '0' + squareSum ( ( pvatId . charAt ( 4 ) - '0' ) * 2 ) + pvatId . charAt ( 5 ) - '0' + squareSum ( ( pvatId . charAt ( 6 ) - '0' ) * 2 ) + pvatId . charAt ( 7 ) - '0' + squareSum ( ( pvatId . charAt ( 8 ) - '0' ) * 2 ) + pvatId . charAt ( 9 ) - '0' ; final int calculatedCheckSum = ( 96 - sum ) % 10 ; return checkSum == calculatedCheckSum ; }
check the VAT identification number country version for Austria .
12,240
private boolean checkBeVatId ( final String pvatId ) { final int numberPart = Integer . parseInt ( pvatId . substring ( 2 , 10 ) ) ; final int checkSum = Integer . parseInt ( pvatId . substring ( 10 ) ) ; final int calculatedCheckSumBe = MODULO_97 - numberPart % MODULO_97 ; return checkSum == calculatedCheckSumBe ; }
check the VAT identification number country version for Belgium .
12,241
private boolean checkDkVatId ( final String pvatId ) { final int sum = ( pvatId . charAt ( 2 ) - '0' ) * 2 + ( pvatId . charAt ( 3 ) - '0' ) * 7 + ( pvatId . charAt ( 4 ) - '0' ) * 6 + ( pvatId . charAt ( 5 ) - '0' ) * 5 + ( pvatId . charAt ( 6 ) - '0' ) * 4 + ( pvatId . charAt ( 7 ) - '0' ) * 3 + ( pvatId . charAt ( 8 ) - '0' ) * 2 + pvatId . charAt ( 9 ) - '0' ; return sum % MODULO_11 == 0 ; }
check the VAT identification number country version for Denmark .
12,242
private boolean checkDeVatId ( final String pvatId ) { final int checkSum = pvatId . charAt ( 10 ) - '0' ; int sum = 10 ; for ( int i = 2 ; i < 10 ; i ++ ) { int summe = ( pvatId . charAt ( i ) - '0' + sum ) % 10 ; if ( summe == 0 ) { summe = 10 ; } sum = 2 * summe % MODULO_11 ; } int calculatedCheckSum = MODULO_11 - sum ; if ( calculatedCheckSum == 10 ) { calculatedCheckSum = 0 ; } return checkSum == calculatedCheckSum ; }
check the VAT identification number country version for Germany .
12,243
private boolean checkFiVatId ( final String pvatId ) { final int checkSum = pvatId . charAt ( 9 ) - '0' ; final int sum = ( pvatId . charAt ( 2 ) - '0' ) * 7 + ( pvatId . charAt ( 3 ) - '0' ) * 9 + ( pvatId . charAt ( 4 ) - '0' ) * 10 + ( pvatId . charAt ( 5 ) - '0' ) * 5 + ( pvatId . charAt ( 6 ) - '0' ) * 8 + ( pvatId . charAt ( 7 ) - '0' ) * 4 + ( pvatId . charAt ( 8 ) - '0' ) * 2 ; final int calculatedCheckSum = MODULO_11 - sum % MODULO_11 ; return checkSum == calculatedCheckSum ; }
check the VAT identification number country version for Finland .
12,244
private boolean checkFrVatId ( final String pvatId ) { final int checkSum = Integer . parseInt ( pvatId . substring ( 2 , 4 ) ) ; final int sum = Integer . parseInt ( pvatId . substring ( 4 ) ) ; final int calculatedCheckSum = ( 12 + 3 * ( sum % MODULO_97 ) ) % MODULO_97 ; return checkSum == calculatedCheckSum ; }
check the VAT identification number country version for France .
12,245
private boolean checkGrVatId ( final String pvatId ) { final int checkSum = pvatId . charAt ( 10 ) - '0' ; final int sum = ( pvatId . charAt ( 2 ) - '0' ) * 256 + ( pvatId . charAt ( 3 ) - '0' ) * 128 + ( pvatId . charAt ( 4 ) - '0' ) * 64 + ( pvatId . charAt ( 5 ) - '0' ) * 32 + ( pvatId . charAt ( 6 ) - '0' ) * 16 + ( pvatId . charAt ( 7 ) - '0' ) * 8 + ( pvatId . charAt ( 8 ) - '0' ) * 4 + ( pvatId . charAt ( 9 ) - '0' ) * 2 ; int calculatedCheckSum = sum % MODULO_11 ; if ( calculatedCheckSum > 9 ) { calculatedCheckSum = 0 ; } return checkSum == calculatedCheckSum ; }
check the VAT identification number country version for Greece .
12,246
private boolean checkIeVatId ( final String pvatId ) { final char checkSum = pvatId . charAt ( 9 ) ; String vatId = pvatId ; if ( pvatId . charAt ( 3 ) >= 'A' && pvatId . charAt ( 3 ) <= 'Z' ) { vatId = pvatId . substring ( 0 , 2 ) + "0" + pvatId . substring ( 4 , 9 ) + pvatId . substring ( 2 , 3 ) + pvatId . substring ( 9 ) ; } final int sum = ( vatId . charAt ( 2 ) - '0' ) * 8 + ( vatId . charAt ( 3 ) - '0' ) * 7 + ( vatId . charAt ( 4 ) - '0' ) * 6 + ( vatId . charAt ( 5 ) - '0' ) * 5 + ( vatId . charAt ( 6 ) - '0' ) * 4 + ( vatId . charAt ( 7 ) - '0' ) * 3 + ( vatId . charAt ( 8 ) - '0' ) * 2 ; final int calculatedCheckSum = sum % 23 ; final char calculatedCheckSumCharIe ; if ( calculatedCheckSum == 0 ) { calculatedCheckSumCharIe = 'W' ; } else { calculatedCheckSumCharIe = ( char ) ( 'A' + calculatedCheckSum - 1 ) ; } return checkSum == calculatedCheckSumCharIe ; }
check the VAT identification number country version for Ireland .
12,247
private boolean checkItVatId ( final String pvatId ) { final int checkSum = pvatId . charAt ( 12 ) - '0' ; final int sum = pvatId . charAt ( 2 ) - '0' + squareSum ( ( pvatId . charAt ( 3 ) - '0' ) * 2 ) + pvatId . charAt ( 4 ) - '0' + squareSum ( ( pvatId . charAt ( 5 ) - '0' ) * 2 ) + pvatId . charAt ( 6 ) - '0' + squareSum ( ( pvatId . charAt ( 7 ) - '0' ) * 2 ) + pvatId . charAt ( 8 ) - '0' + squareSum ( ( pvatId . charAt ( 9 ) - '0' ) * 2 ) + pvatId . charAt ( 10 ) - '0' + squareSum ( ( pvatId . charAt ( 11 ) - '0' ) * 2 ) ; final int calculatedCheckSumIt = 10 - sum % 10 ; return checkSum == calculatedCheckSumIt ; }
check the VAT identification number country version for Italy .
12,248
private boolean checkLuVatId ( final String pvatId ) { final int numberPart = Integer . parseInt ( pvatId . substring ( 2 , 8 ) ) ; final int checkSum = Integer . parseInt ( pvatId . substring ( 8 ) ) ; final int calculatedCheckSum = numberPart % 89 ; return checkSum == calculatedCheckSum ; }
check the VAT identification number country version for Luxembourg .
12,249
private boolean checkNlVatId ( final String pvatId ) { final int checkSum = pvatId . charAt ( 10 ) - '0' ; final int sum = ( pvatId . charAt ( 2 ) - '0' ) * 9 + ( pvatId . charAt ( 3 ) - '0' ) * 8 + ( pvatId . charAt ( 4 ) - '0' ) * 7 + ( pvatId . charAt ( 5 ) - '0' ) * 6 + ( pvatId . charAt ( 6 ) - '0' ) * 5 + ( pvatId . charAt ( 7 ) - '0' ) * 4 + ( pvatId . charAt ( 8 ) - '0' ) * 3 + ( pvatId . charAt ( 9 ) - '0' ) * 2 ; final int calculatedCheckSum = sum % MODULO_11 ; return checkSum == calculatedCheckSum ; }
check the VAT identification number country version for Netherlands .
12,250
private boolean checkNoVatId ( final String pvatId ) { final int checkSum = pvatId . charAt ( 10 ) - '0' ; final int sum = ( pvatId . charAt ( 2 ) - '0' ) * 3 + ( pvatId . charAt ( 3 ) - '0' ) * 2 + ( pvatId . charAt ( 4 ) - '0' ) * 7 + ( pvatId . charAt ( 5 ) - '0' ) * 6 + ( pvatId . charAt ( 6 ) - '0' ) * 5 + ( pvatId . charAt ( 7 ) - '0' ) * 4 + ( pvatId . charAt ( 8 ) - '0' ) * 3 + ( pvatId . charAt ( 9 ) - '0' ) * 2 ; final int calculatedCheckSum = MODULO_11 - sum % MODULO_11 ; return checkSum == calculatedCheckSum ; }
check the VAT identification number country version for Norway .
12,251
private boolean checkPlVatId ( final String pvatId ) { final int checkSum = pvatId . charAt ( 11 ) - '0' ; final int sum = ( pvatId . charAt ( 2 ) - '0' ) * 6 + ( pvatId . charAt ( 3 ) - '0' ) * 5 + ( pvatId . charAt ( 4 ) - '0' ) * 7 + ( pvatId . charAt ( 5 ) - '0' ) * 2 + ( pvatId . charAt ( 6 ) - '0' ) * 3 + ( pvatId . charAt ( 7 ) - '0' ) * 4 + ( pvatId . charAt ( 8 ) - '0' ) * 5 + ( pvatId . charAt ( 9 ) - '0' ) * 6 + ( pvatId . charAt ( 10 ) - '0' ) * 7 ; final int calculatedCheckSumPl = sum % MODULO_11 ; return checkSum == calculatedCheckSumPl ; }
check the VAT identification number country version for Poland .
12,252
private boolean checkPtVatId ( final String pvatId ) { final int checkSum = pvatId . charAt ( 10 ) - '0' ; final int sum = ( pvatId . charAt ( 2 ) - '0' ) * 9 + ( pvatId . charAt ( 3 ) - '0' ) * 8 + ( pvatId . charAt ( 4 ) - '0' ) * 7 + ( pvatId . charAt ( 5 ) - '0' ) * 6 + ( pvatId . charAt ( 6 ) - '0' ) * 5 + ( pvatId . charAt ( 7 ) - '0' ) * 4 + ( pvatId . charAt ( 8 ) - '0' ) * 3 + ( pvatId . charAt ( 9 ) - '0' ) * 2 ; int calculatedCheckSum = MODULO_11 - sum % MODULO_11 ; if ( calculatedCheckSum > 9 ) { calculatedCheckSum = 0 ; } return checkSum == calculatedCheckSum ; }
check the VAT identification number country version for Portugal .
12,253
private boolean checkSeVatId ( final String pvatId ) { final int checkSum = pvatId . charAt ( 11 ) - '0' ; final int sum = squareSum ( ( pvatId . charAt ( 2 ) - '0' ) * 2 ) + pvatId . charAt ( 3 ) - '0' + squareSum ( ( pvatId . charAt ( 4 ) - '0' ) * 2 ) + pvatId . charAt ( 5 ) - '0' + squareSum ( ( pvatId . charAt ( 6 ) - '0' ) * 2 ) + pvatId . charAt ( 7 ) - '0' + squareSum ( ( pvatId . charAt ( 8 ) - '0' ) * 2 ) + pvatId . charAt ( 9 ) - '0' + squareSum ( ( pvatId . charAt ( 10 ) - '0' ) * 2 ) ; int calculatedCheckSum = 10 - sum % 10 ; if ( calculatedCheckSum == 10 ) { calculatedCheckSum = 0 ; } return checkSum == calculatedCheckSum ; }
check the VAT identification number country version for Sweden .
12,254
private boolean checkSiVatId ( final String pvatId ) { boolean checkSumOk ; final int checkSum = pvatId . charAt ( 9 ) - '0' ; final int sum = ( pvatId . charAt ( 2 ) - '0' ) * 8 + ( pvatId . charAt ( 3 ) - '0' ) * 7 + ( pvatId . charAt ( 4 ) - '0' ) * 6 + ( pvatId . charAt ( 5 ) - '0' ) * 5 + ( pvatId . charAt ( 6 ) - '0' ) * 4 + ( pvatId . charAt ( 7 ) - '0' ) * 3 + ( pvatId . charAt ( 8 ) - '0' ) * 2 ; int calculatedCheckSum = MODULO_11 - sum % MODULO_11 ; if ( calculatedCheckSum == 11 ) { checkSumOk = false ; } else { if ( calculatedCheckSum == 10 ) { calculatedCheckSum = 0 ; } checkSumOk = checkSum == calculatedCheckSum ; } return checkSumOk ; }
check the VAT identification number country version for Slovenia .
12,255
private static int squareSum ( final int pvalue ) { int result = 0 ; for ( final char valueDigit : String . valueOf ( pvalue ) . toCharArray ( ) ) { result += Character . digit ( valueDigit , 10 ) ; } return result ; }
calculate square sum .
12,256
@ SuppressWarnings ( "checkstyle:rightCurly" ) boolean isAncestor ( final ClassLoader cl ) { ClassLoader acl = this ; do { acl = acl . parent ; if ( Objects . equals ( cl , acl ) ) { return true ; } } while ( acl != null ) ; return false ; }
loader s delegation chain .
12,257
public static String getValueWithGlobalDefault ( String section , ConfigConstant key ) { String value = getValue ( section , key ) ; return ( Strings . isNullOrEmpty ( value ) ? getGlobalValue ( key ) : value ) ; }
If the named section does not have the value then try the same key from the global section
12,258
@ ExceptionHandler ( MethodArgumentNotValidException . class ) @ ResponseStatus ( HttpStatus . BAD_REQUEST ) public ValidationResultInterface processValidationError ( final MethodArgumentNotValidException pexception ) { final BindingResult result = pexception . getBindingResult ( ) ; final List < FieldError > fieldErrors = result . getFieldErrors ( ) ; return processFieldErrors ( fieldErrors ) ; }
handle validation errors .
12,259
public static Optional < File > resolvePluginDependency ( Dependency d , List < RemoteRepository > pluginRepos , ArtifactResolver resolver , RepositorySystemSession repoSystemSession ) { Artifact a = new DefaultArtifact ( d . getGroupId ( ) , d . getArtifactId ( ) , d . getClassifier ( ) , d . getType ( ) , d . getVersion ( ) ) ; ArtifactRequest artifactRequest = new ArtifactRequest ( ) ; artifactRequest . setArtifact ( a ) ; artifactRequest . setRepositories ( pluginRepos ) ; try { ArtifactResult artifactResult = resolver . resolveArtifact ( repoSystemSession , artifactRequest ) ; if ( artifactResult . getArtifact ( ) != null ) { return Optional . fromNullable ( artifactResult . getArtifact ( ) . getFile ( ) ) ; } return Optional . absent ( ) ; } catch ( ArtifactResolutionException e ) { return Optional . absent ( ) ; } }
Uses the aether to resolve a plugin dependency and returns the file for further processing .
12,260
public static < T extends User , V extends EditorWithErrorHandling < ? , ? > , M extends LoginMessages , H extends HttpMessages > LoginCallback < T , V , M , H > buildLoginCallback ( final V pview , final Session psession , final M ploginErrorMessage ) { return new LoginCallback < > ( pview , psession , ploginErrorMessage ) ; }
create login callback implementation .
12,261
private void fillEntries ( final Collection < T > pids ) { this . entries . clear ( ) ; final Stream < IdAndNameBean < T > > stream = pids . stream ( ) . map ( proEnum -> new IdAndNameBean < > ( proEnum , this . messages . name ( proEnum ) ) ) ; final Stream < IdAndNameBean < T > > sortedStream ; if ( this . sortOrder == null ) { sortedStream = stream ; } else { switch ( this . sortOrder == null ? null : this . sortOrder ) { case ID_ASC : sortedStream = stream . sorted ( new IdAndNameIdComperator < T > ( ) ) ; break ; case ID_DSC : sortedStream = stream . sorted ( Collections . reverseOrder ( new IdAndNameIdComperator < T > ( ) ) ) ; break ; case NAME_ASC : sortedStream = stream . sorted ( new IdAndNameNameComperator < T > ( ) ) ; break ; case NAME_DSC : sortedStream = stream . sorted ( Collections . reverseOrder ( new IdAndNameNameComperator < T > ( ) ) ) ; break ; default : sortedStream = stream ; break ; } } this . entries . addAll ( sortedStream . collect ( Collectors . toList ( ) ) ) ; this . flowPanel . clear ( ) ; this . entries . forEach ( entry -> { final RadioButton radioButton = new RadioButton ( this . widgetId , entry . getName ( ) ) ; radioButton . setFormValue ( Objects . toString ( entry . getId ( ) ) ) ; radioButton . setEnabled ( this . enabled ) ; this . flowPanel . add ( radioButton ) ; this . idToButtonMap . put ( entry . getId ( ) , radioButton ) ; } ) ; }
fill entries of the radio buttons .
12,262
public void createRecursiveNavigation ( final TreeItem pitem , final List < NavigationEntryInterface > plist , final NavigationEntryInterface pactiveEntry ) { for ( final NavigationEntryInterface navEntry : plist ) { final TreeItem newItem ; if ( navEntry instanceof NavigationEntryFolder ) { newItem = new TreeItem ( navEntry . getMenuValue ( ) ) ; createRecursiveNavigation ( newItem , ( ( NavigationEntryFolder ) navEntry ) . getSubEntries ( ) , pactiveEntry ) ; newItem . setState ( navEntry . isOpenOnStartup ( ) ) ; } else if ( navEntry instanceof NavigationLink ) { final Anchor link = ( ( NavigationLink ) navEntry ) . getAnchor ( ) ; link . setStylePrimaryName ( resources . navigationStyle ( ) . link ( ) ) ; newItem = new TreeItem ( link ) ; } else if ( navEntry . getToken ( ) == null ) { newItem = null ; } else { final InlineHyperlink entryPoint = GWT . create ( InlineHyperlink . class ) ; entryPoint . setHTML ( navEntry . getMenuValue ( ) ) ; entryPoint . setTargetHistoryToken ( navEntry . getFullToken ( ) ) ; entryPoint . setStylePrimaryName ( resources . navigationStyle ( ) . link ( ) ) ; newItem = new TreeItem ( entryPoint ) ; navigationMap . put ( newItem , navEntry ) ; } if ( newItem != null ) { pitem . addItem ( newItem ) ; if ( pactiveEntry != null && pactiveEntry . equals ( navEntry ) ) { selectedItem = newItem ; selectedItem . setSelected ( true ) ; } } } }
create navigation in a recursive way .
12,263
@ UiHandler ( "navTree" ) final void menuItemSelected ( final SelectionEvent < TreeItem > pselectionEvent ) { if ( selectedItem != null && ! selectedItem . equals ( pselectionEvent . getSelectedItem ( ) ) ) { pselectionEvent . getSelectedItem ( ) . setSelected ( false ) ; selectedItem . setSelected ( true ) ; } }
menu item is selected in the menu tree .
12,264
public PropertyDescriptorImpl shallowCopy ( ) { final ConstraintDescriptorImpl < ? > [ ] desc = new ConstraintDescriptorImpl < ? > [ descriptors . size ( ) ] ; descriptors . toArray ( desc ) ; return new PropertyDescriptorImpl ( name , elementClass , cascaded , parentBeanMetadata , validationGroupsMetadata , desc ) ; }
create a copy of this instance and return it .
12,265
public static ConstraintViolationException instantiate ( final SerializationStreamReader streamReader ) throws SerializationException { final String message = streamReader . readString ( ) ; @ SuppressWarnings ( "unchecked" ) final Set < ConstraintViolation < ? > > set = ( Set < ConstraintViolation < ? > > ) streamReader . readObject ( ) ; return new ConstraintViolationException ( message , set ) ; }
instantiate constraint violation exception .
12,266
public final SourceWriter getSourceWriter ( final JClassType pclassType , final GeneratorContext pcontext , final TreeLogger plogger ) { final String packageName = pclassType . getPackage ( ) . getName ( ) ; final String simpleName = pclassType . getSimpleSourceName ( ) + "Generated" ; final ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory ( packageName , simpleName ) ; composer . setSuperclass ( pclassType . getName ( ) ) ; composer . addImport ( "com.google.gwt.safehtml.shared.SafeHtml" ) ; composer . addImport ( "com.google.gwt.safehtml.shared.SafeHtmlUtils" ) ; final PrintWriter printWriter = pcontext . tryCreate ( plogger , packageName , simpleName ) ; if ( printWriter == null ) { return null ; } return composer . createSourceWriter ( pcontext , printWriter ) ; }
get source writer for the generator .
12,267
public GroupChain getGroupChainFor ( final Collection < Class < ? > > groups ) { if ( groups == null || groups . isEmpty ( ) ) { throw new IllegalArgumentException ( "At least one group has to be specified." ) ; } groups . forEach ( clazz -> { if ( ! validationGroupsMetadata . containsGroup ( clazz ) && ! validationGroupsMetadata . isSeqeuence ( clazz ) ) { throw new ValidationException ( "The class " + clazz + " is not a valid group or sequence." ) ; } } ) ; final GroupChain chain = new GroupChain ( ) ; groups . forEach ( clazz -> { if ( isGroupSequence ( clazz ) ) { insertSequence ( clazz , chain ) ; } else { final Group group = new Group ( clazz ) ; chain . insertGroup ( group ) ; insertInheritedGroups ( clazz , chain ) ; } } ) ; return chain ; }
Generates a chain of groups to be validated given the specified validation groups .
12,268
private void insertInheritedGroups ( final Class < ? > clazz , final GroupChain chain ) { validationGroupsMetadata . getParentsOfGroup ( clazz ) . forEach ( inheritedGroup -> { final Group group = new Group ( inheritedGroup ) ; chain . insertGroup ( group ) ; insertInheritedGroups ( inheritedGroup , chain ) ; } ) ; }
Recursively add inherited groups into the group chain .
12,269
public void init ( final ConstraintValidatorFactory factory , final MessageInterpolator messageInterpolator , final TraversableResolver traversableResolver , final ParameterNameProvider pparameterNameProvider ) { contraintValidatorFactory = factory ; this . messageInterpolator = messageInterpolator ; this . traversableResolver = traversableResolver ; parameterNameProvider = pparameterNameProvider ; }
initialize values .
12,270
public String getList ( ) { String result = "" ; int i = 1 ; for ( String s : mReps . keySet ( ) ) { result += ( i ++ ) + ". key='" + s + "', value='" + mReps . get ( s ) + "'\n" ; } return result ; }
Returns a String list of current representations useful for debugging
12,271
@ SuppressWarnings ( { "unchecked" } ) public final ArrayList < ConstraintViolation < ? > > getValidationErrorSet ( final Object pclass ) { return new ArrayList < > ( validationErrorSet . stream ( ) . map ( violation -> ConstraintViolationImpl . forBeanValidation ( violation . getMessageTemplate ( ) , Collections . emptyMap ( ) , Collections . emptyMap ( ) , violation . getMessage ( ) , ( ( SerializeableConstraintValidationImpl < Object > ) violation ) . getRootBeanClass ( ) , pclass , violation . getLeafBean ( ) , null , violation . getPropertyPath ( ) , violation . getConstraintDescriptor ( ) , null , null ) ) . collect ( Collectors . toList ( ) ) ) ; }
get validation error set .
12,272
@ SuppressWarnings ( { "rawtypes" , "unchecked" } ) public final void setValidationErrorSet ( final Set pvalidationErrorSet ) { validationErrorSet = new ArrayList < > ( ( List < SerializeableConstraintValidationImpl < ? > > ) pvalidationErrorSet . stream ( ) . map ( violation -> new SerializeableConstraintValidationImpl ( ( ConstraintViolation < ? > ) violation ) ) . collect ( Collectors . toList ( ) ) ) ; }
set validation error set .
12,273
@ SuppressWarnings ( { "rawtypes" , "unchecked" } ) public void initializeEditors ( final Object editor ) { if ( editor instanceof HasValueChangeHandlers && valueChangeHandler != null ) { ( ( HasValueChangeHandlers ) editor ) . addValueChangeHandler ( valueChangeHandler ) ; if ( validateOnVueChangeHandler != null ) { ( ( HasValueChangeHandlers ) editor ) . addValueChangeHandler ( validateOnVueChangeHandler ) ; } } if ( editor instanceof HasKeyUpHandlers && validateOnKeyUpHandler != null ) { ( ( HasKeyUpHandlers ) editor ) . addKeyUpHandler ( validateOnKeyUpHandler ) ; } if ( editor instanceof HasKeyPressHandlers && commitOnReturnHandler != null ) { ( ( HasKeyPressHandlers ) editor ) . addKeyPressHandler ( commitOnReturnHandler ) ; } }
initialize one editor .
12,274
public final String create ( ) throws UnableToCompleteException { final SourceWriter sourceWriter = getSourceWriter ( logger , context ) ; if ( sourceWriter != null ) { writeClassBody ( sourceWriter ) ; sourceWriter . commit ( logger ) ; } return getQualifiedName ( ) ; }
create logger .
12,275
public static String getSystemProperty ( String dKey , String shellKey , String defautValue ) { String value = System . getProperty ( dKey ) ; if ( value == null || value . length ( ) == 0 ) { value = System . getenv ( shellKey ) ; if ( value == null || value . length ( ) == 0 ) { value = defautValue ; } } return value ; }
Get system property
12,276
private boolean checkEsTin ( final String ptin ) { final char [ ] checkArray = { 'T' , 'R' , 'W' , 'A' , 'G' , 'M' , 'Y' , 'F' , 'P' , 'D' , 'X' , 'B' , 'N' , 'J' , 'Z' , 'S' , 'Q' , 'V' , 'H' , 'L' , 'C' , 'K' , 'E' } ; final char checkSum = ptin . charAt ( 8 ) ; final char calculatedCheckSum ; final int sum ; if ( StringUtils . isNumeric ( StringUtils . substring ( ptin , 0 , 8 ) ) ) { sum = Integer . parseInt ( StringUtils . substring ( ptin , 0 , 8 ) ) % 23 ; calculatedCheckSum = checkArray [ sum ] ; } else if ( ptin . charAt ( 0 ) >= 'X' && ptin . charAt ( 0 ) <= 'Z' ) { sum = Integer . parseInt ( ptin . charAt ( 0 ) - '0' + StringUtils . substring ( ptin , 1 , 8 ) ) % 23 ; calculatedCheckSum = checkArray [ sum ] ; } else { final char letter = ptin . charAt ( 0 ) ; final String number = StringUtils . substring ( ptin , 1 , 8 ) ; int evenSum = 0 ; int oddSum = 0 ; for ( int i = 0 ; i < number . length ( ) ; i ++ ) { int charAsNum = number . charAt ( i ) - '0' ; if ( i % 2 == 0 ) { charAsNum *= 2 ; oddSum += charAsNum < 10 ? charAsNum : charAsNum - 9 ; } else { evenSum += charAsNum ; } } final int control_digit = 10 - ( evenSum + oddSum ) % 10 ; final char control_letter = "JABCDEFGHI" . charAt ( control_digit ) ; switch ( letter ) { case 'A' : case 'B' : case 'E' : case 'H' : calculatedCheckSum = ( char ) ( control_digit + '0' ) ; break ; case 'K' : case 'P' : case 'Q' : case 'S' : calculatedCheckSum = control_letter ; break ; default : if ( control_letter == checkSum ) { calculatedCheckSum = control_letter ; } else { calculatedCheckSum = ( char ) ( control_digit + '0' ) ; } break ; } } return checkSum == calculatedCheckSum ; }
check the Tax Identification Number number country version for Spain .
12,277
public final void setCountryCode ( final String pcountryCode , final Locale plocale ) { if ( StringUtils . isEmpty ( pcountryCode ) ) { defaultCountryData = null ; } else { defaultCountryData = CreatePhoneCountryConstantsClass . create ( plocale ) . countryMap ( ) . get ( pcountryCode ) ; } }
set country code .
12,278
public final String formatE123International ( final String pphoneNumber , final String pcountryCode ) { return this . formatE123International ( this . parsePhoneNumber ( pphoneNumber , pcountryCode ) ) ; }
format phone number in E123 international format .
12,279
public final String formatE123National ( final String pphoneNumber , final String pcountryCode ) { return this . formatE123National ( this . parsePhoneNumber ( pphoneNumber , pcountryCode ) ) ; }
format phone number in E123 national format .
12,280
public final String formatDin5008 ( final PhoneNumberInterface pphoneNumberData , final PhoneCountryData pcountryData ) { if ( pphoneNumberData != null && StringUtils . equals ( pcountryData . getCountryCodeData ( ) . getCountryCode ( ) , pphoneNumberData . getCountryCode ( ) ) ) { return this . formatDin5008National ( pphoneNumberData ) ; } else { return this . formatDin5008International ( pphoneNumberData ) ; } }
format phone number in DIN 5008 format .
12,281
public final String formatDin5008National ( final String pphoneNumber , final String pcountryCode ) { return this . formatDin5008National ( this . parsePhoneNumber ( pphoneNumber , pcountryCode ) ) ; }
format phone number in DIN 5008 national format .
12,282
public final String formatRfc3966 ( final String pphoneNumber , final String pcountryCode ) { return this . formatRfc3966 ( this . parsePhoneNumber ( pphoneNumber , pcountryCode ) ) ; }
format phone number in RFC 3966 format .
12,283
public final String formatMs ( final String pphoneNumber , final String pcountryCode ) { return this . formatMs ( this . parsePhoneNumber ( pphoneNumber , pcountryCode ) ) ; }
format phone number in Microsoft canonical address format .
12,284
public final String formatCommon ( final PhoneNumberInterface pphoneNumberData , final PhoneCountryData pcountryData ) { if ( pphoneNumberData != null && pcountryData != null && StringUtils . equals ( pcountryData . getCountryCodeData ( ) . getCountryCode ( ) , pphoneNumberData . getCountryCode ( ) ) ) { return this . formatCommonNational ( pphoneNumberData ) ; } else { return this . formatCommonInternational ( pphoneNumberData ) ; } }
format phone number in common format .
12,285
public final String formatCommonInternational ( final String pphoneNumber , final String pcountryCode ) { return this . formatCommonInternational ( this . parsePhoneNumber ( pphoneNumber , pcountryCode ) ) ; }
format phone number in common international format .
12,286
public final String formatCommonNational ( final String pphoneNumber , final String pcountryCode ) { return this . formatCommonNational ( this . parsePhoneNumber ( pphoneNumber , pcountryCode ) ) ; }
format phone number in common national format .
12,287
public final String formatCommonNational ( final PhoneNumberInterface pphoneNumberData ) { final StringBuilder resultNumber = new StringBuilder ( ) ; if ( isPhoneNumberNotEmpty ( pphoneNumberData ) ) { PhoneCountryData phoneCountryData = null ; for ( final PhoneCountryCodeData country : CreatePhoneCountryConstantsClass . create ( ) . countryCodeData ( ) ) { if ( StringUtils . equals ( country . getCountryCode ( ) , pphoneNumberData . getCountryCode ( ) ) ) { phoneCountryData = country . getPhoneCountryData ( ) ; break ; } } if ( phoneCountryData == null ) { return null ; } resultNumber . append ( phoneCountryData . getTrunkCode ( ) ) . append ( ' ' ) ; resultNumber . append ( this . groupIntoParts ( pphoneNumberData . getAreaCode ( ) , 2 ) ) ; resultNumber . append ( " / " ) ; resultNumber . append ( this . groupIntoParts ( pphoneNumberData . getLineNumber ( ) , 2 ) ) ; if ( StringUtils . isNotBlank ( pphoneNumberData . getExtension ( ) ) ) { resultNumber . append ( " - " ) ; resultNumber . append ( this . groupIntoParts ( pphoneNumberData . getExtension ( ) , 2 ) ) ; } } return StringUtils . trimToNull ( resultNumber . toString ( ) ) ; }
format phone number in Common national format .
12,288
public final boolean isPhoneNumberEmpty ( final PhoneNumberInterface pphoneNumberData ) { return pphoneNumberData == null || StringUtils . isBlank ( pphoneNumberData . getCountryCode ( ) ) || StringUtils . isBlank ( pphoneNumberData . getLineNumber ( ) ) ; }
check if phone number is empty .
12,289
public GwtValidationContext < T > appendIndex ( final String name , final int index ) { final GwtValidationContext < T > temp = new GwtValidationContext < > ( this . rootBeanClass , this . rootBean , this . beanDescriptor , this . messageInterpolator , this . traversableResolver , this . validator , this . validatedObjects ) ; temp . path = PathImpl . createCopy ( this . path ) ; temp . path . addParameterNode ( name , index ) ; temp . path . makeLeafNodeIterable ( ) ; temp . path . makeLeafNodeIterableAndSetIndex ( index ) ; return temp ; }
Append an indexed node to the path .
12,290
public GwtValidationContext < T > appendIterable ( final String name ) { final GwtValidationContext < T > temp = new GwtValidationContext < > ( this . rootBeanClass , this . rootBean , this . beanDescriptor , this . messageInterpolator , this . traversableResolver , this . validator , this . validatedObjects ) ; temp . path = PathImpl . createCopy ( this . path ) ; temp . path . addPropertyNode ( name ) ; temp . path . makeLeafNodeIterable ( ) ; return temp ; }
Append an iterable node to the path .
12,291
public GwtValidationContext < T > appendKey ( final String name , final Object key ) { final GwtValidationContext < T > temp = new GwtValidationContext < > ( this . rootBeanClass , this . rootBean , this . beanDescriptor , this . messageInterpolator , this . traversableResolver , this . validator , this . validatedObjects ) ; temp . path = PathImpl . createCopy ( this . path ) ; temp . path . addPropertyNode ( name ) ; NodeImpl . makeIterableAndSetMapKey ( temp . path . getLeafNode ( ) , key ) ; return temp ; }
Append a keyed node to the path .
12,292
public < A extends Annotation , V > ConstraintValidatorContextImpl < A , V > createConstraintValidatorContext ( final ConstraintDescriptor < A > descriptor ) { return new ConstraintValidatorContextImpl < > ( PathImpl . createCopy ( this . path ) , descriptor ) ; }
create constraint validator context .
12,293
public DDF groupBy ( List < String > groupedColumns , List < String > aggregateFunctions ) throws DDFException { mGroupedColumns = groupedColumns ; return agg ( aggregateFunctions ) ; }
dplyr - like
12,294
public static void prepare ( ) throws InterruptedException { semaphore . acquire ( ) ; if ( cacheReference == masterCache ) { slaveCache . clear ( ) ; } else { masterCache . clear ( ) ; } }
Prepare to build cache
12,295
public static void switchCache ( ) throws InterruptedException { if ( cacheReference == masterCache ) { cacheReference = slaveCache ; masterCache . clear ( ) ; } else { cacheReference = masterCache ; slaveCache . clear ( ) ; } }
Switch online and standby cache
12,296
public static TextBox wrap ( final Element element ) { assert Document . get ( ) . getBody ( ) . isOrHasChild ( element ) ; final TextBox textBox = new TextBox ( element ) ; textBox . onAttach ( ) ; RootPanel . detachOnWindowClose ( textBox ) ; return textBox ; }
Creates a TextBox widget that wraps an existing &lt ; input type = text &gt ; element .
12,297
static < T > Predicate < T > createMostSpecificMatchPredicate ( final Iterable < T > source , final Function < T , Class < ? > > toClass ) { return input -> { final Class < ? > inputClass = toClass . apply ( input ) ; for ( final Class < ? > match : Iterables . transform ( source , toClass ) ) { if ( ! inputClass . equals ( match ) && inputClass . isAssignableFrom ( match ) ) { return false ; } } return true ; } ; }
Creates a Predicate that returns false if source contains an associated class that is a super type of the class associated with the tested T .
12,298
static Set < Class < ? > > findBestMatches ( final Class < ? > target , final Set < Class < ? > > availableClasses ) { final Set < Class < ? > > matches = new HashSet < > ( ) ; if ( availableClasses . contains ( target ) ) { return ImmutableSet . < Class < ? > > of ( target ) ; } else { for ( final Class < ? > clazz : availableClasses ) { if ( clazz . isAssignableFrom ( target ) ) { matches . add ( clazz ) ; } } } final Predicate < Class < ? > > moreSpecificClassPredicate = createMostSpecificMatchPredicate ( matches , Functions . < Class < ? > > identity ( ) ) ; return Sets . filter ( matches , moreSpecificClassPredicate ) ; }
Selects first only the classes that are assignable from the target and then returns the most specific matching classes .
12,299
@ SuppressWarnings ( "checkstyle:rightCurly" ) static < T > ImmutableList < T > sortMostSpecificFirst ( final Iterable < T > classes , final Function < T , Class < ? > > toClass ) { final List < T > working = Lists . newArrayList ( ) ; for ( final T t : classes ) { if ( ! working . contains ( t ) ) { working . add ( t ) ; } } final List < T > sorted = Lists . newArrayList ( ) ; final Predicate < T > mostSpecific = createMostSpecificMatchPredicate ( working , toClass ) ; boolean changed = false ; do { changed = false ; for ( final Iterator < T > iterator = working . iterator ( ) ; iterator . hasNext ( ) ; ) { final T t = iterator . next ( ) ; if ( mostSpecific . apply ( t ) ) { sorted . add ( t ) ; iterator . remove ( ) ; changed = true ; } } } while ( changed ) ; if ( ! working . isEmpty ( ) ) { throw new IllegalStateException ( "Unable to find a element that does not have a more specific element in the set " + working ) ; } return ImmutableList . copyOf ( sorted ) ; }
Returns a Immutable List sorted with the most specific associated class first . Each element is guaranteed to not be assignable to any element that appears before it in the list .