idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
128,200
private void generateRxInterface ( String daoFactory , RxInterfaceType interfaceType , Class < ? > clazz ) { { ParameterizedTypeName parameterizedTypeName = ParameterizedTypeName . get ( ClassName . get ( clazz ) , TypeVariableName . get ( "T" ) ) ; String preExecutorName = clazz . getSimpleName ( ) . replace ( "Emitte...
Generate rx interface .
128,201
private static void generateEditor ( PrefsEntity entity ) { com . abubusoft . kripton . common . Converter < String , String > converter = CaseFormat . LOWER_CAMEL . converterTo ( CaseFormat . UPPER_CAMEL ) ; Builder innerClassBuilder = TypeSpec . classBuilder ( "BindEditor" ) . addModifiers ( Modifier . PUBLIC ) . add...
create editor .
128,202
private static void generateInstance ( String className ) { builder . addField ( FieldSpec . builder ( className ( className ) , "instance" , Modifier . PRIVATE , Modifier . STATIC ) . addJavadoc ( "instance of shared preferences\n" ) . build ( ) ) ; MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "ge...
Generate instance of shared preferences .
128,203
private static void generateRefresh ( String sharedPreferenceName , String className ) { MethodSpec . Builder method = MethodSpec . methodBuilder ( "refresh" ) . addModifiers ( Modifier . PUBLIC ) . addJavadoc ( "force to refresh values\n" ) . returns ( className ( className ) ) ; method . addStatement ( "createPrefs()...
Generate refresh .
128,204
private static void generateResetMethod ( PrefsEntity entity ) { MethodSpec . Builder method = MethodSpec . methodBuilder ( "reset" ) . addModifiers ( Modifier . PUBLIC ) . addJavadoc ( "reset shared preferences\n" ) . returns ( Void . TYPE ) ; if ( entity . isImmutablePojo ( ) ) { ImmutableUtility . generateImmutableV...
Generate reset method .
128,205
private static void generateWriteMethod ( PrefsEntity entity ) { MethodSpec . Builder method = MethodSpec . methodBuilder ( "write" ) . addJavadoc ( "write bean entirely\n\n" ) . addJavadoc ( "@param bean bean to entirely write\n" ) . addModifiers ( Modifier . PUBLIC ) . addParameter ( typeName ( entity . getName ( ) )...
Generate write method .
128,206
private static void generateReadMethod ( PrefsEntity entity ) { MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "read" ) . addModifiers ( Modifier . PUBLIC ) . addJavadoc ( "read bean entirely\n\n" ) . addJavadoc ( "@return read bean\n" ) . returns ( typeName ( entity . getName ( ) ) ) ; if ( entity ....
Generate read method .
128,207
private static void generateSingleReadMethod ( PrefsEntity entity ) { PrefsTransform transform ; Converter < String , String > converter = CaseFormat . LOWER_CAMEL . converterTo ( CaseFormat . UPPER_CAMEL ) ; for ( PrefsProperty item : entity . getCollection ( ) ) { MethodSpec . Builder methodBuilder = MethodSpec . met...
Generate single read method .
128,208
protected void serialize ( BinderContext context , E object , SerializerWrapper serializerWrapper , boolean writeStartAndEnd ) throws Exception { switch ( context . getSupportedFormat ( ) ) { case XML : try { XmlWrapperSerializer wrapper = ( ( XmlWrapperSerializer ) serializerWrapper ) ; XMLSerializer xmlSerializer = w...
Serialize an object using the contxt and the serializerWrapper .
128,209
@ SuppressWarnings ( "unchecked" ) public static < T > Set < T > asSet ( Class < T > itemType , T ... objects ) { LinkedHashSet < T > result = new LinkedHashSet < T > ( ) ; for ( T item : objects ) { result . add ( item ) ; } return result ; }
create a collection set with initial values .
128,210
public static < E extends List < Boolean > > E asList ( boolean [ ] array , Class < E > listType ) { E result ; try { result = listType . newInstance ( ) ; for ( Object item : array ) { result . add ( ( boolean ) item ) ; } return result ; } catch ( InstantiationException | IllegalAccessException e ) { e . printStackTr...
As list .
128,211
public static byte [ ] asByteTypeArray ( List < Byte > input ) { byte [ ] result = new byte [ input . size ( ) ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = input . get ( i ) ; } return result ; }
As byte type array .
128,212
public static char [ ] asCharacterTypeArray ( List < Character > input ) { char [ ] result = new char [ input . size ( ) ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = input . get ( i ) ; } return result ; }
As character type array .
128,213
public static short [ ] asShortTypeArray ( List < Short > input ) { short [ ] result = new short [ input . size ( ) ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = input . get ( i ) ; } return result ; }
As short type array .
128,214
public static int [ ] asIntegerTypeArray ( List < Integer > input ) { int [ ] result = new int [ input . size ( ) ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = input . get ( i ) ; } return result ; }
As integer type array .
128,215
public static long [ ] asLongTypeArray ( List < Long > input ) { long [ ] result = new long [ input . size ( ) ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = input . get ( i ) ; } return result ; }
As long type array .
128,216
public static float [ ] asFloatTypeArray ( List < Float > input ) { float [ ] result = new float [ input . size ( ) ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = input . get ( i ) ; } return result ; }
As float type array .
128,217
public static String [ ] asStringArray ( List < String > input ) { String [ ] result = new String [ input . size ( ) ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = input . get ( i ) ; } return result ; }
As string array .
128,218
public static Boolean [ ] asBooleanArray ( List < Boolean > input ) { Boolean [ ] result = new Boolean [ input . size ( ) ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = input . get ( i ) ; } return result ; }
As boolean array .
128,219
public static < E > E [ ] asArray ( List < E > input , E [ ] newArray ) { return input . toArray ( newArray ) ; }
As array .
128,220
public static Double [ ] asDoubleArray ( List < Double > input ) { Double [ ] result = new Double [ input . size ( ) ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = input . get ( i ) ; } return result ; }
As double array .
128,221
public static void trim ( List < String > value ) { if ( value == null ) return ; for ( int i = 0 ; i < value . size ( ) ; i ++ ) { value . set ( i , value . get ( i ) . trim ( ) ) ; } }
trim each element of lists .
128,222
public static String resolveFullyQualifiedColumnName ( SQLiteDatabaseSchema schema , SQLiteModelMethod method , String className , String columnName ) { Finder < SQLProperty > currentEntity = method . getEntity ( ) ; if ( StringUtils . hasText ( className ) ) { currentEntity = schema . getEntityBySimpleName ( className...
given a fully qualified property name it will be transformed in associated column name . If class or property does not exist an exception will be thrown
128,223
public static boolean isLiveData ( SQLiteModelMethod methodDefinition ) { boolean result = false ; TypeName returnTypeName = methodDefinition . getReturnClass ( ) ; if ( returnTypeName instanceof ParameterizedTypeName ) { ParameterizedTypeName returnParameterizedTypeName = ( ParameterizedTypeName ) returnTypeName ; Cla...
Checks if is live data .
128,224
private String getJQLDeclared ( ) { ModelAnnotation inserAnnotation = this . getAnnotation ( BindSqlInsert . class ) ; ModelAnnotation updateAnnotation = this . getAnnotation ( BindSqlUpdate . class ) ; ModelAnnotation selectAnnotation = this . getAnnotation ( BindSqlSelect . class ) ; ModelAnnotation deleteAnnotation ...
Gets the JQL declared .
128,225
private < A extends Annotation > void findStringDynamicStatement ( SQLiteDaoDefinition parent , Class < A > annotationClazz , List < Class < ? extends Annotation > > unsupportedQueryType , OnFoundDynamicParameter listener ) { int counter = 0 ; for ( VariableElement p : element . getParameters ( ) ) { A annotation = p ....
Look for a method parameter which is annotated with an annotationClass annotation . When it is found a client action is required through listener .
128,226
public String findParameterAliasByName ( String name ) { if ( parameterName2Alias . containsKey ( name ) ) { return parameterName2Alias . get ( name ) ; } return name ; }
Retrieve for a method s parameter its alias used to work with queries . If no alias is present typeName will be used .
128,227
public TypeName getAdapterForParam ( String paramName ) { if ( this . hasAdapterForParam ( paramName ) ) { return TypeUtility . typeName ( this . parameterName2Adapter . get ( paramName ) ) ; } else { return null ; } }
Gets the adapter for param .
128,228
public String findEntityProperty ( ) { SQLiteEntity entity = getEntity ( ) ; for ( Pair < String , TypeName > item : this . parameters ) { if ( item . value1 . equals ( TypeUtility . typeName ( entity . getElement ( ) ) ) ) { return item . value0 ; } } return null ; }
Find entity property .
128,229
public String buildPreparedStatementName ( ) { if ( ! StringUtils . hasText ( preparedStatementName ) ) { preparedStatementName = getParent ( ) . buildPreparedStatementName ( getName ( ) ) ; } return preparedStatementName ; }
Builds the prepared statement name .
128,230
public static String checkSize ( Object value , int limitSize , String defaultValue ) { if ( value != null ) { if ( byte [ ] . class . getSimpleName ( ) . equals ( value . getClass ( ) . getSimpleName ( ) ) ) { return checkSize ( ( byte [ ] ) value , limitSize / 2 ) ; } String str = value . toString ( ) ; if ( str . le...
limit string size .
128,231
public static String bytesToHex ( byte [ ] bytes , int size ) { size = Math . min ( bytes . length , size ) ; char [ ] hexChars = new char [ size * 2 ] ; for ( int j = 0 ; j < size ; j ++ ) { int v = bytes [ j ] & 0xFF ; hexChars [ j * 2 ] = hexArray [ v >>> 4 ] ; hexChars [ j * 2 + 1 ] = hexArray [ v & 0x0F ] ; } retu...
Bytes to hex .
128,232
public static String checkSize ( byte [ ] value , int limitSize ) { if ( value != null ) { if ( value . length > limitSize ) { return bytesToHex ( value , limitSize - 3 ) + "..." ; } else return bytesToHex ( value , value . length ) ; } else return null ; }
Check size .
128,233
public static String formatParam ( Object value , String delimiter ) { if ( value != null ) { if ( byte [ ] . class . getSimpleName ( ) . equals ( value . getClass ( ) . getSimpleName ( ) ) ) { return checkSize ( ( byte [ ] ) value , VIEW_SIZE ) ; } String str = value . toString ( ) ; if ( str . length ( ) > VIEW_SIZE ...
format as sql parameter . If value is not null method will return value . If value is not null delimiter will be used to delimit return value . Otherwise defaultValue will be returned without delimiter .
128,234
public static String checkSize ( Object value , String defaultValue ) { return checkSize ( value , VIEW_SIZE , defaultValue ) ; }
limit string size to 32 .
128,235
public static String lowercaseFirstLetter ( String value ) { if ( value == null || value . length ( ) == 0 ) return "" ; char [ ] stringArray = value . toCharArray ( ) ; stringArray [ 0 ] = Character . toLowerCase ( stringArray [ 0 ] ) ; return new String ( stringArray ) ; }
Lowercase first letter .
128,236
public static void string2Writer ( String source , Writer out ) throws IOException { char [ ] buffer = source . toCharArray ( ) ; for ( int i = 0 ; i < buffer . length ; i ++ ) { out . append ( buffer [ i ] ) ; } out . flush ( ) ; }
String 2 writer .
128,237
public static String reader2String ( Reader source ) throws IOException { char [ ] cbuf = new char [ 65535 ] ; StringBuffer stringbuf = new StringBuffer ( ) ; int count = 0 ; while ( ( count = source . read ( cbuf , 0 , 65535 ) ) != - 1 ) { stringbuf . append ( cbuf , 0 , count ) ; } return stringbuf . toString ( ) ; }
Reader 2 string .
128,238
public static byte [ ] addDouble ( byte [ ] array , double value ) { byte [ ] holder = new byte [ 4 ] ; doubleTo ( holder , 0 , value ) ; return add ( array , holder ) ; }
Adds the double .
128,239
public static byte [ ] insertDoubleInto ( byte [ ] array , int index , double value ) { byte [ ] holder = new byte [ 4 ] ; doubleTo ( holder , 0 , value ) ; return insert ( array , index , holder ) ; }
Insert double into .
128,240
public static boolean equalsOrDie ( byte [ ] expected , byte [ ] got ) { if ( expected . length != got . length ) { throw new KriptonRuntimeException ( "Lengths did not match, expected length" + expected . length + "but got" + got . length ) ; } for ( int index = 0 ; index < expected . length ; index ++ ) { if ( expect...
Checks to see if two arrays are equals .
128,241
private void considerNotify ( ObserverWrapper observer ) { if ( ! observer . mActive ) { return ; } if ( ! observer . shouldBeActive ( ) ) { observer . activeStateChanged ( false ) ; return ; } if ( observer . mLastVersion >= mVersion ) { return ; } observer . mLastVersion = mVersion ; observer . mObserver . onChanged ...
Consider notify .
128,242
public void removeObserver ( final Observer < T > observer ) { assertMainThread ( "removeObserver" ) ; ObserverWrapper removed = mObservers . remove ( observer ) ; if ( removed == null ) { return ; } removed . detachObserver ( ) ; removed . activeStateChanged ( false ) ; }
Removes the given observer from the observers list .
128,243
public T getValue ( ) { Object data = mData ; if ( data != NOT_SET ) { return ( T ) data ; } return null ; }
Returns the current value . Note that calling this method on a background thread does not guarantee that the latest value set will be received .
128,244
public SQLProperty getPrimaryKey ( ) { for ( SQLProperty item : collection ) { if ( item . isPrimaryKey ( ) ) { return item ; } } SQLProperty id = findPropertyByName ( "id" ) ; return id ; }
True if there is a primary key .
128,245
private String buildTableName ( Elements elementUtils , SQLiteDatabaseSchema schema ) { tableName = getSimpleName ( ) ; tableName = schema . classNameConverter . convert ( tableName ) ; String temp = AnnotationUtility . extractAsString ( getElement ( ) , BindSqlType . class , AnnotationAttributeType . NAME ) ; if ( Str...
Builds the table name .
128,246
public Touple < SQLProperty , String , SQLiteEntity , SQLRelationType > findRelationByParentProperty ( String parentFieldName ) { for ( Touple < SQLProperty , String , SQLiteEntity , SQLRelationType > item : relations ) { if ( item . value0 . getName ( ) . equals ( parentFieldName ) ) { return item ; } } return null ; ...
find a relation specifing parent field name that is the name of the relation
128,247
static String extractWhereConditions ( boolean updateMode , SQLiteModelMethod method ) { final One < String > whereCondition = new One < String > ( "" ) ; final One < Boolean > found = new One < Boolean > ( null ) ; JQLChecker . getInstance ( ) . replaceVariableStatements ( method , method . jql . value , new JQLReplac...
Extract where conditions .
128,248
static boolean isIn ( TypeName value , Class < ? > ... classes ) { for ( Class < ? > item : classes ) { if ( value . toString ( ) . equals ( TypeName . get ( item ) . toString ( ) ) ) { return true ; } } return false ; }
Checks if is in .
128,249
public static Map < String , Object > parseMap ( AbstractContext context , ParserWrapper parserWrapper , Map < String , Object > map ) { switch ( context . getSupportedFormat ( ) ) { case XML : throw ( new KriptonRuntimeException ( context . getSupportedFormat ( ) + " context does not support parse direct map parsing" ...
Parse a map .
128,250
static Map < String , Object > parseMap ( AbstractContext context , JsonParser parser , Map < String , Object > map , boolean skipRead ) { try { String key ; Object value ; if ( ! skipRead ) { parser . nextToken ( ) ; } if ( parser . currentToken ( ) != JsonToken . START_OBJECT ) { throw ( new KriptonRuntimeException (...
Parse map .
128,251
static List < Object > parseList ( AbstractContext context , JsonParser parser , List < Object > list , boolean skipRead ) { try { if ( ! skipRead ) { parser . nextToken ( ) ; } if ( parser . currentToken ( ) != JsonToken . START_ARRAY ) { throw ( new KriptonRuntimeException ( "Invalid input format" ) ) ; } skipRead = ...
Parse a list .
128,252
public static BinderContext bind ( BinderType format ) { BinderContext binder = binders . get ( format ) ; if ( binder == null ) throw new KriptonRuntimeException ( String . format ( "%s format is not supported" , format ) ) ; return binder ; }
retrieve binding context for specified data format .
128,253
public static String readText ( InputStream inputStream ) { BufferedReader bufferedReader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; String line ; StringBuilder stringBuilder = new StringBuilder ( ) ; try { while ( ( line = bufferedReader . readLine ( ) ) != null ) { stringBuilder . append ( line ...
Read text .
128,254
private Class < ? > defineMapClass ( ParameterizedTypeName mapTypeName ) { if ( mapTypeName . rawType . toString ( ) . startsWith ( Map . class . getCanonicalName ( ) ) ) { return HashMap . class ; } else if ( mapTypeName . rawType . toString ( ) . startsWith ( SortedMap . class . getCanonicalName ( ) ) ) { return Tree...
Define map class .
128,255
private String fillClazz ( String configClazz , String clazz ) { if ( ! clazz . equals ( configClazz ) ) { return configClazz ; } else { return null ; } }
Fill clazz .
128,256
public void addEntity ( SQLiteEntity value ) { entities . put ( value . getName ( ) , value ) ; entitiesBySimpleName . put ( value . getSimpleName ( ) . toString ( ) . toLowerCase ( ) , value ) ; Set < SQLProperty > listEntity = null ; for ( SQLProperty p : value . getCollection ( ) ) { listEntity = propertyBySimpleNam...
Adds the entity .
128,257
private void checkName ( Set < SQLProperty > listEntity , SQLProperty p ) { for ( SQLProperty item : listEntity ) { AssertKripton . assertTrueOrInvalidPropertyName ( item . columnName . equals ( p . columnName ) , item , p ) ; } }
property in different class but same name must have same column name .
128,258
public Finder < SQLProperty > getEntityBySimpleName ( String entityName ) { if ( entityName == null ) return null ; SQLiteEntity result = entitiesBySimpleName . get ( entityName . toLowerCase ( ) ) ; if ( result != null ) return result ; for ( GeneratedTypeElement item : this . generatedEntities ) { if ( item . typeSpe...
Gets the entity by simple name .
128,259
public Set < SQLProperty > getPropertyBySimpleName ( String propertyName ) { if ( propertyName == null ) return null ; return this . propertyBySimpleName . get ( propertyName . toLowerCase ( ) ) ; }
Gets the property by simple name .
128,260
public String findColumnNameByPropertyName ( SQLiteModelMethod method , String propertyName ) { Set < SQLProperty > propertiesSet = getPropertyBySimpleName ( propertyName ) ; Set < String > set = new HashSet < String > ( ) ; String result = null ; for ( SQLProperty item : propertiesSet ) { result = item . columnName ; ...
get a .
128,261
public ClassName getGeneratedClass ( ) { String packageName = getElement ( ) . asType ( ) . toString ( ) ; return TypeUtility . className ( packageName . substring ( 0 , packageName . lastIndexOf ( "." ) ) + "." + getGeneratedClassName ( ) ) ; }
Gets the generated class .
128,262
public static void renameTablesWithPrefix ( SQLiteDatabase db , final String prefix ) { Logger . info ( "MASSIVE TABLE RENAME OPERATION: ADD PREFIX " + prefix ) ; query ( db , null , QueryType . TABLE , new OnResultListener ( ) { public void onRow ( SQLiteDatabase db , String name , String sql ) { sql = String . format...
Add to all table a specifix prefix .
128,263
public static void dropTablesWithPrefix ( SQLiteDatabase db , String prefix ) { Logger . info ( "MASSIVE TABLE DROP OPERATION%s" , StringUtils . ifNotEmptyAppend ( prefix , " WITH PREFIX " ) ) ; drop ( db , QueryType . TABLE , prefix ) ; }
Drop all table with specific prefix .
128,264
public static void dropTablesAndIndices ( SQLiteDatabase db ) { drop ( db , QueryType . INDEX , null ) ; drop ( db , QueryType . TABLE , null ) ; }
Drop tables and indices .
128,265
public static String detectSourceType ( Element element , String adapterClazz ) { TypeElement a = BaseProcessor . elementUtils . getTypeElement ( adapterClazz ) ; for ( Element i : BaseProcessor . elementUtils . getAllMembers ( a ) ) { if ( i . getKind ( ) == ElementKind . METHOD && "toJava" . equals ( i . getSimpleNam...
Detect source type .
128,266
public static String detectSourceType ( SQLiteModelMethod method , TypeName adapterTypeName ) { TypeElement a = BaseProcessor . elementUtils . getTypeElement ( adapterTypeName . toString ( ) ) ; for ( Element i : BaseProcessor . elementUtils . getAllMembers ( a ) ) { if ( i . getKind ( ) == ElementKind . METHOD && "toJ...
Give a param with type adapter obtain type used to convert param
128,267
protected void ensureElementsCapacity ( ) { final int elStackSize = elName . length ; final int newSize = ( depth >= 7 ? 2 * depth : 8 ) + 2 ; if ( TRACE_SIZING ) { System . err . println ( getClass ( ) . getName ( ) + " elStackSize " + elStackSize + " ==> " + newSize ) ; } final boolean needsCopying = elStackSize > 0 ...
Ensure elements capacity .
128,268
protected void ensureNamespacesCapacity ( ) { final int newSize = namespaceEnd > 7 ? 2 * namespaceEnd : 8 ; if ( TRACE_SIZING ) { System . err . println ( getClass ( ) . getName ( ) + " namespaceSize " + namespacePrefix . length + " ==> " + newSize ) ; } final String [ ] newNamespacePrefix = new String [ newSize ] ; fi...
Ensure namespaces capacity .
128,269
public void setFeature ( String name , boolean state ) throws IllegalArgumentException , IllegalStateException { if ( name == null ) { throw new IllegalArgumentException ( "feature name can not be null" ) ; } if ( FEATURE_NAMES_INTERNED . equals ( name ) ) { namesInterned = state ; } else if ( FEATURE_SERIALIZER_ATTVAL...
Sets the feature .
128,270
public boolean getFeature ( String name ) throws IllegalArgumentException { if ( name == null ) { throw new IllegalArgumentException ( "feature name can not be null" ) ; } if ( FEATURE_NAMES_INTERNED . equals ( name ) ) { return namesInterned ; } else if ( FEATURE_SERIALIZER_ATTVALUE_USE_APOSTROPHE . equals ( name ) ) ...
Gets the feature .
128,271
protected void rebuildIndentationBuf ( ) { if ( doIndent == false ) return ; final int maxIndent = 65 ; int bufSize = 0 ; offsetNewLine = 0 ; if ( writeLineSepartor ) { offsetNewLine = lineSeparator . length ( ) ; bufSize += offsetNewLine ; } maxIndentLevel = 0 ; if ( writeIndentation ) { indentationJump = indentationS...
For maximum efficiency when writing indents the required output is pre - computed This is internal function that recomputes buffer after user requested chnages .
128,272
public void setProperty ( String name , Object value ) throws IllegalArgumentException , IllegalStateException { if ( name == null ) { throw new IllegalArgumentException ( "property name can not be null" ) ; } if ( PROPERTY_SERIALIZER_INDENTATION . equals ( name ) ) { indentationString = ( String ) value ; } else if ( ...
Sets the property .
128,273
public void setOutput ( OutputStream os , String encoding ) throws IOException { if ( os == null ) throw new IllegalArgumentException ( "output stream can not be null" ) ; reset ( ) ; if ( encoding != null ) { out = new OutputStreamWriter ( os , encoding ) ; } else { out = new OutputStreamWriter ( os ) ; } }
Sets the output .
128,274
public void startDocument ( String encoding , Boolean standalone ) throws IOException { @ SuppressWarnings ( "unused" ) char apos = attributeUseApostrophe ? '\'' : '"' ; if ( attributeUseApostrophe ) { out . write ( "<?xml version='1.0'" ) ; } else { out . write ( "<?xml version=\"1.0\"" ) ; } if ( encoding != null ) {...
Start document .
128,275
@ SuppressWarnings ( "unused" ) public void setPrefix ( String prefix , String namespace ) throws IOException { if ( startTagIncomplete ) closeStartTag ( ) ; if ( prefix == null ) { prefix = "" ; } if ( ! namesInterned ) { prefix = prefix . intern ( ) ; } else if ( checkNamesInterned ) { checkInterning ( prefix ) ; } e...
Sets the prefix .
128,276
protected String getPrefix ( String namespace , boolean generatePrefix , boolean nonEmpty ) { if ( ! namesInterned ) { namespace = namespace . intern ( ) ; } else if ( checkNamesInterned ) { checkInterning ( namespace ) ; } if ( namespace == null ) { throw new IllegalArgumentException ( "namespace must be not null" + g...
Gets the prefix .
128,277
private String generatePrefix ( String namespace ) { while ( true ) { ++ autoDeclaredPrefixes ; final String prefix = autoDeclaredPrefixes < precomputedPrefixes . length ? precomputedPrefixes [ autoDeclaredPrefixes ] : ( "n" + autoDeclaredPrefixes ) . intern ( ) ; for ( int i = namespaceEnd - 1 ; i >= 0 ; -- i ) { if (...
Generate prefix .
128,278
protected void closeStartTag ( ) throws IOException { if ( finished ) { throw new IllegalArgumentException ( "trying to write past already finished output" + getLocation ( ) ) ; } if ( seenBracket ) { seenBracket = seenBracketBracket = false ; } if ( startTagIncomplete || setPrefixCalled ) { if ( setPrefixCalled ) { th...
Close start tag .
128,279
private void writeNamespaceDeclarations ( ) throws IOException { for ( int i = elNamespaceCount [ depth - 1 ] ; i < namespaceEnd ; i ++ ) { if ( doIndent && namespaceUri [ i ] . length ( ) > 40 ) { writeIndent ( ) ; out . write ( " " ) ; } if ( "" . equals ( namespacePrefix [ i ] ) ) { out . write ( " xmlns:" ) ; out ....
Write namespace declarations .
128,280
public XMLSerializer endTag ( String namespace , String name ) throws IOException { seenBracket = seenBracketBracket = false ; if ( namespace != null ) { if ( ! namesInterned ) { namespace = namespace . intern ( ) ; } else if ( checkNamesInterned ) { checkInterning ( namespace ) ; } } if ( namespace != elNamespace [ de...
End tag .
128,281
public void entityRef ( String text ) throws IOException { if ( startTagIncomplete || setPrefixCalled || seenBracket ) closeStartTag ( ) ; if ( doIndent && seenTag ) seenTag = false ; out . write ( '&' ) ; out . write ( text ) ; out . write ( ';' ) ; }
Entity ref .
128,282
public void ignorableWhitespace ( String text ) throws IOException { if ( startTagIncomplete || setPrefixCalled || seenBracket ) closeStartTag ( ) ; if ( doIndent && seenTag ) seenTag = false ; if ( text . length ( ) == 0 ) { throw new IllegalArgumentException ( "empty string is not allowed for ignorable whitespace" + ...
Ignorable whitespace .
128,283
protected void writeAttributeValue ( String value , Writer out ) throws IOException { final char quot = attributeUseApostrophe ? '\'' : '"' ; final String quotEntity = attributeUseApostrophe ? "&apos;" : "&quot;" ; int pos = 0 ; for ( int i = 0 ; i < value . length ( ) ; i ++ ) { char ch = value . charAt ( i ) ; if ( c...
Write attribute value .
128,284
private static void addPrintable ( StringBuffer retval , char ch ) { switch ( ch ) { case '\b' : retval . append ( "\\b" ) ; break ; case '\t' : retval . append ( "\\t" ) ; break ; case '\n' : retval . append ( "\\n" ) ; break ; case '\f' : retval . append ( "\\f" ) ; break ; case '\r' : retval . append ( "\\r" ) ; bre...
Adds the printable .
128,285
public void writeBinary ( byte [ ] value , int start , int length ) throws IOException { text ( Base64Utils . encode ( value , start , length ) ) ; }
Write binary .
128,286
public void writeDecimalAttribute ( String prefix , String namespaceURI , String localName , BigDecimal value ) throws Exception { this . attribute ( namespaceURI , localName , value . toPlainString ( ) ) ; }
Write decimal attribute .
128,287
public void writeIntegerAttribute ( String prefix , String namespaceURI , String localName , BigInteger value ) throws Exception { this . attribute ( namespaceURI , localName , value . toString ( ) ) ; }
Write integer attribute .
128,288
public void writeDoubleAttribute ( String prefix , String namespaceURI , String localName , double value ) throws Exception { this . attribute ( namespaceURI , localName , Double . toString ( value ) ) ; }
Write double attribute .
128,289
public void writeBooleanAttribute ( String prefix , String namespaceURI , String localName , boolean value ) throws Exception { this . attribute ( namespaceURI , localName , Boolean . toString ( value ) ) ; }
Write boolean attribute .
128,290
public static void generateFieldPersistance ( BindTypeContext context , List < ? extends ManagedModelProperty > collection , PersistType persistType , boolean forceName , Modifier ... modifiers ) { for ( ManagedModelProperty property : collection ) { if ( property . bindProperty != null && ! property . hasTypeAdapter (...
Manage field s persistence for both in SharedPreference and SQLite flavours .
128,291
public static void generateFieldSerialize ( BindTypeContext context , PersistType persistType , BindProperty property , Modifier ... modifiers ) { Converter < String , String > format = CaseFormat . LOWER_CAMEL . converterTo ( CaseFormat . UPPER_CAMEL ) ; String methodName = "serialize" + format . convert ( property . ...
generates code to manage field serialization .
128,292
public static void generateParamSerializer ( BindTypeContext context , String propertyName , TypeName parameterTypeName , PersistType persistType ) { propertyName = SQLiteDaoDefinition . PARAM_SERIALIZER_PREFIX + propertyName ; MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( propertyName ) . addJavado...
Generate param serializer .
128,293
public static void generateParamParser ( BindTypeContext context , String methodName , TypeName parameterTypeName , PersistType persistType ) { methodName = SQLiteDaoDefinition . PARAM_PARSER_PREFIX + methodName ; MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( methodName ) . addJavadoc ( "for param $...
Generate param parser .
128,294
protected void checkTypeAdapter ( @ SuppressWarnings ( "rawtypes" ) ModelEntity entity , TypeMirror propertyType , TypeAdapter typeAdapter , ModelAnnotation annotation ) { TypeName sourceType = TypeUtility . typeName ( TypeAdapterHelper . detectSourceType ( entity . getElement ( ) , typeAdapter . adapterClazz ) ) ; Typ...
Check type adapter .
128,295
private static boolean contentEquals ( String s , char [ ] chars , int start , int length ) { if ( s . length ( ) != length ) { return false ; } for ( int i = 0 ; i < length ; i ++ ) { if ( chars [ start + i ] != s . charAt ( i ) ) { return false ; } } return true ; }
Content equals .
128,296
public E findImmutablePropertyByName ( String name ) { String lcName = name . toLowerCase ( ) ; for ( E item : immutableCollection ) { if ( item . getName ( ) . toLowerCase ( ) . equals ( lcName ) ) { return item ; } } return null ; }
Find property by name .
128,297
public static DynamicByteBuffer createExact ( final int capacity ) { return new DynamicByteBuffer ( capacity ) { public DynamicByteBuffer add ( byte [ ] chars ) { DynamicByteBufferHelper . _idx ( buffer , length , chars ) ; length += chars . length ; return this ; } } ; }
Creates the exact .
128,298
public void addUnsignedByte ( short value ) { if ( 1 + length < capacity ) { DynamicByteBufferHelper . unsignedByteTo ( buffer , length , value ) ; } else { buffer = DynamicByteBufferHelper . grow ( buffer , buffer . length * 2 + 1 ) ; capacity = buffer . length ; DynamicByteBufferHelper . unsignedByteTo ( buffer , len...
Adds the unsigned byte .
128,299
public DynamicByteBuffer addUnsignedInt ( long value ) { if ( 4 + length < capacity ) { DynamicByteBufferHelper . unsignedIntTo ( buffer , length , value ) ; } else { buffer = DynamicByteBufferHelper . grow ( buffer , buffer . length * 2 + 4 ) ; capacity = buffer . length ; DynamicByteBufferHelper . unsignedIntTo ( buf...
Adds the unsigned int .