idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
152,700 | public ListSessionsResponse listSessions ( ListSessionsRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; InternalRequest internalRequest = createRequest ( HttpMethodName . GET , request , LIVE_SESSION ) ; if ( request . getStatus ( ) != null ) { checkStringNotEmpty ( request .... | List all your live sessions . |
152,701 | public ListAppResponse listApp ( ListAppRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; InternalRequest internalRequest = createRequest ( HttpMethodName . GET , request , LIVE_APP ) ; return invokeHttpClient ( internalRequest , ListAppResponse . class ) ; } | list all your apps |
152,702 | public ListAppStreamsResponse listAppStreams ( String app ) { ListAppStreamsRequest request = new ListAppStreamsRequest ( ) ; request . setApp ( app ) ; return listAppStreams ( request ) ; } | list your streams by app name |
152,703 | public StartRecordingResponse startRecording ( String sessionId , String recording ) { checkStringNotEmpty ( sessionId , "The parameter sessionId should NOT be null or empty string." ) ; checkStringNotEmpty ( recording , "The parameter recording should NOT be null or empty string." ) ; StartRecordingRequest request = n... | Start live session recording . |
152,704 | public StopRecordingResponse stopRecording ( String sessionId ) { checkStringNotEmpty ( sessionId , "The parameter sessionId should NOT be null or empty string." ) ; StopRecordingRequest request = new StopRecordingRequest ( ) . withSessionId ( sessionId ) ; InternalRequest internalRequest = createRequest ( HttpMethodNa... | Stop live session recording . |
152,705 | public GetSessionSourceInfoResponse getSessionSourceInfo ( String sessionId ) { checkStringNotEmpty ( sessionId , "The parameter sessionId should NOT be null or empty string." ) ; GetSessionSourceInfoRequest request = new GetSessionSourceInfoRequest ( ) ; InternalRequest internalRequest = createRequest ( HttpMethodName... | Get your live session source info by live session id . |
152,706 | public GetRecordingResponse getRecording ( String recording ) { checkStringNotEmpty ( recording , "The parameter recording should NOT be null or empty string." ) ; GetRecordingRequest request = new GetRecordingRequest ( ) ; InternalRequest internalRequest = createRequest ( HttpMethodName . GET , request , RECORDING , r... | Get your live recording preset by live recording preset name . |
152,707 | public ListRecordingsResponse listRecordings ( ) { GetRecordingRequest request = new GetRecordingRequest ( ) ; InternalRequest internalRequest = createRequest ( HttpMethodName . GET , request , RECORDING ) ; return invokeHttpClient ( internalRequest , ListRecordingsResponse . class ) ; } | List all your live recording presets . |
152,708 | public ListNotificationsResponse listNotifications ( ) { ListNotificationsRequest request = new ListNotificationsRequest ( ) ; InternalRequest internalRequest = createRequest ( HttpMethodName . GET , request , LIVE_NOTIFICATION ) ; return invokeHttpClient ( internalRequest , ListNotificationsResponse . class ) ; } | List all your live notifications . |
152,709 | public CreateNotificationResponse createNotification ( CreateNotificationRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; checkStringNotEmpty ( request . getName ( ) , "The parameter name should NOT be null or empty string." ) ; checkStringNotEmpty ( request . getEndpoint ( )... | Create a live notification in the live stream service . |
152,710 | public ListSecurityPoliciesResponse listSecurityPolicies ( ) { ListSecurityPoliciesRequest request = new ListSecurityPoliciesRequest ( ) ; InternalRequest internalRequest = createRequest ( HttpMethodName . GET , request , LIVE_SECURITY_POLICY ) ; return invokeHttpClient ( internalRequest , ListSecurityPoliciesResponse ... | List all your live security policys . |
152,711 | public ListDomainAppResponse listDomainApp ( ListDomainAppRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; checkStringNotEmpty ( request . getPlayDomain ( ) , "playDomain should NOT be empty." ) ; InternalRequest internalRequest = createRequest ( HttpMethodName . GET , reques... | List a domain s app in the live stream service . |
152,712 | public void updateStreamPresets ( UpdateStreamPresetsRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; checkStringNotEmpty ( request . getDomain ( ) , "Domain should NOT be empty." ) ; checkStringNotEmpty ( request . getApp ( ) , "App should NOT be empty" ) ; checkStringNotEmp... | Update stream s presets in the live stream service |
152,713 | public void updateStreamPresets ( String domain , String app , String stream , Map < String , String > presets ) { UpdateStreamPresetsRequest request = new UpdateStreamPresetsRequest ( ) . withDomain ( domain ) . withApp ( app ) . withStream ( stream ) . withPresets ( presets ) ; updateStreamPresets ( request ) ; } | Update stream s presets |
152,714 | public void updateStreamRecording ( UpdateStreamRecordingRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; checkStringNotEmpty ( request . getDomain ( ) , "Domain should NOT be empty." ) ; checkStringNotEmpty ( request . getApp ( ) , "App should NOT be empty" ) ; checkStringNo... | Update stream recording in the live stream service |
152,715 | public void updateStreamRecording ( String domain , String app , String stream , String recording ) { UpdateStreamRecordingRequest request = new UpdateStreamRecordingRequest ( ) . withDomain ( domain ) . withApp ( app ) . withStream ( stream ) . withRecording ( recording ) ; updateStreamRecording ( request ) ; } | Update stream recording in live stream service |
152,716 | public void updateStreamPullUrl ( UpdateStreamPullUrlRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; checkStringNotEmpty ( request . getDomain ( ) , "Domain should NOT be empty." ) ; checkStringNotEmpty ( request . getApp ( ) , "App should NOT be empty" ) ; checkStringNotEmp... | Update stream pullUrl in live stream service |
152,717 | public void updateStreamPullUrl ( String domain , String app , String stream , String pullUrl ) { UpdateStreamPullUrlRequest request = new UpdateStreamPullUrlRequest ( ) . withDomain ( domain ) . withApp ( app ) . withStream ( stream ) . withPullUrl ( pullUrl ) ; updateStreamPullUrl ( request ) ; } | Update stream s destination push url |
152,718 | public void updateStreamDestinationPushUrl ( UpdateStreamDestinationPushUrlRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; checkStringNotEmpty ( request . getDomain ( ) , "Domain should NOT be empty." ) ; checkStringNotEmpty ( request . getApp ( ) , "App should NOT be empty"... | Update stream destination push url in live stream service |
152,719 | public GetDomainStatisticsResponse getDomainStatistics ( GetDomainStatisticsRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; checkStringNotEmpty ( request . getDomain ( ) , "Domain should NOT be empty." ) ; InternalRequest internalRequest = createRequest ( HttpMethodName . GE... | get domain s statistics in the live stream service . |
152,720 | public GetDomainStatisticsResponse getDomainStatistics ( String domain ) { GetDomainStatisticsRequest request = new GetDomainStatisticsRequest ( ) ; request . setDomain ( domain ) ; return getDomainStatistics ( request ) ; } | Get domain s statistics in the live stream service . |
152,721 | public GetAllDomainsPlayCountResponse getAllDomainsPlayCount ( GetAllDomainsStatisticsRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; checkStringNotEmpty ( request . getTimeInterval ( ) , "timeInterval should NOT be null" ) ; checkStringNotEmpty ( request . getStartTime ( ) ... | get all domains total play count statistics in the live stream service . |
152,722 | public GetOneDomainPlayCountResponse getOneDomainPlayCount ( GetOneDomainStatisticsRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; checkNotNull ( request . getDomain ( ) , "The domain parameter can not be null" ) ; checkStringNotEmpty ( request . getTimeInterval ( ) , "timeI... | get one domain s play count statistics in the live stream service . |
152,723 | public ListDomainStatisticsResponse listDomainStatistics ( ListDomainStatisticsRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; checkStringNotEmpty ( request . getStartTime ( ) , "startTime should NOT be empty" ) ; InternalRequest internalRequest = createRequest ( HttpMethodN... | list domain s statistics in the live stream service . |
152,724 | public ListStreamStatisticsResponse listStreamStatistics ( ListStreamStatisticsRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; checkStringNotEmpty ( request . getDomain ( ) , "Domain should NOT be null" ) ; checkStringNotEmpty ( request . getApp ( ) , "App should NOT be null... | list domain s all streams statistics in the live stream service . |
152,725 | public GetStreamStatisticsResponse getStreamStatistics ( GetStreamStatisticsRequest request ) { checkNotNull ( request , "The parameter request should NOT be null." ) ; checkStringNotEmpty ( request . getDomain ( ) , "Domain should NOT be null" ) ; checkStringNotEmpty ( request . getApp ( ) , "App should NOT be null" )... | get a domain s all streams statistics in the live stream service . |
152,726 | public CreateVpcResponse createVpc ( String name , String cidr ) { CreateVpcRequest request = new CreateVpcRequest ( ) ; request . withName ( name ) . withCidr ( cidr ) ; return createVpc ( request ) ; } | Create a vpc with the specified options . |
152,727 | public ListVpcsResponse listVpcs ( ListVpcsRequest request ) { checkNotNull ( request , "request should not be null." ) ; InternalRequest internalRequest = this . createRequest ( request , HttpMethodName . GET , VPC_PREFIX ) ; if ( request . getMarker ( ) != null ) { internalRequest . addParameter ( "marker" , request ... | Return a list of vpcs owned by the authenticated user . |
152,728 | public GetVpcResponse getVpc ( GetVpcRequest getVpcRequest ) { checkNotNull ( getVpcRequest , "request should not be null." ) ; checkNotNull ( getVpcRequest . getVpcId ( ) , "request vpcId should not be null." ) ; InternalRequest internalRequest = this . createRequest ( getVpcRequest , HttpMethodName . GET , VPC_PREFIX... | Get the detail information of specified vpc . |
152,729 | public void modifyInstanceAttributes ( String name , String vpcId ) { ModifyVpcAttributesRequest request = new ModifyVpcAttributesRequest ( ) ; modifyInstanceAttributes ( request . withName ( name ) . withVpcId ( vpcId ) ) ; } | Modifying the special attribute to new value of the vpc owned by the user . |
152,730 | public GetClusterResponse getCluster ( GetClusterRequest request ) { checkNotNull ( request , "request should not be null." ) ; checkStringNotEmpty ( request . getClusterId ( ) , "The parameter clusterId should not be null or empty string." ) ; InternalRequest internalRequest = this . createRequest ( request , HttpMeth... | Describe the detail information of the target cluster . |
152,731 | public void modifyInstanceGroups ( ModifyInstanceGroupsRequest request ) { checkNotNull ( request , "request should not be null." ) ; checkStringNotEmpty ( request . getClusterId ( ) , "The clusterId should not be null or empty string." ) ; checkNotNull ( request . getInstanceGroups ( ) , "The instanceGroups should not... | Modify the instance groups of the target cluster . |
152,732 | public void terminateCluster ( TerminateClusterRequest request ) { checkNotNull ( request , "request should not be null." ) ; checkStringNotEmpty ( request . getClusterId ( ) , "The parameter clusterId should not be null or empty string." ) ; InternalRequest internalRequest = this . createRequest ( request , HttpMethod... | Terminate a BMR cluster and release all the virtual machine instances . |
152,733 | public ListInstanceGroupsResponse listInstanceGroups ( ListInstanceGroupsRequest request ) { checkNotNull ( request , "request should not be null." ) ; checkStringNotEmpty ( request . getClusterId ( ) , "The parameter clusterId should not be null or empty string." ) ; InternalRequest internalRequest = this . createRequ... | List the instance groups of the target BMR cluster . |
152,734 | public ListInstancesResponse listInstances ( ListInstancesRequest request ) { checkNotNull ( request , "request should not be null." ) ; checkStringNotEmpty ( request . getClusterId ( ) , "The parameter clusterId should not be null or empty string." ) ; checkStringNotEmpty ( request . getInstanceGroupId ( ) , "The para... | List the instances belonging to the target instance group in the BMR cluster . |
152,735 | public ListInstancesResponse listInstances ( String clusterId , String instanceGroupId ) { return listInstances ( new ListInstancesRequest ( ) . withClusterId ( clusterId ) . withInstanceGroupId ( instanceGroupId ) ) ; } | List the instances belonging to the target instance in the BMR cluster . |
152,736 | public AddStepsResponse addSteps ( AddStepsRequest request ) { checkNotNull ( request , "request should not be null." ) ; checkNotNull ( request . getSteps ( ) , "The parameter steps should not be null." ) ; checkStringNotEmpty ( request . getClusterId ( ) , "The parameter clusterId should not be null or empty string."... | Add steps to a BMR cluster . |
152,737 | public GetDocumentImagesResponse getDocumentImages ( String documentId ) { checkNotNull ( documentId , "documentId should not be null." ) ; GetDocumentImagesRequest request = new GetDocumentImagesRequest ( ) ; request . setDocumentId ( documentId ) ; InternalRequest internalRequest = this . createRequest ( HttpMethodNa... | get a Document Image list if Converted to image . Make Sure the Document convert type is image otherwise will throw BceServiceException |
152,738 | public ListDocumentsResponse listDocuments ( ) { ListDocumentsRequest request = new ListDocumentsRequest ( ) ; InternalRequest internalRequest = this . createRequest ( HttpMethodName . GET , request , DOC ) ; ListDocumentsResponse response ; try { response = this . invokeHttpClient ( internalRequest , ListDocumentsResp... | list all Document . |
152,739 | public GetDocumentDownloadResponse getDocumentDownload ( String documentId ) { checkNotNull ( documentId , "documentId should not be null." ) ; GetDocumentDownloadRequest request = new GetDocumentDownloadRequest ( ) ; request . setDocumentId ( documentId ) ; InternalRequest internalRequest = this . createRequest ( Http... | get a Document Download link . |
152,740 | public void setMode ( String mode ) { checkNotNull ( mode , "mode should not be null" ) ; if ( MODE_ASYNC . equals ( mode ) || MODE_SYNC . equals ( mode ) ) { this . mode = mode ; } else { throw new IllegalArgumentException ( "illegal mode: " + mode ) ; } } | Sets the mode of this fetching job . |
152,741 | public AddStepsRequest withStep ( StepConfig step ) { if ( this . steps == null ) { this . steps = new ArrayList < StepConfig > ( ) ; } this . steps . add ( step ) ; return this ; } | Configure the step to be added . |
152,742 | public static String generateHostHeader ( URI uri ) { String host = uri . getHost ( ) ; if ( isUsingNonDefaultPort ( uri ) ) { host += ":" + uri . getPort ( ) ; } return host ; } | Returns a host header according to the specified URI . The host header is generated with the same logic used by apache http client that is append the port to hostname only if it is not the default port . |
152,743 | public Key withAttribute ( String attributeName , AttributeValue value ) { if ( this . attributes == null ) { this . attributes = new HashMap < String , AttributeValue > ( ) ; } attributes . put ( attributeName , value ) ; return this ; } | The method set attribute name and attribute value with input parameters for a key . Returns a reference to this object so that method calls can be chained together . |
152,744 | private void initEngine ( ) { engine = ( NashornScriptEngine ) new ScriptEngineManager ( ) . getEngineByName ( "nashorn" ) ; try { engine . eval ( "(function(global){global.global = global})(this);" ) ; engine . eval ( NashornVueTemplateCompiler . NASHORN_VUE_TEMPLATE_COMPILER ) ; } catch ( ScriptException e ) { e . pr... | Init the Nashorn engine and load the Vue compiler in it . |
152,745 | public VueTemplateCompilerResult compile ( String htmlTemplate ) throws VueTemplateCompilerException { ScriptObjectMirror templateCompilerResult ; try { templateCompilerResult = ( ScriptObjectMirror ) engine . invokeFunction ( "compile" , htmlTemplate ) ; } catch ( ScriptException | NoSuchMethodException e ) { e . prin... | Compile the given HTML template to JS functions using vue - template - compiler . |
152,746 | public static boolean isMethodVisibleInTemplate ( ExecutableElement method ) { return isMethodVisibleInJS ( method ) && ! hasAnnotation ( method , Computed . class ) && ! hasAnnotation ( method , Watch . class ) && ! hasAnnotation ( method , PropValidator . class ) && ! hasAnnotation ( method , PropDefault . class ) &&... | Check if a given method is usable in the template |
152,747 | public static int getSuperComponentCount ( TypeElement component ) { return getSuperComponentType ( component ) . map ( superComponent -> getSuperComponentCount ( superComponent ) + 1 ) . orElse ( 0 ) ; } | Return the number of super component in the chain of parents |
152,748 | public static boolean hasTemplate ( ProcessingEnvironment processingEnvironment , TypeElement component ) { Component annotation = component . getAnnotation ( Component . class ) ; if ( annotation == null || ! annotation . hasTemplate ( ) ) { return false ; } if ( component . getModifiers ( ) . contains ( Modifier . AB... | Check if the given Component has a Template . It doesn t have a template if the class is abstract if it implements render function or if it has the flag hasTemplate to false on the component annotation . |
152,749 | private void compileTemplateString ( ComponentExposedTypeGenerator exposedTypeGenerator , TemplateParserResult templateParserResult ) { VueTemplateCompilerResult compilerResult ; try { VueTemplateCompiler vueTemplateCompiler = new VueTemplateCompiler ( ) ; compilerResult = vueTemplateCompiler . compile ( templateParser... | Compile the HTML template and transform it to a JS render function . |
152,750 | private void generateGetRenderFunction ( ComponentExposedTypeGenerator exposedTypeGenerator , VueTemplateCompilerResult result , TemplateParserResult templateParserResult ) { MethodSpec . Builder getRenderFunctionBuilder = MethodSpec . methodBuilder ( "getRenderFunction" ) . addModifiers ( Modifier . PRIVATE ) . return... | Generate the method that returns the body of the render function . |
152,751 | private void generateGetStaticRenderFunctions ( ComponentExposedTypeGenerator exposedTypeGenerator , VueTemplateCompilerResult result ) { CodeBlock . Builder staticFunctions = CodeBlock . builder ( ) ; boolean isFirst = true ; for ( String staticRenderFunction : result . getStaticRenderFunctions ( ) ) { if ( ! isFirst ... | Generate the method that returns the body of the static render functions . |
152,752 | private void processTemplateExpressions ( ComponentExposedTypeGenerator exposedTypeGenerator , TemplateParserResult templateParserResult ) { for ( TemplateExpression expression : templateParserResult . getExpressions ( ) ) { generateTemplateExpressionMethod ( exposedTypeGenerator , expression , templateParserResult . g... | Process the expressions found in the HTML template |
152,753 | private void generateTemplateExpressionMethod ( ComponentExposedTypeGenerator exposedTypeGenerator , TemplateExpression expression , String templateName ) { MethodSpec . Builder templateExpressionMethodBuilder = MethodSpec . methodBuilder ( expression . getId ( ) ) . addModifiers ( Modifier . PUBLIC ) . addAnnotation (... | Generate the Java method for an expression in the Template |
152,754 | public static String componentToTagName ( Element componentElement ) throws MissingComponentAnnotationException { Component componentAnnotation = componentElement . getAnnotation ( Component . class ) ; JsComponent jsComponentAnnotation = componentElement . getAnnotation ( JsComponent . class ) ; String annotationNameV... | Return the default name to register a component based on it s class name . The name of the tag is the name of the component converted to kebab - case . If the component class ends with Component this part is ignored . |
152,755 | public static String directiveToTagName ( String directiveClassName ) { directiveClassName = directiveClassName . replaceAll ( "Directive$" , "" ) ; return CaseFormat . UPPER_CAMEL . to ( CaseFormat . LOWER_HYPHEN , directiveClassName ) . toLowerCase ( ) ; } | Return the default name to register a directive based on it s class name The name of the tag is the name of the component converted to kebab - case If the component class ends with Directive this part is ignored |
152,756 | private void initLoopVariable ( String type , String name , TemplateParserContext context ) { this . loopVariableInfo = context . addLocalVariable ( context . getFullyQualifiedNameForClassName ( type . trim ( ) ) , name . trim ( ) ) ; } | Init the loop variable and add it to the parser context |
152,757 | private void initIndexVariable ( String name , TemplateParserContext context ) { this . indexVariableInfo = context . addLocalVariable ( "int" , name . trim ( ) ) ; } | Init the index variable and add it to the parser context |
152,758 | private void initKeyVariable ( String name , TemplateParserContext context ) { this . keyVariableInfo = context . addLocalVariable ( "String" , name . trim ( ) ) ; } | Init the key variable and add it to the parser context |
152,759 | public String toTemplateString ( ) { String [ ] parametersName = this . parameters . stream ( ) . map ( VariableInfo :: getName ) . toArray ( String [ ] :: new ) ; return this . getId ( ) + "(" + String . join ( ", " , parametersName ) + ")" ; } | Return this expression as a string that can be placed in the template as a replacement of the Java expression . |
152,760 | public TemplateParserResult parseHtmlTemplate ( String htmlTemplate , TemplateParserContext context , Elements elements , Messager messager , URI htmlTemplateUri ) { this . context = context ; this . elements = elements ; this . messager = messager ; this . logger = new TemplateParserLogger ( context , messager ) ; thi... | Parse a given HTML template and return the a result object containing the expressions and a transformed HTML . |
152,761 | private void processImports ( Source doc ) { doc . getAllElements ( ) . stream ( ) . filter ( element -> "vue-gwt:import" . equalsIgnoreCase ( element . getName ( ) ) ) . peek ( importElement -> { String classAttributeValue = importElement . getAttributeValue ( "class" ) ; if ( classAttributeValue != null ) { context .... | Add java imports in the template to the context . |
152,762 | private void processElement ( Element element ) { context . setCurrentSegment ( element ) ; currentProp = null ; currentAttribute = null ; boolean shouldPopContext = processElementAttributes ( element ) ; StreamSupport . stream ( ( ( Iterable < Segment > ) element :: getNodeIterator ) . spliterator ( ) , false ) . filt... | Recursive method that will process the whole template DOM tree . |
152,763 | private TypeMirror getTypeFromDOMElement ( Element element ) { return DOMElementsUtil . getTypeForElementTag ( element . getStartTag ( ) . getName ( ) ) . map ( Class :: getCanonicalName ) . map ( elements :: getTypeElement ) . map ( TypeElement :: asType ) . orElse ( null ) ; } | Find the corresponding TypeMirror from Elemental2 for a given DOM Element |
152,764 | private void registerMandatoryAttributes ( Attributes attributes ) { Map < String , String > attrs = context . getMandatoryAttributes ( ) ; if ( ! attrs . isEmpty ( ) ) { for ( Entry < String , String > i : attrs . entrySet ( ) ) { String v = i . getValue ( ) ; if ( v == null ) { outputDocument . insert ( attributes . ... | Register mandatory attributes for Scoped CSS |
152,765 | private TypeName getExpressionReturnTypeForAttribute ( Attribute attribute , Map < String , Class < ? > > propertiesTypes ) { String attributeName = attribute . getKey ( ) . toLowerCase ( ) ; if ( attributeName . indexOf ( "@" ) == 0 || attributeName . indexOf ( "v-on:" ) == 0 ) { return TypeName . VOID ; } if ( "v-if"... | Guess the type of the expression based on where it is used . The guessed type can be overridden by adding a Cast to the desired type at the beginning of the expression . |
152,766 | private String processVForValue ( String vForValue ) { VForDefinition vForDef = new VForDefinition ( vForValue , context , logger ) ; currentExpressionReturnType = vForDef . getInExpressionType ( ) ; String inExpression = this . processExpression ( vForDef . getInExpression ( ) ) ; return vForDef . getVariableDefinitio... | Process a v - for value . It will register the loop variables as a local variable in the context stack . |
152,767 | private String processSlotScopeValue ( String value ) { SlotScopeDefinition slotScopeDefinition = new SlotScopeDefinition ( value , context , logger ) ; return slotScopeDefinition . getSlotScopeVariableName ( ) ; } | Process a scoped - slot value . |
152,768 | private String processExpression ( String expressionString ) { expressionString = expressionString == null ? "" : expressionString . trim ( ) ; if ( expressionString . isEmpty ( ) ) { if ( isAttributeBinding ( currentAttribute ) ) { logger . error ( "Empty expression in template property binding. If you want to pass an... | Process a given template expression |
152,769 | private boolean shouldSkipExpressionProcessing ( String expressionString ) { return currentProp == null && ! String . class . getCanonicalName ( ) . equals ( currentExpressionReturnType . toString ( ) ) && isSimpleVueJsExpression ( expressionString ) ; } | In some cases we want to skip expression processing for optimization . This is when we are sure the expression is valid and there is no need to create a Java method for it . |
152,770 | private TemplateExpression processJavaExpression ( String expressionString ) { Expression expression ; try { expression = JavaParser . parseExpression ( expressionString ) ; } catch ( ParseProblemException parseException ) { logger . error ( "Couldn't parse Expression, make sure it is valid Java." , expressionString ) ... | Process the given string as a Java expression . |
152,771 | private void resolveTypesUsingImports ( Expression expression ) { if ( expression instanceof NodeWithType ) { NodeWithType < ? , ? > nodeWithType = ( ( NodeWithType < ? , ? > ) expression ) ; nodeWithType . setType ( getQualifiedName ( nodeWithType . getType ( ) ) ) ; } expression . getChildNodes ( ) . stream ( ) . fil... | Resolve all the types in the expression . This will replace the Class with the full qualified name using the template imports . |
152,772 | private void resolveStaticMethodsUsingImports ( Expression expression ) { if ( expression instanceof MethodCallExpr ) { MethodCallExpr methodCall = ( ( MethodCallExpr ) expression ) ; String methodName = methodCall . getName ( ) . getIdentifier ( ) ; if ( ! methodCall . getScope ( ) . isPresent ( ) && context . hasStat... | Resolve static method calls using static imports |
152,773 | private void checkMethodNames ( Expression expression ) { if ( expression instanceof MethodCallExpr ) { MethodCallExpr methodCall = ( ( MethodCallExpr ) expression ) ; if ( ! methodCall . getScope ( ) . isPresent ( ) ) { String methodName = methodCall . getName ( ) . getIdentifier ( ) ; if ( ! context . hasMethod ( met... | Check the expression for component method calls . This will check that the methods used in the template exist in the Component . It throws an exception if we use a method that is not declared in our Component . This will not check for the type or number of parameters we leave that to the Java Compiler . |
152,774 | private void createStaticGetMethod ( TypeElement component , ClassName vueFactoryClassName , Builder vueFactoryBuilder , List < CodeBlock > staticInitParameters ) { MethodSpec . Builder getBuilder = MethodSpec . methodBuilder ( "get" ) . addModifiers ( Modifier . STATIC , Modifier . PUBLIC ) . returns ( vueFactoryClass... | Create a static get method that can be used to retrieve an instance of our Factory . Factory retrieved using this method do NOT support injection . |
152,775 | public TemplateExpression addExpression ( String expression , TypeName expressionType , boolean shouldCast , List < VariableInfo > parameters ) { String id = "exp$" + this . expressions . size ( ) ; TemplateExpression templateExpression = new TemplateExpression ( id , expression . trim ( ) , expressionType , shouldCast... | Add an expression to the result . All the Java methods from the template will be added here so we can add them to our Vue . js component . |
152,776 | public void addRef ( String name , TypeMirror elementType , boolean isArray ) { refs . add ( new RefInfo ( name , elementType , isArray ) ) ; } | Register a ref found in the template |
152,777 | public static String escapeStringForJsRegexp ( String input ) { JsString string = uncheckedCast ( input ) ; return string . replace ( ESCAPE_JS_STRING_REGEXP , "\\$&" ) ; } | Escape a String to be used in a JsRegexp as a String literal |
152,778 | private void registerLocalDirectives ( Component annotation , MethodSpec . Builder initBuilder ) { try { Class < ? > [ ] componentsClass = annotation . directives ( ) ; if ( componentsClass . length > 0 ) { addGetDirectivesStatement ( initBuilder ) ; } Stream . of ( componentsClass ) . forEach ( clazz -> initBuilder . ... | Register directives passed to the annotation . |
152,779 | public final void initRenderFunctions ( Function renderFunctionString , Function [ ] staticRenderFnsStrings ) { this . setRender ( renderFunctionString ) ; this . setStaticRenderFns ( cast ( staticRenderFnsStrings ) ) ; } | Initialise the render functions from our template . |
152,780 | public final void initData ( boolean useFactory , Set < String > fieldNames ) { JsPropertyMap < Object > dataFields = JsPropertyMap . of ( ) ; dataFieldsToProxy = new HashSet < > ( ) ; for ( String fieldName : fieldNames ) { dataFields . set ( fieldName , null ) ; if ( fieldName . startsWith ( "$" ) || fieldName . star... | Initialise the data structure then set it to either a Factory or directly on the Component . |
152,781 | public final void addJavaComputed ( Function javaMethod , String computedPropertyName , ComputedKind kind ) { ComputedOptions computedDefinition = getComputedOptions ( computedPropertyName ) ; if ( computedDefinition == null ) { computedDefinition = new ComputedOptions ( ) ; addComputedOptions ( computedPropertyName , ... | Add a computed property to this ComponentOptions . If the computed has both a getter and a setter this will be called twice once for each . |
152,782 | public final void addJavaWatch ( Function javaMethod , String watchedPropertyName , boolean isDeep , boolean isImmediate ) { if ( ! isDeep && ! isImmediate ) { addWatch ( watchedPropertyName , javaMethod ) ; return ; } JsPropertyMap < Object > watchDefinition = JsPropertyMap . of ( ) ; watchDefinition . set ( "handler"... | Add a watch property to this Component Definition |
152,783 | public final void addJavaProp ( String propName , String fieldName , boolean required , String exposedTypeName ) { if ( propsToProxy == null ) { propsToProxy = new HashSet < > ( ) ; } PropOptions propDefinition = new PropOptions ( ) ; propDefinition . required = required ; if ( exposedTypeName != null ) { propDefinitio... | Add a prop to our ComponentOptions . This will allow to receive data from the outside of our Component . |
152,784 | private void findLocalComponentsForComponent ( LocalComponents localComponents , TypeElement componentTypeElement ) { Component componentAnnotation = componentTypeElement . getAnnotation ( Component . class ) ; if ( componentAnnotation == null ) { return ; } processLocalComponentClass ( localComponents , componentTypeE... | Register all locally declared components . |
152,785 | public void customizeVueObserverPrototype ( VueObserver vueObserver ) { vueObserveArrayFunction = vueObserver . getObserveArray ( ) ; vueWalkFunction = vueObserver . getWalk ( ) ; vueObserver . setWalk ( toObserve -> { if ( observeJavaObject ( toObserve ) ) { return ; } vueWalkFunction . call ( this , toObserve ) ; } )... | Customize the VueObserver instance . We get in between to be warned whenever an object is observed and observe it using our Java observers if necessary . |
152,786 | public static boolean hasInjectAnnotation ( Element element ) { for ( AnnotationMirror annotationMirror : element . getAnnotationMirrors ( ) ) { String annotationQualifiedName = annotationMirror . getAnnotationType ( ) . toString ( ) ; if ( annotationQualifiedName . equals ( Inject . class . getCanonicalName ( ) ) ) { ... | Check if the given element has an Inject annotation . Either the one from Google Gin or the javax one . We don t want to depend on Gin so we check the google one based on qualifiedName |
152,787 | public void generate ( TypeElement directiveTypeElement ) { ClassName optionsClassName = GeneratorsNameUtil . directiveOptionsName ( directiveTypeElement ) ; Builder componentClassBuilder = TypeSpec . classBuilder ( optionsClassName ) . addModifiers ( Modifier . PUBLIC , Modifier . FINAL ) . superclass ( VueDirectiveOp... | Generate and save the Java file for the typeElement passed to the constructor |
152,788 | private void exposeExposedFieldsToJs ( ) { if ( fieldsWithNameExposed . isEmpty ( ) ) { return ; } MethodSpec . Builder exposeFieldMethod = MethodSpec . methodBuilder ( "vg$ef" ) . addAnnotation ( JsMethod . class ) ; fieldsWithNameExposed . forEach ( field -> exposeFieldMethod . addStatement ( "this.$L = $T.v()" , fie... | Generate a method that use all the fields we want to determine the name of at runtime . This is to avoid GWT optimizing away assignation on those fields . |
152,789 | private void processComputed ( ) { getMethodsWithAnnotation ( component , Computed . class ) . forEach ( method -> { ComputedKind kind = ComputedKind . GETTER ; if ( "void" . equals ( method . getReturnType ( ) . toString ( ) ) ) { kind = ComputedKind . SETTER ; } String exposedMethodName = exposeExistingJavaMethodToJs... | Process computed properties from the Component Class . |
152,790 | private void addFieldsForComputedMethod ( TypeElement component , Set < String > alreadyDone ) { getMethodsWithAnnotation ( component , Computed . class ) . forEach ( method -> { String propertyName = computedPropertyNameToFieldName ( getComputedPropertyName ( method ) ) ; if ( alreadyDone . contains ( propertyName ) )... | Add fields for computed methods so they are visible in the template |
152,791 | private void processWatchers ( MethodSpec . Builder createdMethodBuilder ) { createdMethodBuilder . addStatement ( "Proto p = __proto__" ) ; getMethodsWithAnnotation ( component , Watch . class ) . forEach ( method -> processWatcher ( createdMethodBuilder , method ) ) ; } | Process watchers from the Component Class . |
152,792 | private void processWatcher ( MethodSpec . Builder createdMethodBuilder , ExecutableElement method ) { Watch watch = method . getAnnotation ( Watch . class ) ; String exposedMethodName = exposeExistingJavaMethodToJs ( method ) ; String watcherTriggerMethodName = addNewMethodToProto ( ) ; MethodSpec . Builder watcherMet... | Process a watcher from the Component Class . |
152,793 | private void processPropValidators ( ) { getMethodsWithAnnotation ( component , PropValidator . class ) . forEach ( method -> { PropValidator propValidator = method . getAnnotation ( PropValidator . class ) ; if ( ! TypeName . get ( method . getReturnType ( ) ) . equals ( TypeName . BOOLEAN ) ) { printError ( "Method "... | Process prop validators from the Component Class . |
152,794 | private void processPropDefaultValues ( ) { getMethodsWithAnnotation ( component , PropDefault . class ) . forEach ( method -> { PropDefault propValidator = method . getAnnotation ( PropDefault . class ) ; String exposedMethodName = exposeExistingJavaMethodToJs ( method ) ; String propertyName = propValidator . value (... | Process prop default values from the Component Class . |
152,795 | private void processHooks ( Set < ExecutableElement > hookMethodsFromInterfaces ) { ElementFilter . methodsIn ( component . getEnclosedElements ( ) ) . stream ( ) . filter ( method -> isHookMethod ( component , method , hookMethodsFromInterfaces ) ) . filter ( method -> ! "created" . equals ( method . getSimpleName ( )... | Process hook methods from the Component Class . |
152,796 | private Set < ExecutableElement > getHookMethodsFromInterfaces ( ) { return component . getInterfaces ( ) . stream ( ) . map ( DeclaredType . class :: cast ) . map ( DeclaredType :: asElement ) . map ( TypeElement . class :: cast ) . flatMap ( typeElement -> ElementFilter . methodsIn ( typeElement . getEnclosedElements... | Return all hook methods from the implemented interfaces |
152,797 | private void processRenderFunction ( ) { if ( ! hasInterface ( processingEnv , component . asType ( ) , HasRender . class ) ) { return ; } componentExposedTypeBuilder . addMethod ( MethodSpec . methodBuilder ( "vg$render" ) . addModifiers ( Modifier . PUBLIC ) . addAnnotation ( JsMethod . class ) . returns ( VNode . cl... | Process the render function from the Component Class if it has one . |
152,798 | private void createCreatedHook ( ComponentInjectedDependenciesBuilder dependenciesBuilder ) { String hasRunCreatedFlagName = "vg$hrc_" + getSuperComponentCount ( component ) ; componentExposedTypeBuilder . addField ( FieldSpec . builder ( boolean . class , hasRunCreatedFlagName , Modifier . PUBLIC ) . addAnnotation ( J... | Create the created hook method . This method will be called on each Component when it s created . It will inject dependencies if any . |
152,799 | private void initFieldsValues ( TypeElement component , MethodSpec . Builder createdMethodBuilder ) { if ( component . getModifiers ( ) . contains ( Modifier . ABSTRACT ) ) { return ; } createdMethodBuilder . addStatement ( "$T.initComponentInstanceFields(this, new $T())" , VueGWTTools . class , component ) ; } | Init fields at creation by using an instance of the Java class |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.