idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
41,500 | protected void addRequestHeaders ( HessianConnection conn ) { conn . addHeader ( "Content-Type" , "x-application/hessian" ) ; conn . addHeader ( "Accept-Encoding" , "deflate" ) ; String basicAuth = _factory . getBasicAuth ( ) ; if ( basicAuth != null ) conn . addHeader ( "Authorization" , basicAuth ) ; } | Method that allows subclasses to add request headers such as cookies . Default implementation is empty . | 88 | 18 |
41,501 | public HessianConnection open ( URL url ) throws IOException { if ( log . isLoggable ( Level . FINER ) ) log . finer ( this + " open(" + url + ")" ) ; URLConnection conn = url . openConnection ( ) ; // HttpURLConnection httpConn = (HttpURLConnection) conn; // httpConn.setRequestMethod("POST"); // conn.setDoInput(true);... | Opens a new or recycled connection to the HTTP server . | 274 | 12 |
41,502 | public static void begin ( ServletRequest request , ServletResponse response , String serviceName , String objectId ) throws ServletException { ServiceContext context = ( ServiceContext ) _localContext . get ( ) ; if ( context == null ) { context = new ServiceContext ( ) ; _localContext . set ( context ) ; } context . ... | Sets the request object prior to calling the service s method . | 108 | 13 |
41,503 | public static Object getContextHeader ( String header ) { ServiceContext context = ( ServiceContext ) _localContext . get ( ) ; if ( context != null ) return context . getHeader ( header ) ; else return null ; } | Gets a header from the context . | 47 | 8 |
41,504 | public static void end ( ) { ServiceContext context = ( ServiceContext ) _localContext . get ( ) ; if ( context != null && -- context . _count == 0 ) { context . _request = null ; context . _response = null ; context . _headers . clear ( ) ; _localContext . set ( null ) ; } } | Cleanup at the end of a request . | 72 | 9 |
41,505 | private String getArrayType ( Class cl ) { if ( cl . isArray ( ) ) return ' ' + getArrayType ( cl . getComponentType ( ) ) ; String name = cl . getName ( ) ; if ( name . equals ( "java.lang.String" ) ) return "string" ; else if ( name . equals ( "java.lang.Object" ) ) return "object" ; else if ( name . equals ( "java.u... | Returns the < ; type > name for a < ; list > . | 113 | 16 |
41,506 | @ Override public String doLayout ( ILoggingEvent event ) { // Format message String msg = super . doLayout ( event ) . trim ( ) ; // prevent log forging msg = preventLogForging ( msg ) ; // Formatting of exception, remove line breaks IThrowableProxy throwableProxy = event . getThrowableProxy ( ) ; if ( throwableProxy ... | Creates formatted String using conversion pattern . | 234 | 8 |
41,507 | private String preventLogForging ( String logMsg ) { String result = logMsg ; // use precompiled pattern for performance reasons result = LINEBREAK_PATTERN . matcher ( logMsg ) . replaceAll ( SingleLinePatternLayout . LINE_SEP ) ; return result ; } | Method to prevent log forging . | 62 | 6 |
41,508 | @ PostConstruct public void initialize ( ) { if ( this . pojoDescriptorBuilderFactory == null ) { this . pojoDescriptorBuilderFactory = PojoDescriptorBuilderFactoryImpl . getInstance ( ) ; } if ( this . pojoDescriptorBuilder == null ) { this . pojoDescriptorBuilder = this . pojoDescriptorBuilderFactory . createPrivateF... | Initializes this class to be functional . | 118 | 8 |
41,509 | protected Response handleSecurityError ( Throwable exception , Throwable catched ) { NlsRuntimeException error ; if ( ( exception == catched ) && ( exception instanceof NlsRuntimeException ) ) { error = ( NlsRuntimeException ) exception ; } else { error = new SecurityErrorUserException ( catched ) ; } LOG . error ( "Se... | Exception handling for security exception . | 170 | 6 |
41,510 | protected Response handleValidationException ( Throwable exception , Throwable catched ) { Throwable t = catched ; Map < String , List < String > > errorsMap = null ; if ( exception instanceof ConstraintViolationException ) { ConstraintViolationException constraintViolationException = ( ConstraintViolationException ) e... | Exception handling for validation exception . | 294 | 6 |
41,511 | protected Response createResponse ( WebApplicationException exception ) { Response response = exception . getResponse ( ) ; int statusCode = response . getStatus ( ) ; Status status = Status . fromStatusCode ( statusCode ) ; NlsRuntimeException error ; if ( exception instanceof ServerErrorException ) { error = new Tech... | Add a response message to an existing response . | 225 | 9 |
41,512 | protected void initialize ( AccessControlSchema config ) { LOG . debug ( "Initializing." ) ; List < AccessControlGroup > groups = config . getGroups ( ) ; if ( groups . size ( ) == 0 ) { throw new IllegalStateException ( "AccessControlSchema is empty - please configure at least one group!" ) ; } Set < AccessControlGrou... | Performs the required initialization of this class . | 159 | 9 |
41,513 | @ SuppressWarnings ( "unchecked" ) public < T > T get ( String key , Class < T > targetType , boolean required ) throws WebApplicationException { String value = get ( key ) ; if ( value == null ) { if ( required ) { throw new BadRequestException ( "Missing parameter: " + key ) ; } Object result = null ; if ( targetType... | Gets the single parameter in a generic and flexible way . | 328 | 12 |
41,514 | @ GET public String suspend ( ) { AtmosphereResource r = ( AtmosphereResource ) req . getAttribute ( "org.atmosphere.cpr.AtmosphereResource" ) ; r . setBroadcaster ( r . getAtmosphereConfig ( ) . getBroadcasterFactory ( ) . lookup ( "/cxf-chat" , true ) ) . suspend ( ) ; return "" ; } | Suspend the response without writing anything back to the client . | 84 | 13 |
41,515 | public void doPost ( AtmosphereResource ar ) { Object msg = ar . getRequest ( ) . getAttribute ( Constants . MESSAGE_OBJECT ) ; if ( msg != null ) { logger . info ( "received RPC post: " + msg . toString ( ) ) ; // for demonstration purposes we will broadcast the message to all connections ar . getAtmosphereConfig ( ) ... | receive push message from client | 107 | 6 |
41,516 | @ POST public void broadcast ( String message ) { AtmosphereResource r = ( AtmosphereResource ) request . getAttribute ( ApplicationConfig . ATMOSPHERE_RESOURCE ) ; if ( r != null ) { r . getBroadcaster ( ) . broadcast ( message ) ; } else { throw new IllegalStateException ( ) ; } } | Echo the chat message . Jackson can clearly be used here but for simplicity we just echo what we receive . | 70 | 22 |
41,517 | @ Ready public void onReady ( /* In you don't want injection AtmosphereResource r */ ) { logger . info ( "Browser {} connected" , r . uuid ( ) ) ; logger . info ( "BroadcasterFactory used {}" , factory . getClass ( ) . getName ( ) ) ; logger . info ( "Broadcaster injected {}" , broadcaster . getID ( ) ) ; } | Invoked when the connection has been fully established and suspended that is ready for receiving messages . | 84 | 18 |
41,518 | @ POST @ Produces ( "application/xml" ) @ Broadcast public Broadcastable publishWithXML ( @ FormParam ( "message" ) String message ) { return new Broadcastable ( new JAXBBean ( message ) , broadcaster ) ; } | Broadcast XML data using JAXB | 53 | 8 |
41,519 | @ GET @ Suspend ( period = 60 , timeUnit = TimeUnit . SECONDS , listeners = { EventsLogger . class } ) @ Path ( "timeout" ) public Broadcastable timeout ( ) { return new Broadcastable ( broadcaster ) ; } | Timeout the resource | 53 | 3 |
41,520 | public JSONObject addObject ( JSONObject obj , RequestOptions requestOptions ) throws AlgoliaException { return client . postRequest ( "/1/indexes/" + encodedIndexName , obj . toString ( ) , true , false , requestOptions ) ; } | Add an object in this index | 54 | 6 |
41,521 | public JSONObject addObjects ( List < JSONObject > objects ) throws AlgoliaException { return this . addObjects ( objects , RequestOptions . empty ) ; } | Add several objects | 36 | 3 |
41,522 | public JSONObject saveObject ( JSONObject object , String objectID ) throws AlgoliaException { return this . saveObject ( object , objectID , RequestOptions . empty ) ; } | Override the content of object | 38 | 5 |
41,523 | public JSONObject saveObjects ( List < JSONObject > objects ) throws AlgoliaException { return this . saveObjects ( objects , RequestOptions . empty ) ; } | Override the content of several objects | 36 | 6 |
41,524 | public JSONObject search ( Query params , RequestOptions requestOptions ) throws AlgoliaException { String paramsString = params . getQueryString ( ) ; JSONObject body = new JSONObject ( ) ; try { body . put ( "params" , paramsString ) ; } catch ( JSONException e ) { throw new RuntimeException ( e ) ; } return client .... | Search inside the index | 109 | 4 |
41,525 | public IndexBrowser browseFrom ( Query params , String cursor , RequestOptions requestOptions ) throws AlgoliaException { return new IndexBrowser ( client , encodedIndexName , params , cursor , requestOptions ) ; } | Browse all index content starting from a cursor | 43 | 9 |
41,526 | public JSONObject getSettings ( RequestOptions requestOptions ) throws AlgoliaException { return client . getRequest ( "/1/indexes/" + encodedIndexName + "/settings?getVersion=2" , false , requestOptions ) ; } | Get settings of this index | 50 | 5 |
41,527 | public JSONObject clearIndex ( RequestOptions requestOptions ) throws AlgoliaException { return client . postRequest ( "/1/indexes/" + encodedIndexName + "/clear" , "" , true , false , requestOptions ) ; } | Delete the index content without removing settings and index specific API keys . | 49 | 13 |
41,528 | public JSONObject setSettings ( JSONObject settings , RequestOptions requestOptions ) throws AlgoliaException { return setSettings ( settings , false , requestOptions ) ; } | Set settings for this index | 34 | 5 |
41,529 | public JSONObject getApiKey ( String key , RequestOptions requestOptions ) throws AlgoliaException { return client . getRequest ( "/1/indexes/" + encodedIndexName + "/keys/" + key , false , requestOptions ) ; } | Get ACL of an api key | 52 | 6 |
41,530 | public JSONObject deleteApiKey ( String key , RequestOptions requestOptions ) throws AlgoliaException { return client . deleteRequest ( "/1/indexes/" + encodedIndexName + "/keys/" + key , requestOptions ) ; } | Delete an existing api key | 50 | 5 |
41,531 | public JSONObject clearSynonyms ( boolean forwardToReplicas , RequestOptions requestOptions ) throws AlgoliaException { return client . postRequest ( "/1/indexes/" + encodedIndexName + "/synonyms/clear?forwardToReplicas=" + forwardToReplicas , "" , true , false , requestOptions ) ; } | Delete all synonym set | 69 | 5 |
41,532 | public JSONObject getRule ( String objectID , RequestOptions requestOptions ) throws AlgoliaException { if ( objectID == null || objectID . length ( ) == 0 ) { throw new AlgoliaException ( "Invalid objectID" ) ; } try { return client . getRequest ( "/1/indexes/" + encodedIndexName + "/rules/" + URLEncoder . encode ( ob... | Get a query rule | 120 | 4 |
41,533 | public Query setOptionalWords ( List < String > words ) { StringBuilder builder = new StringBuilder ( ) ; for ( String word : words ) { builder . append ( word ) ; builder . append ( "," ) ; } this . optionalWords = builder . toString ( ) ; return this ; } | Set the list of words that should be considered as optional when found in the query . | 63 | 17 |
41,534 | static String getFallbackDomain ( ) { int javaVersion = getJavaVersion ( ) ; boolean javaHasSNI = javaVersion >= 7 ; final VersionInfo vi = VersionInfo . loadVersionInfo ( "org.apache.http.client" , APIClient . class . getClassLoader ( ) ) ; String version = vi . getRelease ( ) ; String [ ] split = version . split ( "\... | Get the appropriate fallback domain depending on the current SNI support . Checks Java version and Apache HTTP Client s version . | 211 | 24 |
41,535 | public void setUserAgent ( String agent , String agentVersion ) { userAgent = String . format ( "Algolia for Java (%s); JVM (%s); %s (%s)" , version , System . getProperty ( "java.version" ) , agent , agentVersion ) ; } | Allow to modify the user - agent in order to add the user agent of the integration | 62 | 17 |
41,536 | public void enableRateLimitForward ( String adminAPIKey , String endUserIP , String rateLimitAPIKey ) { this . forwardAdminAPIKey = adminAPIKey ; this . forwardEndUserIP = endUserIP ; this . forwardRateLimitAPIKey = rateLimitAPIKey ; } | Allow to use IP rate limit when you have a proxy between end - user and Algolia . This option will set the X - Forwarded - For HTTP header with the client IP and the X - Forwarded - API - Key with the API Key having rate limits . | 60 | 55 |
41,537 | public void changeAnimation ( ViewHolder oldHolder , ViewHolder newHolder , int fromX , int fromY , int toX , int toY ) { final float prevTranslationX = ViewCompat . getTranslationX ( oldHolder . itemView ) ; final float prevTranslationY = ViewCompat . getTranslationY ( oldHolder . itemView ) ; final float prevValue = ... | the whole change animation if we have to cross animate two views | 284 | 12 |
41,538 | protected long determineBalance ( final IntervalTreeNode node ) { if ( node == null ) { return 0L ; } return ( node . hasLeft ( ) ? node . getLeft ( ) . getHeight ( ) : 0 ) - ( node . hasRight ( ) ? node . getRight ( ) . getHeight ( ) : 0 ) ; } | Get Balance factor of node N | 73 | 6 |
41,539 | protected void fill ( int fromIndex , int endIndex ) { fromIndex = fromIndex == - 1 ? 0 : fromIndex ; endIndex = endIndex == - 1 || endIndex > this . timeSeries . length ? this . timeSeries . length : endIndex ; final T val ; if ( applyZero ( ) ) { val = zero ( ) ; } else { val = null ; } // set the values for ( int i ... | Resets the values from [ fromIndex endIndex ) . | 112 | 12 |
41,540 | public BucketEndPoints getEndPoints ( final int bucketsFromNow ) throws IllegalTimePoint { if ( currentNowIdx == - 1 || now == null ) { throw new IllegalTimePoint ( "The now is not set yet, thus no end-points can be returned" ) ; } return now . move ( bucketsFromNow ) ; } | Gets the end - points by an offset to now i . e . 0 means to get the now bucket - 1 gets the previous bucket and + 1 will get the next bucket . | 71 | 37 |
41,541 | public int getBucketSize ( final long diffInSeconds ) { // convert one unit of this into seconds final long secondsPerBucket = TimeUnit . SECONDS . convert ( config . getBucketSize ( ) , config . getTimeUnit ( ) ) ; return ( int ) Math . ceil ( ( double ) diffInSeconds / secondsPerBucket ) ; } | Determines the number of buckets used to cover the seconds . | 81 | 13 |
41,542 | public void setNow ( final long unixTimeStamp ) throws IllegalTimePointMovement { /* * "now" strongly depends on the TimeUnit used for the timeSeries, as * well as the bucketSize. If, e.g., the TimeUnit is MINUTES and the * bucketSize is 5, a unix time stamp representing 01/20/1981 08:07:30 * must be mapped to 01/20/19... | Modifies the now unix time stamp of the time - series . This modifies the time - series i . e . data might be removed if the data is pushed . | 596 | 35 |
41,543 | public SerIterable createIterable ( String metaTypeDescription , JodaBeanSer settings , Map < String , Class < ? > > knownTypes ) { if ( metaTypeDescription . equals ( "Set" ) ) { return set ( Object . class , EMPTY_VALUE_TYPES ) ; } if ( metaTypeDescription . equals ( "List" ) ) { return list ( Object . class , EMPTY_... | Creates an iterator wrapper for a meta - type description . | 497 | 12 |
41,544 | public SerIterable createIterable ( SerIterable iterable ) { List < Class < ? > > valueTypeTypes = iterable . valueTypeTypes ( ) ; if ( valueTypeTypes . size ( ) > 0 ) { Class < ? > valueType = iterable . valueType ( ) ; if ( NavigableSet . class . isAssignableFrom ( valueType ) ) { return navigableSet ( valueTypeTypes... | Creates an iterator wrapper for a child where there are second level generic parameters . | 564 | 16 |
41,545 | public static final SerIterable array ( final Class < ? > valueType ) { final List < Object > list = new ArrayList <> ( ) ; return new SerIterable ( ) { @ Override public SerIterator iterator ( ) { return array ( build ( ) , Object . class , valueType ) ; } @ Override public void add ( Object key , Object column , Obje... | Gets an iterable wrapper for an object array . | 249 | 11 |
41,546 | public static final SerIterator array ( final Object [ ] array , final Class < ? > declaredType , final Class < ? > valueType ) { return new SerIterator ( ) { private int index = - 1 ; @ Override public String metaTypeName ( ) { return metaTypeNameBase ( valueType ) ; } private String metaTypeNameBase ( Class < ? > arr... | Gets an iterator wrapper for an object array . | 347 | 10 |
41,547 | private StartElement advanceToStartElement ( ) throws Exception { while ( reader . hasNext ( ) ) { XMLEvent event = nextEvent ( "advnc " ) ; if ( event . isStartElement ( ) ) { return event . asStartElement ( ) ; } } throw new IllegalArgumentException ( "Unexpected end of document" ) ; } | reader can be anywhere but normally at StartDocument | 76 | 9 |
41,548 | private String advanceAndParseText ( ) throws Exception { StringBuilder buf = new StringBuilder ( ) ; while ( reader . hasNext ( ) ) { XMLEvent event = nextEvent ( "text " ) ; if ( event . isCharacters ( ) ) { buf . append ( event . asCharacters ( ) . getData ( ) ) ; } else if ( event . isEndElement ( ) ) { return buf ... | reader must be at StartElement | 141 | 6 |
41,549 | private XMLEvent nextEvent ( String location ) throws Exception { XMLEvent event = reader . nextEvent ( ) ; // System.out.println(location + event.toString().replace('\n', ' ') + " " + event.getClass().getSimpleName()); return event ; } | provide for debugging | 66 | 4 |
41,550 | public JodaBeanSer withIndent ( String indent ) { JodaBeanUtils . notNull ( indent , "indent" ) ; return new JodaBeanSer ( indent , newLine , converter , iteratorFactory , shortTypes , deserializers , includeDerived ) ; } | Returns a copy of this serializer with the specified pretty print indent . | 63 | 14 |
41,551 | public JodaBeanSer withNewLine ( String newLine ) { JodaBeanUtils . notNull ( newLine , "newLine" ) ; return new JodaBeanSer ( indent , newLine , converter , iteratorFactory , shortTypes , deserializers , includeDerived ) ; } | Returns a copy of this serializer with the specified pretty print new line . | 65 | 15 |
41,552 | public JodaBeanSer withIteratorFactory ( SerIteratorFactory iteratorFactory ) { JodaBeanUtils . notNull ( iteratorFactory , "iteratorFactory" ) ; return new JodaBeanSer ( indent , newLine , converter , iteratorFactory , shortTypes , deserializers , includeDerived ) ; } | Returns a copy of this serializer with the specified iterator factory . | 67 | 13 |
41,553 | public JodaBeanSer withShortTypes ( boolean shortTypes ) { return new JodaBeanSer ( indent , newLine , converter , iteratorFactory , shortTypes , deserializers , includeDerived ) ; } | Returns a copy of this serializer with the short types flag set . | 46 | 14 |
41,554 | public boolean isSerialized ( MetaProperty < ? > prop ) { return prop . style ( ) . isSerializable ( ) || ( prop . style ( ) . isDerived ( ) && includeDerived ) ; } | Checks if the property is serialized . | 46 | 9 |
41,555 | public static < P > BasicProperty < P > of ( Bean bean , MetaProperty < P > metaProperty ) { return new BasicProperty <> ( bean , metaProperty ) ; } | Factory to create a property avoiding duplicate generics . | 38 | 10 |
41,556 | void writeInt ( int value ) throws IOException { if ( ( value & 0xfffffff8 ) == 0 ) { output . append ( ( char ) ( value + 48 ) ) ; } else { output . append ( Integer . toString ( value ) ) ; } } | Writes a JSON int . | 58 | 6 |
41,557 | 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 . | 165 | 6 |
41,558 | 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 . | 66 | 8 |
41,559 | void writeObjectStart ( ) throws IOException { output . append ( ' ' ) ; currentIndent = currentIndent + indent ; commaDepth ++ ; commaState . set ( commaDepth , false ) ; } | Writes a JSON object start . | 44 | 7 |
41,560 | void writeObjectKeyValue ( String key , String value ) throws IOException { writeObjectKey ( key ) ; writeString ( value ) ; } | Writes a JSON object key and value . | 30 | 9 |
41,561 | 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 . | 81 | 7 |
41,562 | 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 . | 112 | 13 |
41,563 | public SerDeserializers register ( Class < ? > type , SerDeserializer deserializer ) { deserializers . put ( type , deserializer ) ; return this ; } | Adds the deserializer to be used for the specified type . | 39 | 13 |
41,564 | 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 | 112 | 4 |
41,565 | 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 | 364 | 7 |
41,566 | private static SerDeserializer toLenient ( SerDeserializer underlying ) { return new SerDeserializer ( ) { @ Override public MetaBean findMetaBean ( Class < ? > beanType ) { return underlying . findMetaBean ( beanType ) ; } @ Override public BeanBuilder < ? > createBuilder ( Class < ? > beanType , MetaBean metaBean ) {... | makes the deserializer lenient | 253 | 7 |
41,567 | private Map < String , Object > dataWritable ( ) { if ( data == Collections . EMPTY_MAP ) { data = new LinkedHashMap <> ( ) ; } return data ; } | Gets the internal data map . | 42 | 7 |
41,568 | 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 . | 51 | 10 |
41,569 | @ Deprecated 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 " + Arr... | Creates an instance of the bean . | 133 | 8 |
41,570 | 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 | 151 | 8 |
41,571 | JsonEvent readEvent ( ) throws IOException { char next = readNext ( ) ; // whitespace while ( next == ' ' || next == ' ' || next == ' ' || next == ' ' ) { next = readNext ( ) ; } // identify token switch ( next ) { case ' ' : return JsonEvent . OBJECT ; case ' ' : return JsonEvent . OBJECT_END ; case ' ' : return JsonE... | Writes a JSON null . | 261 | 6 |
41,572 | String acceptObjectKey ( JsonEvent event ) throws IOException { ensureEvent ( event , JsonEvent . STRING ) ; return parseObjectKey ( ) ; } | expect object key and parse it | 35 | 7 |
41,573 | JsonEvent acceptObjectSeparator ( ) throws IOException { JsonEvent event = readEvent ( ) ; if ( event == JsonEvent . COMMA ) { return readEvent ( ) ; // leniently allow comma before objectEnd } else { return ensureEvent ( event , JsonEvent . OBJECT_END ) ; } } | accepts a comma or object end | 72 | 7 |
41,574 | JsonEvent acceptArraySeparator ( ) throws IOException { JsonEvent event = readEvent ( ) ; if ( event == JsonEvent . COMMA ) { return readEvent ( ) ; // leniently allow comma before arrayEnd } else { return ensureEvent ( event , JsonEvent . ARRAY_END ) ; } } | accepts a comma or array end | 72 | 7 |
41,575 | public void ensureImport ( Class < ? > cls ) { if ( currentImports . contains ( cls . getName ( ) ) == false ) { newImports . add ( cls . getName ( ) ) ; } } | Ensures an import is present . | 50 | 8 |
41,576 | 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 . | 52 | 11 |
41,577 | 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 . | 52 | 11 |
41,578 | 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 . | 77 | 6 |
41,579 | 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 . | 90 | 11 |
41,580 | 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 . | 367 | 6 |
41,581 | 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 . | 225 | 8 |
41,582 | 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 . | 97 | 15 |
41,583 | 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 . | 88 | 15 |
41,584 | 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 . R... | Factory to create a read - only meta - property avoiding duplicate generics . | 88 | 15 |
41,585 | 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 . | 88 | 15 |
41,586 | 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 , Property... | Factory to create a buildable read - only meta - property avoiding duplicate generics . | 95 | 17 |
41,587 | 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 . DE... | Factory to create a derived read - only meta - property avoiding duplicate generics . | 88 | 16 |
41,588 | 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 . | 88 | 14 |
41,589 | 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 . | 62 | 17 |
41,590 | 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 . | 70 | 12 |
41,591 | 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 . | 206 | 6 |
41,592 | 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 . | 221 | 7 |
41,593 | 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 . | 155 | 8 |
41,594 | 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 . | 145 | 7 |
41,595 | public String getFieldTypeRaw ( ) { int pos = fieldType . indexOf ( "<" ) ; return ( pos < 0 ? fieldType : fieldType . substring ( 0 , pos ) ) ; } | Gets the raw type of the property . | 44 | 9 |
41,596 | 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 . | 744 | 7 |
41,597 | 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 . | 243 | 8 |
41,598 | 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 . | 107 | 7 |
41,599 | 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 ) ; } // this does not handle arrays embedded in objects, such as in lists/maps // but you ... | Checks if two objects are equal handling null . | 112 | 10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.