idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
132,400
public static String param ( JavaScriptObject js ) { Properties prop = js . cast ( ) ; String ret = "" ; for ( String k : prop . keys ( ) ) { ret += ret . isEmpty ( ) ? "" : "&" ; JsCache o = prop . getArray ( k ) . cast ( ) ; if ( o != null ) { for ( int i = 0 , l = o . length ( ) ; i < l ; i ++ ) { ret += i > 0 ? "&"...
Returns a QueryString representation of a JavascriptObject .
132,401
public void setStyleProperty ( Element e , String prop , String val ) { if ( "opacity" . equals ( prop ) ) { setOpacity ( e , val ) ; } else { super . setStyleProperty ( e , prop , val ) ; } }
Set the value of a style property of an element . IE needs a special workaround to handle opacity
132,402
public static IsProperties create ( String s , boolean fixJson ) { return getFactory ( ) . create ( fixJson ? Properties . wrapPropertiesString ( s ) : s ) ; }
Create an instance of IsProperties a Properties JavaScriptObject in the client side and a proxy object in the JVM .
132,403
@ SuppressWarnings ( { "rawtypes" , "unchecked" } ) private < T > T getCustomMarshalledValue ( T toReturn , Method getter , AttributeValue value ) { DynamoDBMarshalling annotation = getter . getAnnotation ( DynamoDBMarshalling . class ) ; Class < ? extends DynamoDBMarshaller < ? extends Object > > marshallerClass = ann...
Marshalls the custom value given into the proper return type .
132,404
@ SuppressWarnings ( { "rawtypes" , "unchecked" } ) private AttributeValue getCustomerMarshallerAttributeValue ( Method getter , Object getterReturnResult ) { DynamoDBMarshalling annotation = getter . getAnnotation ( DynamoDBMarshalling . class ) ; Class < ? extends DynamoDBMarshaller < ? extends Object > > marshallerC...
Returns an attribute value for the getter method with a custom marshaller
132,405
private boolean parseBoolean ( String s ) { if ( "1" . equals ( s ) ) { return true ; } else if ( "0" . equals ( s ) ) { return false ; } else { throw new IllegalArgumentException ( "Expected 1 or 0 for boolean value, was " + s ) ; } }
Attempts to parse the string given as a boolean and return its value . Throws an exception if the value is anything other than 0 or 1 .
132,406
ArgumentMarshaller getVersionedArgumentMarshaller ( final Method getter , Object getterReturnResult ) { synchronized ( versionArgumentMarshallerCache ) { if ( ! versionArgumentMarshallerCache . containsKey ( getter ) ) { ArgumentMarshaller marshaller = null ; final Class < ? > returnType = getter . getReturnType ( ) ; ...
Returns a marshaller that knows how to provide an AttributeValue for the getter method given . Also increments the value of the getterReturnResult given .
132,407
ArgumentMarshaller getAutoGeneratedKeyArgumentMarshaller ( final Method getter ) { synchronized ( keyArgumentMarshallerCache ) { if ( ! keyArgumentMarshallerCache . containsKey ( getter ) ) { ArgumentMarshaller marshaller = null ; Class < ? > returnType = getter . getReturnType ( ) ; if ( String . class . isAssignableF...
Returns a marshaller for the auto - generated key returned by the getter given .
132,408
protected boolean mouseDown ( Element element , GqEvent event ) { if ( isEventAlreadyHandled ( event ) ) { return false ; } if ( started ) { mouseUp ( element , event ) ; } reset ( event ) ; if ( notHandleMouseDown ( element , event ) ) { return true ; } if ( delayConditionMet ( ) && distanceConditionMet ( event ) ) { ...
Method called when mouse down occur on the element .
132,409
protected boolean mouseMove ( Element element , GqEvent event ) { if ( started ) { event . getOriginalEvent ( ) . preventDefault ( ) ; return mouseDrag ( element , event ) ; } if ( delayConditionMet ( ) && distanceConditionMet ( event ) ) { started = mouseStart ( element , startEvent ) ; if ( started ) { mouseDrag ( el...
Method called on MouseMove event .
132,410
protected boolean mouseUp ( Element element , GqEvent event ) { unbindOtherEvents ( ) ; if ( started ) { started = false ; preventClickEvent = event . getCurrentEventTarget ( ) == startEvent . getCurrentEventTarget ( ) ; mouseStop ( element , event ) ; } return true ; }
Method called when mouse is released ..
132,411
private String getContent ( TreeLogger logger , String path , String src ) throws UnableToCompleteException { HttpURLConnection connection = null ; InputStream in = null ; try { if ( ! src . matches ( "(?i)https?://.*" ) ) { String file = path + "/" + src ; in = this . getClass ( ) . getClassLoader ( ) . getResourceAsS...
Get the content of a javascript source . It supports remote sources hosted in CDN s .
132,412
public < T extends Object > T load ( Class < T > clazz , Object hashKey , DynamoDBMapperConfig config ) { return load ( clazz , hashKey , null , config ) ; }
Loads an object with the hash key given and a configuration override . This configuration overrides the default provided at object construction .
132,413
public < T extends Object > T load ( Class < T > clazz , Object hashKey , Object rangeKey , DynamoDBMapperConfig config ) { config = mergeConfig ( config ) ; String tableName = getTableName ( clazz , config ) ; Method hashKeyGetter = reflector . getHashKeyGetter ( clazz ) ; AttributeValue hashKeyElement = getHashKeyEle...
Returns an object with the given hash key or null if no such object exists .
132,414
public < T > List < T > marshallIntoObjects ( Class < T > clazz , List < Map < String , AttributeValue > > itemAttributes ) { List < T > result = new ArrayList < T > ( ) ; for ( Map < String , AttributeValue > item : itemAttributes ) { result . add ( marshallIntoObject ( clazz , item ) ) ; } return result ; }
Marshalls the list of item attributes into objects of type clazz
132,415
private < T > void setValue ( final T toReturn , final Method getter , AttributeValue value ) { Method setter = reflector . getSetter ( getter ) ; ArgumentUnmarshaller unmarhsaller = reflector . getArgumentUnmarshaller ( toReturn , getter , setter ) ; unmarhsaller . typeCheck ( value , setter ) ; Object argument ; try ...
Sets the value in the return object corresponding to the service result .
132,416
public void delete ( Object object , DynamoDBMapperConfig config ) { config = mergeConfig ( config ) ; Class < ? > clazz = object . getClass ( ) ; String tableName = getTableName ( clazz , config ) ; Method hashKeyGetter = reflector . getHashKeyGetter ( clazz ) ; AttributeValue hashKeyElement = getHashKeyElement ( safe...
Deletes the given object from its DynamoDB table .
132,417
private boolean validBatchGetRequest ( Map < Class < ? > , List < KeyPair > > itemsToGet ) { if ( itemsToGet == null || itemsToGet . size ( ) == 0 ) { return false ; } for ( Class < ? > clazz : itemsToGet . keySet ( ) ) { if ( itemsToGet . get ( clazz ) != null && itemsToGet . get ( clazz ) . size ( ) > 0 ) { return tr...
Check whether the batchGetRequest meet all the constraints .
132,418
private AttributeValue getAutoGeneratedKeyAttributeValue ( Method getter , Object getterResult ) { ArgumentMarshaller marshaller = reflector . getAutoGeneratedKeyArgumentMarshaller ( getter ) ; return marshaller . marshall ( getterResult ) ; }
Returns an attribute value corresponding to the key method and value given .
132,419
public < T > ScanResultPage < T > scanPage ( Class < T > clazz , DynamoDBScanExpression scanExpression , DynamoDBMapperConfig config ) { config = mergeConfig ( config ) ; ScanRequest scanRequest = createScanRequestFromExpression ( clazz , scanExpression , config ) ; ScanResult scanResult = db . scan ( applyUserAgent ( ...
Scans through an Amazon DynamoDB table and returns a single page of matching results . The table to scan is determined by looking at the annotations on the specified class which declares where to store the object data in AWS DynamoDB and the scan expression parameter allows the caller to filter results and control how ...
132,420
public < T > PaginatedQueryList < T > query ( Class < T > clazz , DynamoDBQueryExpression queryExpression ) { return query ( clazz , queryExpression , config ) ; }
Queries an Amazon DynamoDB table and returns the matching results as an unmodifiable list of instantiated objects using the default configuration .
132,421
public int count ( Class < ? > clazz , DynamoDBQueryExpression queryExpression , DynamoDBMapperConfig config ) { config = mergeConfig ( config ) ; QueryRequest queryRequest = createQueryRequestFromExpression ( clazz , queryExpression , config ) ; queryRequest . setCount ( true ) ; int count = 0 ; QueryResult queryResul...
Evaluates the specified query expression and returns the count of matching items without returning any of the actual item data .
132,422
private DynamoDBMapperConfig mergeConfig ( DynamoDBMapperConfig config ) { if ( config != this . config ) config = new DynamoDBMapperConfig ( this . config , config ) ; return config ; }
Merges the config object given with the one specified at construction and returns the result .
132,423
private Map < String , AttributeValueUpdate > transformAttributeUpdates ( Class < ? > clazz , Key objectKey , Map < String , AttributeValueUpdate > updateValues ) { Map < String , AttributeValue > item = convertToItem ( updateValues ) ; boolean hashKeyAdded = false ; boolean rangeKeyAdded = false ; String hashKey = ref...
A transformation expects to see all values including keys when determining the transformation therefore we must insert them if they are not already present . However we must remove the keys prior to actual storage as this method is called when updating DynamoDB which does not permit the modification of key attributes a...
132,424
public static void rebind ( Element e ) { EventsListener ret = getGQueryEventListener ( e ) ; if ( ret != null ) { DOM . setEventListener ( ( com . google . gwt . user . client . Element ) e , ret ) ; } }
We have to set the gQuery event listener to the element again when the element is a widget because when GWT detaches a widget it removes the event listener .
132,425
public boolean hasHandlers ( int eventBits , String eventName , Function handler ) { for ( int i = 0 , j = elementEvents . length ( ) ; i < j ; i ++ ) { BindFunction function = elementEvents . get ( i ) ; if ( ( function . hasEventType ( eventBits ) || function . isTypeOf ( eventName ) ) && ( handler == null || functio...
Return true if the element is listening for the given eventBit or eventName and the handler matches .
132,426
public void storeCookies ( URLConnection conn ) throws IOException { String domain = getDomainFromHost ( conn . getURL ( ) . getHost ( ) ) ; Map < String , Map < String , String > > domainStore ; if ( store . containsKey ( domain ) ) { domainStore = store . get ( domain ) ; } else { domainStore = new HashMap < > ( ) ; ...
Retrieves and stores cookies returned by the host on the other side of the the open java . net . URLConnection .
132,427
public void setCookies ( URLConnection conn ) throws IOException { URL url = conn . getURL ( ) ; String domain = getDomainFromHost ( url . getHost ( ) ) ; if ( domain . equals ( "localhost" ) ) { domain = "linkedin.com" ; } String path = url . getPath ( ) ; Map < String , Map < String , String > > domainStore = store ....
Prior to opening a URLConnection calling this method will set all unexpired cookies that match the path or subpaths for thi underlying URL
132,428
public static boolean matchesTags ( Element e , String ... tagNames ) { assert e != null : "Element cannot be null" ; StringBuilder regExp = new StringBuilder ( "^(" ) ; int tagNameLenght = tagNames != null ? tagNames . length : 0 ; for ( int i = 0 ; i < tagNameLenght ; i ++ ) { regExp . append ( tagNames [ i ] . toUpp...
Test if the tag name of the element is one of tag names given in parameter .
132,429
public static void attachWidget ( Widget widget , Widget firstParentWidget ) { if ( widget != null && widget . getParent ( ) == null ) { if ( firstParentWidget == null ) { firstParentWidget = getFirstParentWidget ( widget ) ; if ( firstParentWidget == null ) { RootPanel . detachOnWindowClose ( widget ) ; widgetOnAttach...
Attach a widget to the GWT widget list . Normally used when GQuery creates widgets wrapping existing dom elements . It does nothing if the widget is already attached to another widget .
132,430
public static Iterator < Widget > getChildren ( Widget w ) { if ( w instanceof Panel ) { return ( ( Panel ) w ) . iterator ( ) ; } if ( w instanceof Composite ) { return getChildren ( compositeGetWidget ( ( Composite ) w ) ) ; } return null ; }
Return children of the first widget s panel .
132,431
public final int pageX ( ) { if ( getTouches ( ) != null && getTouches ( ) . length ( ) > 0 ) { return getTouches ( ) . get ( 0 ) . getPageX ( ) ; } else { return getClientX ( ) + GQuery . document . getScrollLeft ( ) ; } }
The mouse position relative to the left edge of the document .
132,432
public final int pageY ( ) { if ( getTouches ( ) != null && getTouches ( ) . length ( ) > 0 ) { return getTouches ( ) . get ( 0 ) . getPageY ( ) ; } else { return getClientY ( ) + GQuery . document . getScrollTop ( ) ; } }
The mouse position relative to the top edge of the document .
132,433
public void setTableNames ( java . util . Collection < String > tableNames ) { if ( tableNames == null ) { this . tableNames = null ; return ; } java . util . List < String > tableNamesCopy = new java . util . ArrayList < String > ( tableNames . size ( ) ) ; tableNamesCopy . addAll ( tableNames ) ; this . tableNames = ...
Sets the value of the TableNames property for this object .
132,434
public Object getContext ( Class < ? > key ) { if ( key == null ) { throw new NullPointerException ( "key is null" ) ; } if ( context == null ) { return null ; } return context . get ( key ) ; }
Returns the context object associated with the given key . The ELContext maintains a collection of context objects relevant to the evaluation of an expression . These context objects are used by ELResolvers . This method is used to retrieve the context with the given key from the collection . By convention the object r...
132,435
public void putContext ( Class < ? > key , Object contextObject ) { if ( key == null ) { throw new NullPointerException ( "key is null" ) ; } if ( context == null ) { context = new HashMap < Class < ? > , Object > ( ) ; } context . put ( key , contextObject ) ; }
Associates a context object with this ELContext . The ELContext maintains a collection of context objects relevant to the evaluation of an expression . These context objects are used by ELResolvers . This method is used to add a context object to that collection . By convention the contextObject will be of the type spe...
132,436
public static void main ( String [ ] args ) throws SAXException , IOException { ELContext context = new SimpleContext ( ) ; context . getELResolver ( ) . setValue ( context , null , "home" , "/foo/bar" ) ; XMLReader reader = new XMELFilter ( XMLReaderFactory . createXMLReader ( ) , context ) ; reader . setContentHandle...
Usage example .
132,437
public < T > T convert ( Object value , Class < T > type ) { return converter . convert ( value , type ) ; }
Apply type conversion .
132,438
public static String getStorageDir ( DataSegment segment ) { return JOINER . join ( segment . getDataSource ( ) , String . format ( "%s_%s" , segment . getInterval ( ) . getStart ( ) , segment . getInterval ( ) . getEnd ( ) ) , segment . getVersion ( ) , segment . getShardSpec ( ) . getPartitionNum ( ) ) ; }
on segment deletion if segment being deleted was the only segment
132,439
void update ( JsonObject dp ) { for ( int i = 0 ; i < dp . names ( ) . size ( ) ; i ++ ) { datapoint . put ( dp . names ( ) . get ( i ) , dp . get ( dp . names ( ) . get ( i ) ) ) ; } }
Updates the data point data
132,440
public String [ ] getFieldsArray ( ) { Object [ ] obj = datapoint . keySet ( ) . toArray ( ) ; String [ ] out = new String [ obj . length ] ; for ( int i = 0 ; i < obj . length ; i ++ ) out [ i ] = String . valueOf ( obj [ i ] ) ; return out ; }
Returns a String array with all the Forecast . io fields available in this data point . It can be usefull to iterate over all available fields in a data point .
132,441
public String getByKey ( String key ) { String out = "" ; if ( key . equals ( "time" ) ) return time ( ) ; if ( key . contains ( "Time" ) ) { DateFormat dfm = new SimpleDateFormat ( "HH:mm:ss" ) ; dfm . setTimeZone ( TimeZone . getTimeZone ( timezone ) ) ; out = dfm . format ( Long . parseLong ( String . valueOf ( this...
Return the data point field with the corresponding key
132,442
public void setHTTPProxy ( String PROXYNAME , int PROXYPORT ) { if ( PROXYNAME == null ) { this . proxy_to_use = null ; } else { this . proxy_to_use = new Proxy ( Proxy . Type . HTTP , new InetSocketAddress ( PROXYNAME , PROXYPORT ) ) ; } }
Sets the http - proxy to use .
132,443
public boolean update ( ) { boolean b = getForecast ( String . valueOf ( getLatitude ( ) ) , String . valueOf ( getLongitude ( ) ) ) ; return b ; }
Does another query to the API and updates the data This only updates the data in ForecastIO class
132,444
public boolean getForecast ( String LATITUDE , String LONGITUDE ) { try { String reply = httpGET ( urlBuilder ( LATITUDE , LONGITUDE ) ) ; if ( reply == null ) return false ; this . forecast = Json . parse ( reply ) . asObject ( ) ; } catch ( NullPointerException e ) { System . err . println ( "Unable to connect to the...
Gets the forecast reports for the given coordinates with the set options
132,445
public boolean getForecast ( String http_response ) { this . forecast = Json . parse ( http_response ) . asObject ( ) ; return getForecast ( this . forecast ) ; }
Parses the forecast reports for the given coordinates with the set options Useful to use with an external http library
132,446
protected void listen ( ) { if ( ! connectedFlag . get ( ) || releaseNeeded . get ( ) ) { return ; } releaseNeeded . set ( true ) ; try { send ( pushListener , new OnFinishedHandler ( ) { public void onFinished ( ) { releaseNeeded . set ( false ) ; listen ( ) ; } } ) ; } catch ( Exception e ) { LOG . error ( "Error in ...
listens for the pushListener to return . The pushListener must be set and pushEnabled must be true .
132,447
protected void release ( ) { if ( ! releaseNeeded . get ( ) ) { return ; } releaseNeeded . set ( false ) ; backgroundExecutor . execute ( new Runnable ( ) { public void run ( ) { try { List < Command > releaseCommandList = new ArrayList < Command > ( Collections . singletonList ( releaseCommand ) ) ; transmit ( release...
Release the current push listener which blocks the sending queue . Does nothing in case that the push listener is not active .
132,448
public List < Command > receive ( final Command command ) { Assert . requireNonNull ( command , "command" ) ; LOG . trace ( "Received command of type {}" , command . getClass ( ) . getSimpleName ( ) ) ; List < Command > response = new LinkedList ( ) ; if ( ! ( command instanceof InterruptLongPollCommand ) ) { for ( Dol...
doesn t fail on missing commands
132,449
public static < S extends Styleable , V > DefaultPropertyBasedCssMetaData < S , V > createMetaData ( String property , StyleConverter < ? , V > converter , String propertyName , V defaultValue ) { return new DefaultPropertyBasedCssMetaData < S , V > ( property , converter , propertyName , defaultValue ) ; }
Creates a CssMetaData instance that can be used in a Styleable class .
132,450
public static < S extends Control , V > SkinPropertyBasedCssMetaData < S , V > createSkinMetaData ( String property , StyleConverter < ? , V > converter , String propertyName , V defaultValue ) { return new SkinPropertyBasedCssMetaData < S , V > ( property , converter , propertyName , defaultValue ) ; }
Creates a CssMetaData instance that can be used in the Skin of a Control .
132,451
public Subscription registerDolphinContext ( ClientSession session , GarbageCollector garbageCollector ) { Assert . requireNonNull ( session , "session" ) ; Assert . requireNonNull ( garbageCollector , "garbageCollector" ) ; DolphinSessionInfoMBean mBean = new DolphinSessionInfo ( session , garbageCollector ) ; return ...
Register a new dolphin session as a MBean
132,452
public Subscription registerController ( Class < ? > controllerClass , String controllerId , ModelProvider modelProvider ) { Assert . requireNonNull ( controllerClass , "controllerClass" ) ; Assert . requireNonBlank ( controllerId , "controllerId" ) ; Assert . requireNonNull ( modelProvider , "modelProvider" ) ; Dolphi...
Register a new Dolphin Platform controller as a MBean
132,453
public final void init ( ) throws Exception { FxToolkit . init ( ) ; applicationInit ( ) ; PlatformClient . getClientConfiguration ( ) . setUncaughtExceptionHandler ( ( Thread thread , Throwable exception ) -> { PlatformClient . getClientConfiguration ( ) . getUiExecutor ( ) . execute ( ( ) -> { Assert . requireNonNull...
Creates the connection to the Dolphin Platform server . If this method will be overridden always call the super method .
132,454
protected void onRuntimeError ( final Stage primaryStage , final DolphinRuntimeException runtimeException ) { Assert . requireNonNull ( runtimeException , "runtimeException" ) ; LOG . error ( "Dolphin Platform runtime error in thread " + runtimeException . getThread ( ) . getName ( ) , runtimeException ) ; Platform . e...
This method is called if the connection to the Dolphin Platform server throws an exception at runtime . This can for example happen if the server is shut down while the client is still running or if the server responses with an error code .
132,455
public boolean isReferencedByRoot ( ) { if ( rootBean ) { return true ; } for ( Reference reference : references ) { Instance parent = reference . getParent ( ) ; if ( parent . isReferencedByRoot ( ) ) { return true ; } } return false ; }
Return true if the dolphin bean instance is a root bean or is referenced by a root bean
132,456
public static < T , R > SwitchBuilder < T , R > switchBinding ( ObservableValue < T > observable , Class < R > bindingType ) { return new SwitchBuilder < > ( observable ) ; }
Creates builder for a binding that works like a switch - case in java .
132,457
public CompletableFuture < Void > destroy ( ) { CompletableFuture < Void > ret ; if ( controllerProxy != null ) { ret = controllerProxy . destroy ( ) ; controllerProxy = null ; } else { ret = new CompletableFuture < > ( ) ; ret . complete ( null ) ; } return ret ; }
By calling this method the MVC group will be destroyed . This means that the controller instance on the server will be removed and the model that is managed and synchronized between client and server will be detached . After this method is called the view should not be used anymore . It s important to call this method ...
132,458
protected CompletableFuture < Void > invoke ( String actionName , Param ... params ) { Assert . requireNonBlank ( actionName , "actionName" ) ; actionInProcess . set ( true ) ; return controllerProxy . invoke ( actionName , params ) . whenComplete ( ( v , e ) -> { try { if ( e != null ) { onInvocationException ( e ) ; ...
This invokes a action on the server side controller . For more information how an action can be defined in the controller have a look at the RemotingAction annotation in the server module . This method don t block and can be called from the Platform thread . To check if an server
132,459
public void silently ( final Runnable applyChange ) { boolean temp = notifyClient ; notifyClient = false ; try { applyChange . run ( ) ; } finally { notifyClient = temp ; } }
Do the applyChange without creating commands that are sent to the client
132,460
protected void verbosely ( final Runnable applyChange ) { boolean temp = notifyClient ; notifyClient = true ; try { applyChange . run ( ) ; } finally { notifyClient = temp ; } }
Do the applyChange with enforced creation of commands that are sent to the client
132,461
public static BooleanBinding and ( ObservableValue < Boolean > ... values ) { return Bindings . createBooleanBinding ( ( ) -> ! Arrays . stream ( values ) . filter ( observable -> ! observable . getValue ( ) ) . findAny ( ) . isPresent ( ) , values ) ; }
A boolean binding that is true only when all dependent observable boolean values are true .
132,462
public static NumberBinding sum ( final ObservableList < ? extends Number > numbers ) { return Bindings . createDoubleBinding ( ( ) -> numbers . stream ( ) . mapToDouble ( Number :: doubleValue ) . sum ( ) , numbers ) ; }
Creates a number binding that contains the sum of the numbers of the given observable list of numbers .
132,463
public static StringBinding join ( final ObservableList < ? > items , final ObservableValue < String > delimiter ) { return Bindings . createStringBinding ( ( ) -> items . stream ( ) . map ( String :: valueOf ) . collect ( Collectors . joining ( delimiter . getValue ( ) ) ) , items , delimiter ) ; }
Creates a string binding that constructs a sequence of characters separated by a delimiter .
132,464
public static < T > ObservableList < T > concat ( ObservableList < T > ... lists ) { ObservableList < T > result = FXCollections . observableArrayList ( ) ; for ( ObservableList < T > list : lists ) { list . addListener ( ( Observable observable ) -> { result . clear ( ) ; for ( ObservableList < T > ts : lists ) { resu...
Creates an observable list that represents the concatenated source lists . All elements from the all source lists will be contained in the new list . If there is a change in any of the source lists this change will also be done in the concatenated list .
132,465
public static BooleanBinding matches ( final ObservableValue < String > text , final String pattern ) { return Bindings . createBooleanBinding ( ( ) -> { final String textToVerify = text . getValue ( ) ; return textToVerify != null && textToVerify . matches ( pattern ) ; } , text ) ; }
Creates a boolean binding that is true when the given observable string matches the given RegExp pattern .
132,466
public static StringBinding transforming ( ObservableValue < String > text , Function < String , String > transformer ) { return Bindings . createStringBinding ( ( ) -> { Function < String , String > func = transformer == null ? Function . identity ( ) : transformer ; return text . getValue ( ) == null ? "" : func . ap...
Creates a string binding that contains the value of the given observable string transformed using the supplied function .
132,467
public boolean remove ( final ServerPresentationModel pm ) { boolean deleted = super . remove ( pm ) ; if ( ! deleted ) { throw new IllegalStateException ( "Model " + pm + " not found on the server!" ) ; } deleteCommand ( getCurrentResponse ( ) , pm . getId ( ) ) ; return deleted ; }
Convenience method to let Dolphin removePresentationModel a presentation model directly on the server and notify the client .
132,468
public static void deleteCommand ( final List < Command > response , final String pmId ) { if ( response == null || Assert . isBlank ( pmId ) ) { return ; } response . add ( new DeletePresentationModelCommand ( pmId ) ) ; }
Convenience method to let Dolphin delete a presentation model on the client side
132,469
public static void changeValueCommand ( final List < Command > response , final ServerAttribute attribute , final Object value ) { if ( response == null ) { return ; } if ( attribute == null ) { LOG . error ( "Cannot change value on a null attribute to '{}'" , value ) ; return ; } forceChangeValue ( value , response , ...
Convenience method to change an attribute value on the server side .
132,470
public ServerPresentationModel presentationModel ( final String id , final String presentationModelType , final DTO dto ) { List < ServerAttribute > attributes = new ArrayList < ServerAttribute > ( ) ; for ( final Slot slot : dto . getSlots ( ) ) { final ServerAttribute result = new ServerAttribute ( slot . getProperty...
Create a presentation model on the server side add it to the model store and withContent a command to the client advising him to do the same .
132,471
public Subscription register ( final Object mBean , final MBeanDescription description ) { Assert . requireNonNull ( description , "description" ) ; return register ( mBean , description . getMBeanName ( getNextId ( ) ) ) ; }
Register the given MBean based on the given description
132,472
public Subscription register ( final Object mBean , final String name ) { try { if ( mbeanSupport . get ( ) ) { final ObjectName objectName = new ObjectName ( name ) ; server . registerMBean ( mBean , objectName ) ; return new Subscription ( ) { public void unsubscribe ( ) { try { server . unregisterMBean ( objectName ...
Register the given MBean based on the given name
132,473
public void sync ( final Runnable runnable ) { clientConnector . send ( new EmptyCommand ( ) , new OnFinishedHandler ( ) { public void onFinished ( ) { runnable . run ( ) ; } } ) ; }
both java - and groovy - friendly convenience method to withContent an empty command which will have no presentation models nor data in the callback
132,474
public synchronized Set < Class < ? > > getTypesAnnotatedWith ( final Class < ? extends Annotation > annotation ) { Assert . requireNonNull ( annotation , "annotation" ) ; return reflections . getTypesAnnotatedWith ( annotation ) ; }
Returns a set that contains all classes in the classpath that are annotated with the given annotation
132,475
private int combineFlags ( final Pattern . Flag [ ] flags ) { int combined = 0 ; for ( Pattern . Flag f : flags ) { combined |= f . getValue ( ) ; } return combined ; }
Combines a given set of javax . validation . constraints . Pattern . Flag instances into one bitmask suitable for java . util . regex . Pattern consumption .
132,476
public static < S , R > ObjectBinding < R > map ( ObservableValue < S > source , Function < ? super S , ? extends R > function ) { return map ( source , function , null ) ; }
A Binding that holds a value that is determined by the given function applied to the value of the observable source .
132,477
public static < S , R > ObjectBinding < R > map ( ObservableValue < S > source , Function < ? super S , ? extends R > function , R defaultValue ) { return Bindings . createObjectBinding ( ( ) -> { S sourceValue = source . getValue ( ) ; if ( sourceValue == null ) { return defaultValue ; } else { return function . apply...
A null safe binding that holds the return value of the given function when applied to the value of the given observable .
132,478
public static < T , S extends T > ObjectBinding < T > cast ( final ObservableValue < S > source ) { return Bindings . createObjectBinding ( source :: getValue , source ) ; }
Creates a binding that contains the same value as the source observable but casted to a type that is higher in class hierarchy .
132,479
private static String createAnnotationCollectionId ( Collection < Annotation > annotations ) { if ( annotations . isEmpty ( ) ) return "" ; return annotations . stream ( ) . sorted ( comparing ( a -> a . annotationType ( ) . getName ( ) ) ) . map ( CdiSpiHelper :: createAnnotationId ) . collect ( joining ( "," , "[" , ...
Generates a unique signature for a collection of annotations .
132,480
public static Object getValue ( Object exp , Object root ) { return getValue ( exp , root , null , 0 ) ; }
Returns the value using the OGNL expression and the root object .
132,481
public static Object getValue ( Object exp , Map ctx , Object root ) { return getValue ( exp , ctx , root , null , 0 ) ; }
Returns the value using the OGNL expression the root object and a context map .
132,482
public static Object getValue ( Object exp , Map ctx , Object root , String path , int lineNumber ) { try { OgnlContext context = new OgnlContext ( null , null , new DefaultMemberAccess ( true ) ) ; return Ognl . getValue ( exp , context , root ) ; } catch ( OgnlException ex ) { throw new OgnlRuntimeException ( ex . ge...
Returns the value using the OGNL expression the root object a context mpa a path and a line number .
132,483
public static Object parseExpression ( String expression , String path , int lineNumber ) { try { return Ognl . parseExpression ( expression ) ; } catch ( Exception ex ) { throw new OgnlRuntimeException ( ex , path , lineNumber ) ; } }
Parses an OGNL expression .
132,484
public < T > T getSingleResult ( Class < T > clazz , String sql , Object [ ] params ) { PreparedStatement stmt = null ; ResultSet rs = null ; try { stmt = connectionProvider . getConnection ( ) . prepareStatement ( sql ) ; setParameters ( stmt , params ) ; if ( logger . isDebugEnabled ( ) ) { printSql ( sql ) ; printPa...
Returns a single entity from the first row of an SQL .
132,485
public int executeUpdateSql ( String sql , PropertyDesc [ ] propDescs , Object entity ) { PreparedStatement stmt = null ; ResultSet rs = null ; try { Connection conn = connectionProvider . getConnection ( ) ; if ( logger . isDebugEnabled ( ) ) { printSql ( sql ) ; printParameters ( propDescs ) ; } if ( entity != null &...
Executes an update SQL .
132,486
public int executeBatchUpdateSql ( String sql , List < PropertyDesc [ ] > propDescsList , Object [ ] entities ) { PreparedStatement stmt = null ; ResultSet rs = null ; try { Connection conn = connectionProvider . getConnection ( ) ; if ( logger . isDebugEnabled ( ) ) { printSql ( sql ) ; for ( int i = 0 ; i < propDescs...
Executes the update SQL .
132,487
@ SuppressWarnings ( "unchecked" ) protected void fillIdentityPrimaryKeys ( Object entity , ResultSet rs ) throws SQLException { BeanDesc beanDesc = beanDescFactory . getBeanDesc ( entity . getClass ( ) ) ; int size = beanDesc . getPropertyDescSize ( ) ; for ( int i = 0 ; i < size ; i ++ ) { PropertyDesc propertyDesc =...
Sets GenerationType . IDENTITY properties value .
132,488
public static String buildDeleteSql ( BeanDescFactory beanDescFactory , EntityOperator entityOperator , Class < ? > entityType , NameConverter nameConverter , List < PropertyDesc > propDescs ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "DELETE FROM " ) . append ( getTableName ( entityType , nameConverte...
Builds delete SQL and correct parameters from the entity .
132,489
private void fillPrimaryKeysBySequence ( Object entity ) { if ( ! dialect . supportsGenerationType ( GenerationType . SEQUENCE ) ) { return ; } BeanDesc beanDesc = beanDescFactory . getBeanDesc ( entity . getClass ( ) ) ; int size = beanDesc . getPropertyDescSize ( ) ; for ( int i = 0 ; i < size ; i ++ ) { PropertyDesc...
Sets GenerationType . SEQUENCE properties value .
132,490
public void setValueTypes ( List < ValueType < ? > > valueTypes ) { Validate . noNullElements ( valueTypes ) ; this . sqlExecutor . setValueTypes ( valueTypes ) ; this . callExecutor . setValueTypes ( valueTypes ) ; }
Sets the value types .
132,491
protected String getSql ( int version ) { Dialect dialect = ( ( SqlManagerImpl ) sqlManager ) . getDialect ( ) ; ClassLoader classLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; InputStream in = classLoader . getResourceAsStream ( String . format ( "%s/%s_%d.sql" , packageName , dialect . getName ( ) ...
Returns the SQL which located within a package specified by the packageName as dialectname_version . sql or version . sql .
132,492
protected boolean existsTable ( ) { try { int count = sqlManager . getSingleResult ( Integer . class , new StringSqlResource ( String . format ( "SELECT COUNT(*) FROM %s" , tableName ) ) ) ; if ( count == 0 ) { return false ; } return true ; } catch ( SQLRuntimeException ex ) { return false ; } }
Checks the table which manages a schema version exists or not exists .
132,493
protected void createTable ( ) { sqlManager . executeUpdate ( new StringSqlResource ( String . format ( "CREATE TABLE %s (VERSION NUMERIC NOT NULL)" , tableName ) ) ) ; sqlManager . executeUpdate ( new StringSqlResource ( String . format ( "INSERT INTO %s (0))" , tableName ) ) ) ; }
Creates table which manages schema version and insert an initial record as version 0 .
132,494
public synchronized static Session getSession ( ) { if ( session == null ) { Properties properties = IOUtil . loadProperties ( "jdbc.properties" ) ; session = getSession ( properties ) ; } return session ; }
Returns a session configured with the properties specified in the jdbc . properties file .
132,495
public static boolean isUncountable ( String word ) { for ( String w : UNCOUNTABLE ) { if ( w . equalsIgnoreCase ( word ) ) { return true ; } } return false ; }
Return true if the word is uncountable .
132,496
public static String singularize ( String word ) { if ( isUncountable ( word ) ) { return word ; } else { for ( Inflection inflection : SINGULAR ) { if ( inflection . match ( word ) ) { return inflection . replace ( word ) ; } } } return word ; }
Return the singularized version of a word .
132,497
public boolean match ( String word ) { int flags = 0 ; if ( ignoreCase ) { flags = flags | Pattern . CASE_INSENSITIVE ; } return Pattern . compile ( pattern , flags ) . matcher ( word ) . find ( ) ; }
Does the given word match?
132,498
public String replace ( String word ) { int flags = 0 ; if ( ignoreCase ) { flags = flags | Pattern . CASE_INSENSITIVE ; } return Pattern . compile ( pattern , flags ) . matcher ( word ) . replaceAll ( replacement ) ; }
Replace the word with its pattern .
132,499
public static Dialect getDialect ( String url ) { if ( url . startsWith ( "jdbc:mysql:" ) ) { return new MySQLDialect ( ) ; } else if ( url . startsWith ( "jdbc:postgresql:" ) ) { return new PostgreSQLDialect ( ) ; } else if ( url . startsWith ( "jdbc:oracle:" ) ) { return new OracleDialect ( ) ; } else if ( url . star...
Selects the Database Dialect based on the JDBC connection URL .