idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
400
void writeString ( String value ) throws IOException { output . append ( '"' ) ; for ( int i = 0 ; i < value . length ( ) ; i ++ ) { char ch = value . charAt ( i ) ; if ( ch < 128 ) { String replace = REPLACE [ ch ] ; if ( replace != null ) { output . append ( replace ) ; } else { output . append ( ch ) ; } } else if (...
Writes a JSON string .
401
void writeArrayItemStart ( ) throws IOException { if ( commaState . get ( commaDepth ) ) { output . append ( ',' ) ; if ( newLine . length ( ) > 0 ) { output . append ( ' ' ) ; } } else { commaState . set ( commaDepth ) ; } }
Writes a JSON array item start .
402
void writeObjectStart ( ) throws IOException { output . append ( '{' ) ; currentIndent = currentIndent + indent ; commaDepth ++ ; commaState . set ( commaDepth , false ) ; }
Writes a JSON object start .
403
void writeObjectKeyValue ( String key , String value ) throws IOException { writeObjectKey ( key ) ; writeString ( value ) ; }
Writes a JSON object key and value .
404
void writeObjectEnd ( ) throws IOException { currentIndent = currentIndent . substring ( 0 , currentIndent . length ( ) - indent . length ( ) ) ; if ( commaState . get ( commaDepth ) ) { output . append ( newLine ) ; output . append ( currentIndent ) ; } output . append ( '}' ) ; commaDepth -- ; }
Writes a JSON object end .
405
public static Object wrapValue ( MetaProperty < ? > metaProp , Class < ? > beanType , Object value ) { Object [ ] helpers = OPTIONALS . get ( metaProp . propertyType ( ) ) ; if ( helpers != null ) { try { if ( value != null ) { value = ( ( Method ) helpers [ 0 ] ) . invoke ( null , value ) ; } else { value = helpers [ ...
Wraps the value of a property if it is an optional .
406
public SerDeserializers register ( Class < ? > type , SerDeserializer deserializer ) { deserializers . put ( type , deserializer ) ; return this ; }
Adds the deserializer to be used for the specified type .
407
public Class < ? > decodeType ( String typeStr , JodaBeanSer settings , String basePackage , Map < String , Class < ? > > knownTypes , Class < ? > defaultType ) throws ClassNotFoundException { if ( lenient ) { return SerTypeMapper . decodeType ( typeStr , settings , basePackage , knownTypes , defaultType == Object . cl...
Decodes the type
408
private static void registerFromClasspath ( String beanName , String deserName , Map < Class < ? > , SerDeserializer > map ) throws Exception { Class < ? extends Bean > beanClass = Class . forName ( beanName ) . asSubclass ( Bean . class ) ; Class < ? > deserClass = Class . forName ( deserName ) ; Field field = null ; ...
parses and registers the classes
409
private static SerDeserializer toLenient ( SerDeserializer underlying ) { return new SerDeserializer ( ) { public MetaBean findMetaBean ( Class < ? > beanType ) { return underlying . findMetaBean ( beanType ) ; } public BeanBuilder < ? > createBuilder ( Class < ? > beanType , MetaBean metaBean ) { return underlying . c...
makes the deserializer lenient
410
private Map < String , Object > dataWritable ( ) { if ( data == Collections . EMPTY_MAP ) { data = new LinkedHashMap < > ( ) ; } return data ; }
Gets the internal data map .
411
public Map < String , Object > toMap ( ) { if ( size ( ) == 0 ) { return Collections . emptyMap ( ) ; } return Collections . unmodifiableMap ( new LinkedHashMap < > ( data ) ) ; }
Returns a map representing the contents of the bean .
412
private T build ( Constructor < T > constructor , Object [ ] args ) { try { return constructor . newInstance ( args ) ; } catch ( IllegalArgumentException | IllegalAccessException | InstantiationException ex ) { throw new IllegalArgumentException ( "Bean cannot be created: " + beanName ( ) + " from " + Arrays . toStrin...
Creates an instance of the bean .
413
private static String [ ] fieldNames ( Class < ? > beanType ) { Field [ ] fields = Stream . of ( beanType . getDeclaredFields ( ) ) . filter ( f -> ! Modifier . isStatic ( f . getModifiers ( ) ) && f . getAnnotation ( PropertyDefinition . class ) != null ) . toArray ( Field [ ] :: new ) ; List < String > fieldNames = n...
determine the field names by reflection
414
JsonEvent readEvent ( ) throws IOException { char next = readNext ( ) ; while ( next == ' ' || next == '\t' || next == '\n' || next == '\r' ) { next = readNext ( ) ; } switch ( next ) { case '{' : return JsonEvent . OBJECT ; case '}' : return JsonEvent . OBJECT_END ; case '[' : return JsonEvent . ARRAY ; case ']' : ret...
Writes a JSON null .
415
String acceptObjectKey ( JsonEvent event ) throws IOException { ensureEvent ( event , JsonEvent . STRING ) ; return parseObjectKey ( ) ; }
expect object key and parse it
416
JsonEvent acceptObjectSeparator ( ) throws IOException { JsonEvent event = readEvent ( ) ; if ( event == JsonEvent . COMMA ) { return readEvent ( ) ; } else { return ensureEvent ( event , JsonEvent . OBJECT_END ) ; } }
accepts a comma or object end
417
JsonEvent acceptArraySeparator ( ) throws IOException { JsonEvent event = readEvent ( ) ; if ( event == JsonEvent . COMMA ) { return readEvent ( ) ; } else { return ensureEvent ( event , JsonEvent . ARRAY_END ) ; } }
accepts a comma or array end
418
public void ensureImport ( Class < ? > cls ) { if ( currentImports . contains ( cls . getName ( ) ) == false ) { newImports . add ( cls . getName ( ) ) ; } }
Ensures an import is present .
419
public String getEffectiveMetaScope ( ) { String scope = beanMetaScope ; if ( "smart" . equals ( scope ) ) { scope = typeScope ; } return "package" . equals ( scope ) ? "" : scope + " " ; }
Gets the effective scope to use in the meta .
420
public String getEffectiveBuilderScope ( ) { String scope = beanBuilderScope ; if ( "smart" . equals ( scope ) ) { scope = typeScope ; } return "package" . equals ( scope ) ? "" : scope + " " ; }
Gets the effective scope to use in the builder .
421
public boolean isConstructorScopeValid ( ) { return "smart" . equals ( constructorScope ) || "private" . equals ( constructorScope ) || "package" . equals ( constructorScope ) || "protected" . equals ( constructorScope ) || "public" . equals ( constructorScope ) || "public@ConstructorProperties" . equals ( constructorS...
Is the constructor scope valid .
422
public String getEffectiveConstructorScope ( ) { if ( "smart" . equals ( constructorScope ) ) { return isTypeFinal ( ) ? "private " : "protected " ; } else if ( "package" . equals ( constructorScope ) ) { return "" ; } else if ( "public@ConstructorProperties" . equals ( constructorScope ) ) { return "public " ; } retur...
Gets the effective scope to use in the constructor .
423
public void setTypeParts ( String [ ] parts ) { this . typeFinal = parts [ 0 ] != null ; this . typeScope = parts [ 1 ] ; this . typeFull = parts [ 2 ] ; this . typeRaw = parts [ 3 ] ; if ( parts [ 8 ] != null ) { this . typeGenericName = new String [ ] { parts [ 4 ] , parts [ 6 ] , parts [ 8 ] } ; this . typeGenericEx...
Sets the bean type .
424
public void setSuperTypeParts ( String [ ] parts ) { if ( parts . length == 1 ) { this . root = true ; this . immutable = "ImmutableBean" . equals ( parts [ 0 ] ) ; this . superTypeFull = "" ; this . superTypeRaw = "" ; this . superTypeGeneric = "" ; } else { this . root = "DirectBean" . equals ( parts [ 0 ] ) ; this ....
Sets the bean superclass type .
425
public boolean isTypeGenerifiedBy ( String type ) { if ( typeGenericName . length > 2 && typeGenericName [ 2 ] . equals ( type ) ) { return true ; } if ( typeGenericName . length > 1 && typeGenericName [ 1 ] . equals ( type ) ) { return true ; } if ( typeGenericName . length > 0 && typeGenericName [ 0 ] . equals ( type...
Checks if the type specified is one of the bean s type parameters .
426
public static < P > DirectMetaProperty < P > ofReadWrite ( MetaBean metaBean , String propertyName , Class < ? > declaringType , Class < P > propertyType ) { Field field = findField ( metaBean , propertyName ) ; return new DirectMetaProperty < > ( metaBean , propertyName , declaringType , propertyType , PropertyStyle ....
Factory to create a read - write meta - property avoiding duplicate generics .
427
public static < P > DirectMetaProperty < P > ofReadOnly ( MetaBean metaBean , String propertyName , Class < ? > declaringType , Class < P > propertyType ) { Field field = findField ( metaBean , propertyName ) ; return new DirectMetaProperty < > ( metaBean , propertyName , declaringType , propertyType , PropertyStyle . ...
Factory to create a read - only meta - property avoiding duplicate generics .
428
public static < P > DirectMetaProperty < P > ofWriteOnly ( MetaBean metaBean , String propertyName , Class < ? > declaringType , Class < P > propertyType ) { Field field = findField ( metaBean , propertyName ) ; return new DirectMetaProperty < > ( metaBean , propertyName , declaringType , propertyType , PropertyStyle ....
Factory to create a write - only meta - property avoiding duplicate generics .
429
public static < P > DirectMetaProperty < P > ofReadOnlyBuildable ( MetaBean metaBean , String propertyName , Class < ? > declaringType , Class < P > propertyType ) { Field field = findField ( metaBean , propertyName ) ; return new DirectMetaProperty < > ( metaBean , propertyName , declaringType , propertyType , Propert...
Factory to create a buildable read - only meta - property avoiding duplicate generics .
430
public static < P > DirectMetaProperty < P > ofDerived ( MetaBean metaBean , String propertyName , Class < ? > declaringType , Class < P > propertyType ) { Field field = findField ( metaBean , propertyName ) ; return new DirectMetaProperty < > ( metaBean , propertyName , declaringType , propertyType , PropertyStyle . D...
Factory to create a derived read - only meta - property avoiding duplicate generics .
431
public static < P > DirectMetaProperty < P > ofImmutable ( MetaBean metaBean , String propertyName , Class < ? > declaringType , Class < P > propertyType ) { Field field = findField ( metaBean , propertyName ) ; return new DirectMetaProperty < > ( metaBean , propertyName , declaringType , propertyType , PropertyStyle ....
Factory to create an imutable meta - property avoiding duplicate generics .
432
public String write ( Bean bean , boolean rootType ) { StringBuilder buf = new StringBuilder ( 1024 ) ; try { write ( bean , rootType , buf ) ; } catch ( IOException ex ) { throw new IllegalStateException ( ex ) ; } return buf . toString ( ) ; }
Writes the bean to a string specifying whether to include the type at the root .
433
void readAll ( ) { try { try { int b = input . read ( ) ; while ( b >= 0 ) { readObject ( b ) ; b = input . read ( ) ; } } finally { input . close ( ) ; } } catch ( IOException ex ) { throw new IllegalStateException ( ex ) ; } }
Reads all the data in the stream closing the stream .
434
public void resolveType ( ) { if ( getTypeStyle ( ) == null ) { setTypeStyle ( "" ) ; } final String fieldType = getFieldType ( ) ; String generics = "" ; if ( fieldType . contains ( "<" ) ) { generics = fieldType . substring ( fieldType . indexOf ( '<' ) ) ; } if ( getTypeStyle ( ) . equals ( "smart" ) ) { setType ( f...
Resolves the field type .
435
public void resolveBuilderType ( ) { if ( getBuilderTypeStyle ( ) == null ) { setBuilderTypeStyle ( "" ) ; } final String fieldType = getFieldType ( ) ; String generics = "" ; if ( fieldType . contains ( "<" ) ) { generics = fieldType . substring ( fieldType . indexOf ( '<' ) ) ; } if ( getBuilderTypeStyle ( ) . equals...
Resolves the field builder type .
436
public void resolveEqualsHashCodeStyle ( File file , int lineIndex ) { if ( equalsHashCodeStyle . equals ( "smart" ) ) { equalsHashCodeStyle = ( bean . isImmutable ( ) ? "field" : "getter" ) ; } if ( equalsHashCodeStyle . equals ( "omit" ) || equalsHashCodeStyle . equals ( "getter" ) || equalsHashCodeStyle . equals ( "...
Resolves the equals hashCode generator .
437
public void resolveToStringStyle ( File file , int lineIndex ) { if ( toStringStyle . equals ( "smart" ) ) { toStringStyle = ( bean . isImmutable ( ) ? "field" : "getter" ) ; } if ( toStringStyle . equals ( "omit" ) || toStringStyle . equals ( "getter" ) || toStringStyle . equals ( "field" ) ) { return ; } throw new Be...
Resolves the toString generator .
438
public String getFieldTypeRaw ( ) { int pos = fieldType . indexOf ( "<" ) ; return ( pos < 0 ? fieldType : fieldType . substring ( 0 , pos ) ) ; }
Gets the raw type of the property .
439
public void resolveSetterGen ( File file , int lineIndex ) { if ( getSetStyle ( ) == null ) { setSetStyle ( "" ) ; } String style = getSetStyle ( ) . replace ( "\\n" , "\n" ) ; String access = "public" ; if ( style . equals ( "private" ) ) { style = "smart" ; access = "private" ; } else if ( style . equals ( "package" ...
Resolves the setter generator .
440
public PropertyStyle getStyle ( ) { if ( isDerived ( ) ) { return PropertyStyle . DERIVED ; } if ( getBean ( ) . isImmutable ( ) ) { return PropertyStyle . IMMUTABLE ; } if ( getGetStyle ( ) . length ( ) > 0 && getSetStyle ( ) . length ( ) > 0 && ( getSetterGen ( ) . isSetterGenerated ( this ) || getSetStyle ( ) . equa...
Gets the read - write flag .
441
public String getValidationMethodName ( ) { if ( isValidated ( ) == false ) { throw new IllegalStateException ( ) ; } if ( getValidation ( ) . equals ( "notNull" ) || getValidation ( ) . equals ( "notEmpty" ) || getValidation ( ) . equals ( "notBlank" ) ) { return "JodaBeanUtils." + getValidation ( ) ; } return getVali...
Gets the validation method name .
442
public static boolean equal ( Object obj1 , Object obj2 ) { if ( obj1 == obj2 ) { return true ; } if ( obj1 == null || obj2 == null ) { return false ; } if ( obj1 . getClass ( ) . isArray ( ) ) { return equalsArray ( obj1 , obj2 ) ; } return obj1 . equals ( obj2 ) ; }
Checks if two objects are equal handling null .
443
@ SuppressWarnings ( "unchecked" ) public < P > P get ( MetaProperty < P > metaProperty ) { return ( P ) getBuffer ( ) . get ( metaProperty ) ; }
Gets the buffered value associated with the specified property name .
444
private static Class < ? > decodeType0 ( String className , JodaBeanSer settings , String basePackage , Map < String , Class < ? > > knownTypes , Class < ? > defaultType ) throws ClassNotFoundException { Class < ? > result = BASIC_TYPES_REVERSED . get ( className ) ; if ( result != null ) { return result ; } if ( known...
internal type decode
445
public Map < String , Object > write ( Bean bean ) { JodaBeanUtils . notNull ( bean , "bean" ) ; return writeBean ( bean , bean . getClass ( ) ) ; }
Writes the bean to a string .
446
void writeBoolean ( boolean value ) throws IOException { if ( value ) { output . writeByte ( TRUE ) ; } else { output . writeByte ( FALSE ) ; } }
Writes a MessagePack boolean .
447
void writeInt ( int value ) throws IOException { if ( value < MIN_FIX_INT ) { if ( value >= Byte . MIN_VALUE ) { output . writeByte ( SINT_8 ) ; output . writeByte ( ( byte ) value ) ; } else if ( value >= Short . MIN_VALUE ) { output . writeByte ( SINT_16 ) ; output . writeShort ( ( short ) value ) ; } else { output ....
Writes a MessagePack int .
448
void writeLong ( long value ) throws IOException { if ( value < MIN_FIX_INT ) { if ( value >= Byte . MIN_VALUE ) { output . writeByte ( SINT_8 ) ; output . writeByte ( ( byte ) value ) ; } else if ( value >= Short . MIN_VALUE ) { output . writeByte ( SINT_16 ) ; output . writeShort ( ( short ) value ) ; } else if ( val...
Writes a MessagePack long .
449
void writeBytes ( byte [ ] bytes ) throws IOException { int size = bytes . length ; if ( size < 256 ) { output . writeByte ( BIN_8 ) ; output . writeByte ( size ) ; } else if ( size < 65536 ) { output . writeByte ( BIN_16 ) ; output . writeShort ( size ) ; } else { output . writeByte ( BIN_32 ) ; output . writeInt ( si...
Writes a MessagePack byte block .
450
void writeString ( String value ) throws IOException { byte [ ] bytes = toUTF8 ( value ) ; int size = bytes . length ; if ( size < 32 ) { output . writeByte ( MIN_FIX_STR + size ) ; } else if ( size < 256 ) { output . writeByte ( STR_8 ) ; output . writeByte ( size ) ; } else if ( size < 65536 ) { output . writeByte ( ...
Writes a MessagePack string .
451
void writeArrayHeader ( int size ) throws IOException { if ( size < 16 ) { output . writeByte ( MIN_FIX_ARRAY + size ) ; } else if ( size < 65536 ) { output . writeByte ( ARRAY_16 ) ; output . writeShort ( size ) ; } else { output . writeByte ( ARRAY_32 ) ; output . writeInt ( size ) ; } }
Writes a MessagePack array header .
452
void writeMapHeader ( int size ) throws IOException { if ( size < 16 ) { output . writeByte ( MIN_FIX_MAP + size ) ; } else if ( size < 65536 ) { output . writeByte ( MAP_16 ) ; output . writeShort ( size ) ; } else { output . writeByte ( MAP_32 ) ; output . writeInt ( size ) ; } }
Writes a MessagePack map header .
453
void writeExtensionByte ( int extensionType , int value ) throws IOException { output . write ( FIX_EXT_1 ) ; output . write ( extensionType ) ; output . write ( value ) ; }
Writes an extension string using FIX_EXT_1 .
454
void writeExtensionString ( int extensionType , String str ) throws IOException { byte [ ] bytes = str . getBytes ( UTF_8 ) ; if ( bytes . length > 256 ) { throw new IllegalArgumentException ( "String too long" ) ; } output . write ( EXT_8 ) ; output . write ( bytes . length ) ; output . write ( extensionType ) ; outpu...
Writes an extension string using EXT_8 .
455
void writePositiveExtensionInt ( int extensionType , int reference ) throws IOException { if ( reference < 0 ) { throw new IllegalArgumentException ( "Can only serialize positive references: " + reference ) ; } if ( reference < 0xFF ) { output . write ( FIX_EXT_1 ) ; output . write ( extensionType ) ; output . writeByt...
Writes an extension reference of a positive integer using FIX_EXT data types .
456
private void parseClassDescriptions ( ) throws Exception { int refCount = acceptInteger ( input . readByte ( ) ) ; if ( refCount < 0 ) { throw new IllegalArgumentException ( "Invalid binary data: Expected count of references, but was: " + refCount ) ; } refs = new Object [ refCount ] ; int classMapSize = acceptMap ( in...
parses the references
457
private ClassInfo parseClassInfo ( ) throws Exception { String className = acceptString ( input . readByte ( ) ) ; Class < ? > type = SerTypeMapper . decodeType ( className , settings , overrideBasePackage , null ) ; int propertyCount = acceptArray ( input . readByte ( ) ) ; if ( propertyCount < 0 ) { throw new Illegal...
parses the class information
458
private Object parseBean ( int propertyCount , ClassInfo classInfo ) { String propName = "" ; if ( classInfo . metaProperties . length != propertyCount ) { throw new IllegalArgumentException ( "Invalid binary data: Expected " + classInfo . metaProperties . length + " properties but was: " + propertyCount ) ; } try { Se...
parses the bean using the class information
459
Class < ? > getAndSerializeEffectiveTypeIfRequired ( Object value , Class < ? > declaredType ) throws IOException { Class < ? > realType = value . getClass ( ) ; Class < ? > effectiveType = declaredType ; if ( declaredType == Object . class ) { if ( realType != String . class ) { effectiveType = settings . getConverter...
needs to handle no declared type and subclass instances
460
void writeObjectAsString ( Object value , Class < ? > effectiveType ) throws IOException { String converted = settings . getConverter ( ) . convertToString ( effectiveType , value ) ; if ( converted == null ) { throw new IllegalArgumentException ( "Unable to write because converter returned a null string: " + value ) ;...
called after discerning that the value is not a simple type
461
private static MetaBean metaBeanLookup ( Class < ? > cls ) { if ( cls == FlexiBean . class ) { return new FlexiBean ( ) . metaBean ( ) ; } else if ( cls == MapBean . class ) { return new MapBean ( ) . metaBean ( ) ; } else if ( DynamicBean . class . isAssignableFrom ( cls ) ) { try { return cls . asSubclass ( DynamicBe...
lookup the MetaBean outside the fast path aiding hotspot inlining
462
private static List < File > findFiles ( final File parent , boolean recurse ) { final List < File > result = new ArrayList < > ( ) ; if ( parent . isDirectory ( ) ) { File [ ] files = parent . listFiles ( ) ; files = ( files != null ? files : new File [ 0 ] ) ; for ( File child : files ) { if ( child . isFile ( ) && c...
Finds the set of files to process .
463
private File processFile ( File file ) throws Exception { List < String > original = readFile ( file ) ; List < String > content = new ArrayList < > ( original ) ; BeanGen gen ; try { BeanParser parser = new BeanParser ( file , content , config ) ; gen = parser . parse ( ) ; } catch ( BeanCodeGenException ex ) { throw ...
Processes the bean generating the code .
464
private void writeClassDescriptions ( BeanReferences references ) throws IOException { output . writeInt ( references . getReferences ( ) . size ( ) ) ; List < ClassInfo > classInfos = references . getClassInfoList ( ) ; output . writeMapHeader ( classInfos . size ( ) ) ; for ( ClassInfo classInfo : classInfos ) { Stri...
determines what beans occur more than once and setup references
465
public static < R > StandaloneMetaProperty < R > of ( String propertyName , MetaBean metaBean , Class < R > clazz ) { return new StandaloneMetaProperty < > ( propertyName , metaBean , clazz , clazz ) ; }
Creates a non - generified property .
466
public byte [ ] write ( Bean bean , boolean rootType ) { ByteArrayOutputStream baos = new ByteArrayOutputStream ( 1024 ) ; try { write ( bean , rootType , baos ) ; } catch ( IOException ex ) { throw new IllegalStateException ( ex ) ; } return baos . toByteArray ( ) ; }
Writes the bean to an array of bytes .
467
protected void propertySet ( Bean bean , String propertyName , Object value , boolean quiet ) { if ( quiet ) { return ; } throw new NoSuchElementException ( "Unknown property: " + propertyName ) ; }
Sets the value of the property .
468
private void findChildBeans ( Object obj , MetaProperty < ? > mp , Class < ? > beanClass , Deque < Bean > temp ) { if ( obj != null ) { if ( obj instanceof Bean ) { temp . addFirst ( ( Bean ) obj ) ; } else { SerIterator it = SerIteratorFactory . INSTANCE . create ( obj , mp , beanClass ) ; if ( it != null ) { while ( ...
find child beans including those in collections
469
private void findReferences ( ImmutableBean root ) { classes . put ( root . getClass ( ) , classInfoFromMetaBean ( root . metaBean ( ) , root . getClass ( ) ) ) ; classSerializationCount . put ( root . getClass ( ) , 1 ) ; Map < Object , Integer > objects = new LinkedHashMap < > ( ) ; findReferencesBean ( root , root ....
finds classes and references within the bean
470
private void findReferencesBean ( Object base , Class < ? > declaredClass , Map < Object , Integer > objects , SerIterator parentIterator ) { if ( base == null ) { return ; } int result = objects . compute ( base , BeanReferences :: incrementOrOne ) ; if ( result > 1 ) { return ; } if ( base instanceof Bean ) { addClas...
recursively find the references
471
private void findReferencesIterable ( SerIterator itemIterator , Map < Object , Integer > objects ) { if ( itemIterator . category ( ) == SerCategory . MAP ) { while ( itemIterator . hasNext ( ) ) { itemIterator . next ( ) ; findReferencesBean ( itemIterator . key ( ) , itemIterator . keyType ( ) , objects , null ) ; f...
recursively find the references in an iterable
472
private void addClassInfoAndIncrementCount ( Class < ? > type , ClassInfo classInfo ) { classes . putIfAbsent ( type , classInfo ) ; classSerializationCount . compute ( type , BeanReferences :: incrementOrOne ) ; }
adds the class incrementing the number of times it is used
473
private ClassInfo classInfoFromMetaBean ( MetaBean metaBean , Class < ? > aClass ) { MetaProperty < ? > [ ] metaProperties = StreamSupport . stream ( metaBean . metaPropertyIterable ( ) . spliterator ( ) , false ) . filter ( metaProp -> settings . isSerialized ( metaProp ) ) . toArray ( MetaProperty < ? > [ ] :: new ) ...
converts a meta - bean to a ClassInfo
474
ClassInfo getClassInfo ( Class < ? > effectiveType ) { ClassInfo classInfo = classes . get ( effectiveType ) ; if ( classInfo == null ) { throw new IllegalStateException ( "Tried to serialise class that wasn't present in bean on first pass: " + effectiveType . getName ( ) ) ; } return classInfo ; }
lookup the class info by type
475
private void writeObject ( Class < ? > declaredType , Object obj , SerIterator parentIterator ) throws IOException { if ( obj == null ) { output . writeNull ( ) ; } else if ( settings . getConverter ( ) . isConvertible ( obj . getClass ( ) ) ) { writeSimple ( declaredType , obj ) ; } else if ( obj instanceof Bean ) { w...
write collection object
476
private < T > T parseVersion ( DataInputStream input , Class < T > declaredType ) throws Exception { int arrayByte = input . readByte ( ) ; int versionByte = input . readByte ( ) ; switch ( versionByte ) { case 1 : if ( arrayByte != MIN_FIX_ARRAY + 2 ) { throw new IllegalArgumentException ( "Invalid binary data: Expect...
parses the version
477
public static CacheFrame [ ] get ( Throwable throwable ) { if ( throwable == null ) { return null ; } Map < Throwable , CacheFrame [ ] > weakMap = cache . get ( ) ; return weakMap . get ( throwable ) ; }
Get the cached frames associated with the given throwable .
478
public void setPersonData ( final String id , final String username , final String email ) { this . rollbar . configure ( new ConfigProvider ( ) { public Config provide ( ConfigBuilder builder ) { return builder . person ( new PersonProvider ( id , username , email ) ) . build ( ) ; } } ) ; }
Set the person data to include with future items .
479
public void clearPersonData ( ) { this . rollbar . configure ( new ConfigProvider ( ) { public Config provide ( ConfigBuilder builder ) { return builder . person ( null ) . build ( ) ; } } ) ; }
Remove any person data that might be set .
480
public void setIncludeLogcat ( final boolean includeLogcat ) { final int versionCode = this . versionCode ; final String versionName = this . versionName ; this . rollbar . configure ( new ConfigProvider ( ) { public Config provide ( ConfigBuilder builder ) { ClientProvider clientProvider = new ClientProvider . Builder...
Toggle whether to include logcat output in items .
481
public void critical ( Throwable error , Map < String , Object > custom ) { critical ( error , custom , null ) ; }
Record a critical error with extra information attached .
482
public void critical ( Throwable error , Map < String , Object > custom , String description ) { log ( error , custom , description , Level . CRITICAL ) ; }
Record a critical error with custom parameters and human readable description .
483
public void warning ( Throwable error , Map < String , Object > custom ) { warning ( error , custom , null ) ; }
Record a warning error with extra information attached .
484
public void warning ( Throwable error , Map < String , Object > custom , String description ) { log ( error , custom , description , Level . WARNING ) ; }
Record a warning error with custom parameters and human readable description .
485
public void info ( Throwable error , Map < String , Object > custom ) { info ( error , custom , null ) ; }
Record an info error with extra information attached .
486
public void info ( Throwable error , Map < String , Object > custom , String description ) { log ( error , custom , description , Level . INFO ) ; }
Record an info error with custom parameters and human readable description .
487
public void debug ( Throwable error , Map < String , Object > custom ) { debug ( error , custom , null ) ; }
Record a debug error with extra information attached .
488
public void debug ( Throwable error , Map < String , Object > custom , String description ) { log ( error , custom , description , Level . DEBUG ) ; }
Record a debug error with custom parameters and human readable description .
489
public void log ( Throwable error , Level level ) { log ( error , null , null , level ) ; }
Log an error at level specified .
490
public void log ( Throwable error , String description , Level level ) { log ( error , null , description , level ) ; }
Record a debug error with human readable description at the specified level .
491
public void log ( String message , Level level ) { log ( null , null , message , level ) ; }
Record a message at the level specified .
492
public void log ( String message , Map < String , Object > custom , Level level ) { log ( null , custom , message , level ) ; }
Record a message with extra information attached at the specified level .
493
public static void reportException ( final Throwable throwable , final String level ) { reportException ( throwable , level , null , null ) ; }
report an exception to Rollbar specifying the level .
494
public static void reportException ( final Throwable throwable , final String level , final String description , final Map < String , String > params ) { ensureInit ( new Runnable ( ) { public void run ( ) { notifier . log ( throwable , params != null ? Collections . < String , Object > unmodifiableMap ( params ) : nul...
report an exception to Rollbar specifying the level adding a custom description and including extra data .
495
public static void reportMessage ( final String message , final String level ) { reportMessage ( message , level , null ) ; }
Report a message to Rollbar specifying the level .
496
public static void reportMessage ( final String message , final String level , final Map < String , String > params ) { ensureInit ( new Runnable ( ) { public void run ( ) { notifier . log ( message , params != null ? Collections . < String , Object > unmodifiableMap ( params ) : null , Level . lookupByName ( level ) )...
Report a message to Rollbar specifying the level and including extra data .
497
public String greeting ( ) { int current = counter . getAndAdd ( 1 ) ; if ( current % 2 != 0 ) { return format ( "Hello Rollbar number %d" , current ) ; } throw new RuntimeException ( "Fatal error at greeting number: " + current ) ; }
Get the greeting message .
498
public static ConfigProvider getConfigProvider ( String configProviderClassName ) { ConfigProvider configProvider = null ; if ( configProviderClassName != null && ! "" . equals ( configProviderClassName ) ) { Class userConfigProviderClass = null ; try { userConfigProviderClass = Class . forName ( configProviderClassNam...
Instantiate a ConfigProvider object based on the class name given as parameter .
499
public void critical ( Throwable error , String description ) { log ( error , null , description , Level . CRITICAL ) ; }
Record a critical error with human readable description .