idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
39,000
public static String formatSQL ( String sql ) { if ( sql == null || sql . length ( ) == 0 ) return sql ; StringBuilder sb = new StringBuilder ( ) ; char [ ] chars = sql . toCharArray ( ) ; boolean addedSpace = false ; for ( char c : chars ) { if ( isInvisibleChar ( c ) ) { if ( ! addedSpace ) { sb . append ( " " ) ; ad...
Format all \ t \ r ... to
39,001
public Object getNextID ( NormalJdbcTool jdbc , Dialect dialect , Type dataType ) { int countOfRec = ( ( Number ) jdbc . nQueryForObject ( "select count(*) from " + table + " where " + pkColumnName + "=?" , pkColumnValue ) ) . intValue ( ) ; if ( countOfRec == 0 ) { jdbc . nUpdate ( "insert into " + table + "( " + pkCo...
Get the next Table Generator ID
39,002
private static List < Map < String , Object > > getEntityAnnos ( Object targetClass , String annotationName ) { Annotation [ ] anno = null ; if ( targetClass instanceof Field ) anno = ( ( Field ) targetClass ) . getAnnotations ( ) ; else anno = ( ( Class < ? > ) targetClass ) . getAnnotations ( ) ; List < Map < String ...
Get all entity annotations started with annotationName
39,003
private static Map < String , Object > changeAnnotationValuesToMap ( Annotation annotation , Class < ? extends Annotation > type ) { Map < String , Object > result = new HashMap < String , Object > ( ) ; result . put ( "AnnotationExist" , true ) ; for ( Method method : type . getDeclaredMethods ( ) ) try { result . put...
Change Annotation fields values into a Map
39,004
public static TableModel entity2ReadOnlyModel ( Class < ? > entityClass ) { DialectException . assureNotNull ( entityClass , "Entity class can not be null" ) ; TableModel model = globalTableModelCache . get ( entityClass ) ; if ( model != null ) return model ; model = entity2ModelWithConfig ( entityClass ) ; model . se...
Convert entity class to a read - only TableModel instance
39,005
public static TableModel [ ] entity2ReadOnlyModel ( Class < ? > ... entityClasses ) { List < TableModel > l = new ArrayList < TableModel > ( ) ; for ( Class < ? > clazz : entityClasses ) { l . add ( entity2ReadOnlyModel ( clazz ) ) ; } return l . toArray ( new TableModel [ l . size ( ) ] ) ; }
Convert entity classes to a read - only TableModel instances
39,006
public static TableModel [ ] entity2EditableModels ( Class < ? > ... entityClasses ) { List < TableModel > l = new ArrayList < TableModel > ( ) ; for ( Class < ? > clazz : entityClasses ) { l . add ( entity2EditableModel ( clazz ) ) ; } return l . toArray ( new TableModel [ l . size ( ) ] ) ; }
Convert entity classes to a editable TableModel instances
39,007
public static Method checkMethodExist ( Class < ? > clazz , String uniqueMethodName ) { if ( clazz == null || StrUtils . isEmpty ( uniqueMethodName ) ) return null ; Map < String , Object > methodMap = uniqueMethodCache . get ( clazz ) ; if ( methodMap != null && ! methodMap . isEmpty ( ) ) { Object result = methodMap ...
Check if a unique method name exists in class if exist return the method otherwise return null
39,008
public static Map < String , Method > getClassReadMethods ( Class < ? > clazz ) { Map < String , Method > readMethods = classReadMethods . get ( clazz ) ; if ( readMethods == null ) { cacheReadWriteMethodsAndBoxField ( clazz ) ; return classReadMethods . get ( clazz ) ; } else return readMethods ; }
Return cached class read methods to avoid each time use reflect
39,009
public static Method getClassFieldReadMethod ( Class < ? > clazz , String fieldName ) { return getClassReadMethods ( clazz ) . get ( fieldName ) ; }
Return cached class field read method to avoid each time use reflect
39,010
public static Map < String , Method > getClassWriteMethods ( Class < ? > clazz ) { Map < String , Method > writeMethods = classWriteMethods . get ( clazz ) ; if ( writeMethods == null ) { cacheReadWriteMethodsAndBoxField ( clazz ) ; return classWriteMethods . get ( clazz ) ; } else return writeMethods ; }
Return cached class write methods to avoid each time use reflect
39,011
public static Method getClassFieldWriteMethod ( Class < ? > clazz , String fieldName ) { return getClassWriteMethods ( clazz ) . get ( fieldName ) ; }
Return cached class field write method to avoid each time use reflect
39,012
public static Object readValueFromBeanField ( Object entityBean , String fieldName ) { Method readMethod = ClassCacheUtils . getClassFieldReadMethod ( entityBean . getClass ( ) , fieldName ) ; if ( readMethod == null ) { throw new DialectException ( "No mapping found for field '" + fieldName + "' in '" + entityBean . g...
Read value from entityBean field
39,013
public static void writeValueToBeanField ( Object entityBean , String fieldName , Object value ) { Method writeMethod = ClassCacheUtils . getClassFieldWriteMethod ( entityBean . getClass ( ) , fieldName ) ; if ( writeMethod == null ) { throw new DialectException ( "Can not find Java bean read method '" + fieldName + "'...
write value to entityBean field
39,014
DialectSqlItem [ ] seperateCharsToItems ( char [ ] chars , int start , int end ) { List < DialectSqlItem > items = new ArrayList < DialectSqlItem > ( ) ; SearchResult result = findFirstResult ( chars , start , end ) ; while ( result != null ) { items . add ( result . item ) ; result = findFirstResult ( chars , result ....
Separate chars to Items list
39,015
void correctType ( DialectSqlItem item ) { if ( item . type == 'U' ) { String valueStr = ( String ) item . value ; String valueUpcase = valueStr . toUpperCase ( ) ; String funPrefix = Dialect . getGlobalSqlFunctionPrefix ( ) ; if ( ! StrUtils . isEmpty ( valueUpcase ) ) { if ( ! StrUtils . isEmpty ( funPrefix ) && StrU...
if is U type use this method to correct type
39,016
String join ( Dialect d , boolean isTopLevel , DialectSqlItem function , DialectSqlItem [ ] items ) { int pos = 0 ; for ( DialectSqlItem item : items ) { if ( item . subItems != null ) { String value ; if ( pos > 0 && items [ pos - 1 ] != null && items [ pos - 1 ] . type == 'F' ) value = join ( d , false , items [ pos ...
Join items list into one String if function is null join as String otherwise treat as function parameters
39,017
public synchronized long nextId ( ) { long currTimestamp = timestampGen ( ) ; if ( currTimestamp < lastTimestamp ) { throw new IllegalStateException ( String . format ( "Clock moved backwards. Refusing to generate id for %d milliseconds" , lastTimestamp - currTimestamp ) ) ; } if ( currTimestamp == lastTimestamp ) { se...
generate an unique and incrementing id
39,018
public long [ ] parseId ( long id ) { long [ ] arr = new long [ 5 ] ; arr [ 4 ] = ( ( id & diode ( unusedBits , timestampBits ) ) >> timestampShift ) ; arr [ 0 ] = arr [ 4 ] + epoch ; arr [ 1 ] = ( id & diode ( unusedBits + timestampBits , datacenterIdBits ) ) >> datacenterIdShift ; arr [ 2 ] = ( id & diode ( unusedBit...
extract time stamp datacenterId workerId and sequence number information from the given id
39,019
public String formatId ( long id ) { long [ ] arr = parseId ( id ) ; String tmf = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss.SSS" ) . format ( new Date ( arr [ 0 ] ) ) ; return String . format ( "%s, #%d, @(%d,%d)" , tmf , arr [ 3 ] , arr [ 1 ] , arr [ 2 ] ) ; }
extract and display time stamp datacenterId workerId and sequence number information from the given id in humanization format
39,020
private long diode ( long offset , long length ) { int lb = ( int ) ( 64 - offset ) ; int rb = ( int ) ( 64 - ( offset + length ) ) ; return ( - 1L << lb ) ^ ( - 1L << rb ) ; }
a diode is a long value whose left and right margin are ZERO while middle bits are ONE in binary string layout . it looks like a diode in shape .
39,021
public static Type toType ( Class < ? > clazz ) { Type t = SQL_MAP_ABLE_TYPES . get ( clazz ) ; if ( t == null ) return Type . OTHER ; else return t ; }
Convert a Class type to Dialect s Type
39,022
public static Type toType ( String columnDef ) { if ( "BIGINT" . equalsIgnoreCase ( columnDef ) ) return Type . BIGINT ; if ( "BINARY" . equalsIgnoreCase ( columnDef ) ) return Type . BINARY ; if ( "BIT" . equalsIgnoreCase ( columnDef ) ) return Type . BIT ; if ( "BLOB" . equalsIgnoreCase ( columnDef ) ) return Type . ...
Convert column definition String to Dialect s Type
39,023
public static Type javaSqlTypeToDialectType ( int javaSqlType ) { switch ( javaSqlType ) { case java . sql . Types . BIT : return Type . BIT ; case java . sql . Types . TINYINT : return Type . TINYINT ; case java . sql . Types . SMALLINT : return Type . SMALLINT ; case java . sql . Types . INTEGER : return Type . INTEG...
Convert java . sql . Types . xxx type to Dialect s Type
39,024
public ColumnModel sequenceGenerator ( String name , String sequenceName , Integer initialValue , Integer allocationSize ) { makeSureTableModelExist ( ) ; this . tableModel . sequenceGenerator ( name , sequenceName , initialValue , allocationSize ) ; this . idGenerationType = GenerationType . SEQUENCE ; this . idGenera...
The value of this column will be generated by a sequence
39,025
public ColumnModel entityField ( String entityFieldName ) { DialectException . assureNotEmpty ( entityFieldName , "entityFieldName can not be empty" ) ; this . entityField = entityFieldName ; if ( this . tableModel != null ) { List < ColumnModel > oldColumns = this . tableModel . getColumns ( ) ; Iterator < ColumnModel...
Mark this column map to a Java entity field if exist other columns map to this field delete other columns . This method only designed for ORM tool
39,026
protected static String initializePaginSQLTemplate ( Dialect d ) { switch ( d ) { case Cache71Dialect : case DB2390Dialect : case DB2390V8Dialect : case FrontBaseDialect : case InformixDialect : case IngresDialect : case JDataStoreDialect : case MckoiDialect : case MimerSQLDialect : case PointbaseDialect : case Progres...
Return pagination template of this Dialect
39,027
public static void db2JavaSrcFiles ( DataSource ds , Dialect dialect , boolean linkStyle , boolean activeRecord , String packageName , String outputfolder ) { Connection conn = null ; try { conn = ds . getConnection ( ) ; TableModel [ ] models = db2Models ( conn , dialect ) ; for ( TableModel model : models ) { File wr...
Read database structure and write them to Java entity class source code
39,028
public static void bindGlobalModel ( Class < ? > entityClass , TableModel tableModel ) { TableModelUtilsOfEntity . globalTableModelCache . put ( entityClass , tableModel ) ; }
This method bind a tableModel to a entity class this is a global setting
39,029
public void tableGenerator ( String name , String tableName , String pkColumnName , String valueColumnName , String pkColumnValue , Integer initialValue , Integer allocationSize ) { checkReadOnly ( ) ; addGenerator ( new TableIdGenerator ( name , tableName , pkColumnName , valueColumnName , pkColumnValue , initialValue...
Add a TableGenerator
39,030
public void uuidAny ( String name , Integer length ) { checkReadOnly ( ) ; addGenerator ( new UUIDAnyGenerator ( name , length ) ) ; }
Add a UUIDAnyGenerator
39,031
public void addGenerator ( IdGenerator generator ) { checkReadOnly ( ) ; DialectException . assureNotNull ( generator ) ; DialectException . assureNotNull ( generator . getGenerationType ( ) ) ; DialectException . assureNotEmpty ( generator . getIdGenName ( ) , "IdGenerator name can not be empty" ) ; getIdGenerators ( ...
Add a create table ... DDL to generate ID similar like JPA s TableGen
39,032
public TableModel addColumn ( ColumnModel column ) { checkReadOnly ( ) ; DialectException . assureNotNull ( column ) ; DialectException . assureNotEmpty ( column . getColumnName ( ) , "Column's columnName can not be empty" ) ; column . setTableModel ( this ) ; columns . add ( column ) ; return this ; }
Add a ColumnModel
39,033
public TableModel removeColumn ( String columnName ) { checkReadOnly ( ) ; List < ColumnModel > oldColumns = this . getColumns ( ) ; Iterator < ColumnModel > columnIter = oldColumns . iterator ( ) ; while ( columnIter . hasNext ( ) ) if ( columnIter . next ( ) . getColumnName ( ) . equalsIgnoreCase ( columnName ) ) col...
Remove a ColumnModel by given columnName
39,034
public TableModel removeFKey ( String fkeyName ) { checkReadOnly ( ) ; List < FKeyModel > fkeys = getFkeyConstraints ( ) ; Iterator < FKeyModel > fkeyIter = fkeys . iterator ( ) ; while ( fkeyIter . hasNext ( ) ) if ( fkeyIter . next ( ) . getFkeyName ( ) . equalsIgnoreCase ( fkeyName ) ) fkeyIter . remove ( ) ; return...
Remove a FKey by given fkeyName
39,035
public ColumnModel column ( String columnName ) { for ( ColumnModel columnModel : columns ) { if ( columnModel . getColumnName ( ) != null && columnModel . getColumnName ( ) . equalsIgnoreCase ( columnName ) ) return columnModel ; if ( columnModel . getEntityField ( ) != null && columnModel . getEntityField ( ) . equal...
find column in tableModel by given columnName if not found add a new column with columnName
39,036
public ColumnModel addColumn ( String columnName ) { checkReadOnly ( ) ; DialectException . assureNotEmpty ( columnName , "columnName can not be empty" ) ; for ( ColumnModel columnModel : columns ) if ( columnName . equalsIgnoreCase ( columnModel . getColumnName ( ) ) ) throw new DialectException ( "ColumnModel name '"...
Add a column with given columnName to tableModel
39,037
public ColumnModel getColumn ( String colOrFieldName ) { for ( ColumnModel columnModel : columns ) { if ( columnModel . getColumnName ( ) != null && columnModel . getColumnName ( ) . equalsIgnoreCase ( colOrFieldName ) ) return columnModel ; if ( columnModel . getEntityField ( ) != null && columnModel . getEntityField ...
Get ColumnModel by column Name or field name ignore case if not found return null
39,038
public ColumnModel getColumnByColName ( String colName ) { for ( ColumnModel columnModel : columns ) { if ( columnModel . getColumnName ( ) != null && columnModel . getColumnName ( ) . equalsIgnoreCase ( colName ) ) return columnModel ; } return null ; }
Get ColumnModel by columnName ignore case if not found return null
39,039
public ColumnModel getColumnByFieldName ( String fieldName ) { for ( ColumnModel columnModel : columns ) if ( columnModel . getEntityField ( ) != null && columnModel . getEntityField ( ) . equalsIgnoreCase ( fieldName ) ) return columnModel ; return null ; }
Get ColumnModel by entity field name ignore case if not found return null
39,040
public FKeyModel getFkey ( String fkeyName ) { if ( fkeyConstraints == null ) return null ; for ( FKeyModel fkey : fkeyConstraints ) if ( ! StrUtils . isEmpty ( fkeyName ) && fkeyName . equalsIgnoreCase ( fkey . getFkeyName ( ) ) ) return fkey ; return null ; }
Get a FKeyModel by given fkeyName
39,041
public IdGenerator getIdGenerator ( GenerationType generationType , String name ) { return getIdGenerator ( generationType , name , getIdGenerators ( ) ) ; }
Search and return the IdGenerator in this TableModel by its generationType and name
39,042
public static IdGenerator getIdGenerator ( GenerationType generationType , String name , List < IdGenerator > idGeneratorList ) { IdGenerator idGen = getIdGeneratorByType ( generationType ) ; if ( idGen != null ) return idGen ; if ( StrUtils . isEmpty ( name ) ) return null ; for ( IdGenerator idGenerator : idGenerator...
Get a IdGenerator by type if not found search by name
39,043
@ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public List < ColumnModel > getPKeyColsSortByColumnName ( ) { List < ColumnModel > pkeyCols = new ArrayList < ColumnModel > ( ) ; for ( ColumnModel col : columns ) if ( col . getPkey ( ) && ! col . getTransientable ( ) ) pkeyCols . add ( col ) ; Collections . sort ( p...
Get pkey columns sorted by column name
39,044
public static Reader createReaderForFile ( File source , Encoding encoding ) throws FileNotFoundException , UnsupportedEncodingException { return createReaderForInputStream ( new FileInputStream ( source ) , encoding ) ; }
Instanciate a Reader for a file using the given encoding .
39,045
public static Map < String , String > loadBundle ( List < URL > sources , Encoding encoding , String newline ) throws IOException , SyntaxErrorException { Map < String , String > _result = new HashMap < String , String > ( ) ; for ( URL _source : sources ) { Map < String , String > _properties = loadProperties ( _sourc...
Load a collection of properties files into the same Map supports multiple lines values .
39,046
public static Map < String , String > loadResourceBundle ( String bundleName , Encoding encoding , String newline ) throws IOException , SyntaxErrorException , MissingResourceException { return loadResourceBundle ( bundleName , encoding , newline , Locale . getDefault ( ) ) ; }
Load a properties file looking for localized versions like ResourceBundle using the default Locale supporting multiple line values .
39,047
public static Map < String , String > loadResourceBundle ( String bundleName , Encoding encoding , String newline , Locale locale ) throws IOException , SyntaxErrorException , MissingResourceException { String _baseName = bundleName . replace ( "." , "/" ) ; List < URL > _bundle = new ArrayList < URL > ( 3 ) ; URL _res...
Load a properties file looking for localized versions like ResourceBundle supporting multiple line values .
39,048
public static void readPropertiesToListeners ( InputStream source , Encoding encoding , PropertiesParsingListener ... listeners ) throws IOException , SyntaxErrorException { BufferedReader _reader = new BufferedReader ( createReaderForInputStream ( source , encoding ) ) ; LineByLinePropertyParser _parser = new LineByLi...
Read a file of properties and notifies all the listeners for each property .
39,049
public void setConfigurationProperty ( final String name , final Object value ) { if ( XIncProcConfiguration . ALLOW_FIXUP_BASE_URIS . equals ( name ) ) { if ( value instanceof Boolean ) { this . baseUrisFixup = ( Boolean ) value ; } else if ( value instanceof String ) { this . baseUrisFixup = Boolean . valueOf ( ( Str...
Sets configuration property .
39,050
private static String translateEncoding ( final String encodingName ) throws UnsupportedEncodingException { try { String _encoding = encodingName . trim ( ) . toLowerCase ( ) ; String _encodingCode = theEncodingResource . getString ( _encoding ) ; return _encodingCode ; } catch ( MissingResourceException _exception ) {...
Get the java encoding name from a standard encoding name .
39,051
public final void convertFile ( final String inputFileName , final String outputFileName ) throws IOException , ConversionException { openInputFile ( inputFileName ) ; openOutputFile ( outputFileName ) ; doConvertFile ( myLineReader , myBufferedWriter ) ; closeOutputFile ( ) ; closeInputFile ( ) ; }
The file conversion process .
39,052
private void openInputFile ( final String inputFileName ) throws IOException { myInputFile = new File ( inputFileName ) ; myInputStream = new FileInputStream ( myInputFile ) ; myStreamReader = new InputStreamReader ( myInputStream , getInputEncodingCode ( ) ) ; myBufferedReader = new BufferedReader ( myStreamReader ) ;...
Prepare the input stream .
39,053
private void openOutputFile ( final String outputFileName ) throws IOException { myOutputFile = new File ( outputFileName ) ; myOutputStream = new FileOutputStream ( myOutputFile ) ; myStreamWriter = new OutputStreamWriter ( myOutputStream , getOutputEncodingCode ( ) ) ; myBufferedWriter = new BufferedWriter ( myStream...
Prepare the output stream .
39,054
public static Integer getKeyEvent ( String key ) throws NoSuchElementException { key = key . toUpperCase ( ) ; Integer _result = theKeyTable . get ( key ) ; if ( null == _result ) { throw new NoSuchElementException ( key ) ; } return ( _result ) ; }
Return an Integer representing a KeyEvent .
39,055
public static KeyStroke getKeyStroke ( String key ) throws NoSuchElementException { key = key . toUpperCase ( ) ; int _sep = key . indexOf ( "/" ) ; String _mask = key . substring ( 0 , _sep ) ; String _keyCode = key . substring ( _sep + 1 ) ; Integer _m = theMaskTable . get ( _mask ) ; Integer _t = theKeyTable . get (...
Return a KeyStroke corresponding to the given code .
39,056
public static void snapWindowTo ( Window win , int location ) { Dimension _screen = Toolkit . getDefaultToolkit ( ) . getScreenSize ( ) ; Dimension _window = win . getSize ( ) ; int _wx = 0 ; int _wy = 0 ; switch ( location ) { case TOP_LEFT : break ; case TOP_CENTER : _wx = ( _screen . width - _window . width ) / 2 ; ...
Snap the Window Position to a special location .
39,057
public synchronized void parseLine ( String line ) throws SyntaxErrorException { if ( null != getParserOutcome ( ) && isParserOutcomeMultipleLine ( ) ) { parseLine__multipleLineMode ( line ) ; } else { parseLine__singleLineMode ( line ) ; } }
Parse the given line and update the internal state of the parser .
39,058
private void fireMultipleLinePropertyParsedEvent ( String name , String [ ] value ) { MultipleLinePropertyParsedEvent _event = new MultipleLinePropertyParsedEvent ( name , value ) ; for ( PropertiesParsingListener _listener : getListeners ( ) ) { _listener . onMultipleLinePropertyParsed ( _event ) ; } }
Notify listeners that a multiple line property has been parsed .
39,059
private void fireSingleLinePropertyParsedEvent ( String name , String value ) { SingleLinePropertyParsedEvent _event = new SingleLinePropertyParsedEvent ( name , value ) ; for ( PropertiesParsingListener _listener : getListeners ( ) ) { _listener . onSingleLinePropertyParsed ( _event ) ; } }
Notify listeners that a single line property has been parsed .
39,060
private void parseLine__multipleLineMode ( String line ) { boolean _leftTrim = ( FinalState . IS_MULTIPLE_LINE_LEFT_TRIM == getParserOutcome ( ) ) ; parseLine__multipleLineMode__appendLineUnlessEndTag ( line , _leftTrim ) ; }
Line parsing when inside a multiple line property definition .
39,061
private void parseLine__singleLineMode ( String line ) throws SyntaxErrorException { setPropertyNameStart ( POSITION__NOT_SET ) ; setPropertyNameEnd ( POSITION__NOT_SET ) ; setRestOfLineStart ( POSITION__NOT_SET ) ; int _nextStateIndex = 0 ; State _currentState = null ; char [ ] _nextChar = new char [ 1 ] ; for ( int _...
Default line parsing if a heredoc syntax is detected next lines will be parsed in multiple line mode .
39,062
public final void removeAttribute ( final Element root , final String selector , final String attribute ) { final Iterable < Element > elements ; checkNotNull ( root , "Received a null pointer as root element" ) ; checkNotNull ( selector , "Received a null pointer as selector" ) ; checkNotNull ( attribute , "Received a...
Finds a set of elements through a CSS selector and removes the received attribute from them if they have it .
39,063
public final void retag ( final Element root , final String selector , final String tag ) { final Iterable < Element > elements ; checkNotNull ( root , "Received a null pointer as root element" ) ; checkNotNull ( selector , "Received a null pointer as selector" ) ; checkNotNull ( tag , "Received a null pointer as tag" ...
Finds a set of elements through a CSS selector and changes their tags .
39,064
public final void swapTagWithParent ( final Element root , final String selector ) { final Iterable < Element > elements ; Element parent ; String text ; checkNotNull ( root , "Received a null pointer as root element" ) ; checkNotNull ( selector , "Received a null pointer as selector" ) ; elements = root . select ( sel...
Finds a set of elements through a CSS selector and swaps its tag with that from its parent .
39,065
public final void wrap ( final Element root , final String selector , final String wrapper ) { final Iterable < Element > elements ; checkNotNull ( root , "Received a null pointer as root element" ) ; checkNotNull ( selector , "Received a null pointer as selector" ) ; checkNotNull ( wrapper , "Received a null pointer a...
Finds a set of elements through a CSS selector and wraps them with the received wrapper element .
39,066
public static UnitConverter getCachedInstance ( int pixelPerInch ) { Integer _key = new Integer ( pixelPerInch ) ; if ( ! theCache . containsKey ( _key ) ) { theCache . put ( _key , new UnitConverter ( pixelPerInch ) ) ; } return theCache . get ( _key ) ; }
Retrieve from the cache or create if not cached yet a unit converter setted for the given pixel per inch value .
39,067
private void updateReadyness ( ) { StringBuffer _buffer = new StringBuffer ( ) ; if ( null == myMessageProvider ) { _buffer . append ( NO_MESSAGE_PROVIDER ) ; } if ( null == myIconProvider ) { if ( _buffer . length ( ) > 0 ) { _buffer . append ( COMMA ) ; } _buffer . append ( NO_ICON_PROVIDER ) ; } if ( _buffer . lengt...
Do the self diagnostic and update the status .
39,068
public static RadioButton create ( String name , String value , String idSuffix , String label , boolean isSelected , boolean isDisabled ) { RadioButton _result = new RadioButton ( ) ; _result . setName ( name ) ; _result . setValue ( value ) ; if ( IS_NOT_EMPTY . test ( idSuffix ) ) { _result . setIdSuffix ( idSuffix ...
Create a fully specified radio button .
39,069
public String execute ( final String pointerStr , final Source source ) { try { final StringWriter stringWriter = new StringWriter ( ) ; final Serializer serializer = processor . newSerializer ( stringWriter ) ; serializer . setOutputProperty ( Serializer . Property . OMIT_XML_DECLARATION , "yes" ) ; executeToDestinati...
Execute xpointer expression on a xml source returning a xml string
39,070
public String verifyXPathExpression ( final Iterable < XmlNsScheme > xmlNsSchemes , final String xpathExpression ) { LOG . trace ( "verifyXPathExpression: {}" , xpathExpression ) ; final XPathCompiler xPathCompiler = processor . newXPathCompiler ( ) ; for ( final XmlNsScheme xmlNsScheme : xmlNsSchemes ) { final String ...
Utility method for verifying xpath expression
39,071
public static XIncludeContext newContext ( final XIncludeContext contextToCopy ) { final XIncludeContext newContext = new XIncludeContext ( contextToCopy . configuration ) ; newContext . currentBaseURI = contextToCopy . currentBaseURI ; newContext . basesURIDeque . addAll ( contextToCopy . basesURIDeque ) ; newContext ...
Create a new context by deep copy of an existant one .
39,072
public void updateContextWithElementAttributes ( final Attributes attributes ) throws XIncludeFatalException { extractCurrentBaseURI ( attributes ) ; if ( ofNullable ( this . currentBaseURI ) . isPresent ( ) ) { addBaseURIPath ( this . currentBaseURI ) ; } }
Update context with element attributes .
39,073
public void addInInclusionChain ( final URI path , final String pointer ) throws XIncludeFatalException { final String xincludePath = path . toASCIIString ( ) + ( ( null != pointer ) ? ( '#' + pointer ) : "" ) ; if ( this . xincludeDeque . contains ( xincludePath ) ) { throw new XIncludeFatalException ( "Inclusion Loop...
Add in inclusion chain .
39,074
public Node find ( String nodeName ) { if ( IS_EMPTY . test ( nodeName ) ) { throw new IllegalArgumentException ( "The node name should not be empty" ) ; } Node _result = null ; while ( hasMoreAvailableElement ( ) && ( null == _result ) ) { int _position = getPosition ( ) ; Node _current = getSource ( ) . item ( _posit...
Find the next node having the specified node name .
39,075
public static Option create ( String value , String label , boolean isSelected ) { Option _result = new Option ( ) ; _result . setValue ( value ) ; _result . setLabel ( label ) ; _result . setSelected ( isSelected ) ; return _result ; }
Create a fully specified option .
39,076
public String getHtmlCode ( ) { Object [ ] _params = { SgmlUtils . generateAttribute ( HtmlUtils . AttributeNames . VALUE , getValue ( ) ) } ; MessageFormat _format = ( isSelected ( ) ) ? FORMAT__SELECTED : FORMAT__NOT_SELECTED ; return _format . format ( _params ) ; }
Generate the html code for the option .
39,077
public T orElseDoAndReturnDefault ( Consumer < Result < T > > consumer , T defaultVal ) { if ( isSuccessAndNotNull ( ) ) { return data ; } consumer . accept ( this ) ; return defaultVal ; }
The consumer function receives the entire result object as parameter in case you want to log or manage the error message or code in any way .
39,078
public static Charset getCharset ( final InputStream inputStream ) throws IOException { final Charset resultCharset ; final byte [ ] buffer = new byte [ 192 ] ; final int reading = ByteStreams . read ( inputStream , buffer , 0 , 192 ) ; if ( 4 > reading ) { resultCharset = Charset . forName ( EncodingUtils . DEFAULT_EN...
Gets charset of an inputstream .
39,079
public static FluidFlowPanelModel createFluidFlowPanel ( int horizontalGap , int verticalGap ) { FlowLayout _flowLayout = new FlowLayout ( FlowLayout . LEFT , horizontalGap , verticalGap ) ; return FluidFlowPanelModel . createFluidFlowPanel ( _flowLayout ) ; }
Create a scrollable panel .
39,080
public static JPanel createPanelWithHorizontalLayout ( ) { JPanel _panel = new JPanel ( ) ; _panel . setLayout ( new BoxLayout ( _panel , BoxLayout . X_AXIS ) ) ; return _panel ; }
Create a panel that lays out components horizontally .
39,081
public static JPanel createPanelWithVerticalLayout ( ) { JPanel _panel = new JPanel ( ) ; _panel . setLayout ( new BoxLayout ( _panel , BoxLayout . Y_AXIS ) ) ; return _panel ; }
Create a panel that lays out components vertically .
39,082
public static Icon getImageIcon ( ClassLoader objectLoader , String fileName ) throws UrlProviderException { return getImageIcon ( new ClassLoaderUrlProvider ( objectLoader ) , fileName ) ; }
Create an Image icon from a String .
39,083
public static Icon getImageIcon ( UrlProvider urlProvider , String fileName ) throws UrlProviderException { URL _icon = urlProvider . getUrl ( fileName ) ; return new ImageIcon ( _icon ) ; }
Create an Image based icon from a String .
39,084
public static String encloseInParagraphe ( String value ) { Object [ ] _params = { value } ; return FORMAT_PARAGRAPH . format ( _params ) ; }
Create a HTML paragraph from the given text .
39,085
public static String generateAttribute ( String attributeName , String value ) { return SgmlUtils . generateAttribute ( attributeName , value ) ; }
Generate the HTML code for an attribute .
39,086
public static final boolean matchSequence ( byte [ ] sequence , byte [ ] buffer , int offset ) { boolean _result = ( sequence . length < ( buffer . length - offset ) ) ; if ( _result ) { for ( int _index = 0 ; _index < sequence . length ; _index ++ ) { if ( buffer [ _index ] != sequence [ _index ] ) { _result = false ;...
Verify that each byte of a buffer match the corresponding byte of a given sequence starting from an offset .
39,087
public static StringBuffer appendByteAsPaddedHexString ( byte value , StringBuffer buffer ) { return buffer . append ( printHexBinary ( new byte [ ] { value } ) . toLowerCase ( ) ) ; }
Convert a byte into a padded hexadecimal string .
39,088
public static StringBuffer appendBytesAsPaddedHexString ( byte [ ] values , StringBuffer buffer ) { return buffer . append ( printHexBinary ( values ) . toLowerCase ( ) ) ; }
Convert a sequence of bytes into a padded hexadecimal string .
39,089
private void refreshId ( ) { if ( null == getName ( ) ) { setId ( null ) ; } else { if ( null == getIdSuffix ( ) ) { setId ( getName ( ) ) ; } else { setId ( getName ( ) + getIdSuffix ( ) ) ; } } }
Re - compute the id of the element .
39,090
private void outputReportLine ( List < String > report , MessageFormat template , String [ ] textLines , int currentLine ) { Object [ ] _args = { currentLine , textLines [ currentLine ] } ; report . add ( template . format ( _args ) ) ; }
Add a report line the designated line .
39,091
private void outputRangeOfTextInReport ( List < String > report , MessageFormat template , String [ ] textLines , int startLine , int endLine ) { for ( int _temp = startLine ; _temp < endLine ; _temp ++ ) { outputReportLine ( report , template , textLines , _temp ) ; } }
Add a report line for each designated line .
39,092
private int findNextMatchingLine ( String [ ] textLines , int startingLine , String textToMatch ) { int _foundLeft = - 1 ; { int _tempLine = startingLine + 1 ; while ( _tempLine < textLines . length ) { String _tempText = getTextLine ( textLines , _tempLine ) ; if ( _tempText . equals ( textToMatch ) ) { _foundLeft = _...
Find the matching line if any .
39,093
private String getTextLine ( String [ ] textLines , int line ) { return ( isIgnoreTrailingWhiteSpaces ( ) ) ? textLines [ line ] . trim ( ) : textLines [ line ] ; }
Return the specified line from the text .
39,094
public static String [ ] reportDiff ( String [ ] textOnLeft , String [ ] textOnRight , boolean ignoreEmptyLines , boolean ignoreTrailingWhiteSpaces ) { QuickDiff _instance = new QuickDiff ( ) ; _instance . setIgnoreEmptyLines ( ignoreEmptyLines ) ; _instance . setIgnoreTrailingWhiteSpaces ( ignoreTrailingWhiteSpaces ) ...
Macro to compute a diff report .
39,095
public static Object getObject ( final ResourceBundle source , final String key , final Object defaultValue ) { try { return source . getObject ( key ) ; } catch ( Exception _exception ) { return defaultValue ; } }
Return an object from a ResourceBundle .
39,096
public static Object getObject ( final Map < String , Object > source , final String key , final Object defaultValue ) { try { return source . get ( key ) ; } catch ( Exception _exception ) { return defaultValue ; } }
Return an object from a Map .
39,097
public static String getString ( final ResourceBundle source , final String key , final String defaultValue ) { try { return source . getString ( key ) ; } catch ( Exception _exception ) { return defaultValue ; } }
Return an string from a ResourceBundle .
39,098
public static String generateAttribute ( String attributeName , String value ) { Object [ ] _args = { attributeName , SGML_VALUE_ENCODER . apply ( value ) } ; return MESSAGE_FORMAT__ATTRIBUT . format ( _args ) ; }
Generate an attribute of the specified name and value .
39,099
public void addDefaultProcessor ( NodeProcessor processor ) { if ( null == processor ) { throw new IllegalArgumentException ( "Processor should not be null." ) ; } getActionPool ( ) . put ( NODE_NAME__DEFAULT , processor ) ; }
Add a default processing that will be applied when no specific processor is found .