repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.listSessions
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.getStatus(), "The parameter status should NOT be empty string."); internalRequest.addParameter(STATUS, request.getStatus()); } return invokeHttpClient(internalRequest, ListSessionsResponse.class); }
java
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.getStatus(), "The parameter status should NOT be empty string."); internalRequest.addParameter(STATUS, request.getStatus()); } return invokeHttpClient(internalRequest, ListSessionsResponse.class); }
[ "public", "ListSessionsResponse", "listSessions", "(", "ListSessionsRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "InternalRequest", "internalRequest", "=", "createRequest", "(", "HttpMethodName"...
List all your live sessions. @param request The request object containing all parameters for listing live sessions. @return The list of all your live sessions.
[ "List", "all", "your", "live", "sessions", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L567-L576
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.listApp
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); }
java
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); }
[ "public", "ListAppResponse", "listApp", "(", "ListAppRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "InternalRequest", "internalRequest", "=", "createRequest", "(", "HttpMethodName", ".", "GET...
list all your apps @param request The request object containing all parameters for list all apps. @return the response
[ "list", "all", "your", "apps" ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L821-L825
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.listAppStreams
public ListAppStreamsResponse listAppStreams(String app) { ListAppStreamsRequest request = new ListAppStreamsRequest(); request.setApp(app); return listAppStreams(request); }
java
public ListAppStreamsResponse listAppStreams(String app) { ListAppStreamsRequest request = new ListAppStreamsRequest(); request.setApp(app); return listAppStreams(request); }
[ "public", "ListAppStreamsResponse", "listAppStreams", "(", "String", "app", ")", "{", "ListAppStreamsRequest", "request", "=", "new", "ListAppStreamsRequest", "(", ")", ";", "request", ".", "setApp", "(", "app", ")", ";", "return", "listAppStreams", "(", "request"...
list your streams by app name @param app app name @return the response
[ "list", "your", "streams", "by", "app", "name" ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L877-L881
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.startRecording
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 = new StartRecordingRequest().withSessionId(sessionId); InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_SESSION, sessionId); internalRequest.addParameter(RECORDING, recording); return invokeHttpClient(internalRequest, StartRecordingResponse.class); }
java
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 = new StartRecordingRequest().withSessionId(sessionId); InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_SESSION, sessionId); internalRequest.addParameter(RECORDING, recording); return invokeHttpClient(internalRequest, StartRecordingResponse.class); }
[ "public", "StartRecordingResponse", "startRecording", "(", "String", "sessionId", ",", "String", "recording", ")", "{", "checkStringNotEmpty", "(", "sessionId", ",", "\"The parameter sessionId should NOT be null or empty string.\"", ")", ";", "checkStringNotEmpty", "(", "reco...
Start live session recording. @param sessionId Live session id. @param recording Live recording preset name. @return the response
[ "Start", "live", "session", "recording", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1047-L1054
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.stopRecording
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(HttpMethodName.PUT, request, LIVE_SESSION, sessionId); internalRequest.addParameter(RECORDING, null); return invokeHttpClient(internalRequest, StopRecordingResponse.class); }
java
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(HttpMethodName.PUT, request, LIVE_SESSION, sessionId); internalRequest.addParameter(RECORDING, null); return invokeHttpClient(internalRequest, StopRecordingResponse.class); }
[ "public", "StopRecordingResponse", "stopRecording", "(", "String", "sessionId", ")", "{", "checkStringNotEmpty", "(", "sessionId", ",", "\"The parameter sessionId should NOT be null or empty string.\"", ")", ";", "StopRecordingRequest", "request", "=", "new", "StopRecordingRequ...
Stop live session recording. @param sessionId Live session id. @return the response
[ "Stop", "live", "session", "recording", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1062-L1068
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.getSessionSourceInfo
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, request, LIVE_SESSION, sessionId); internalRequest.addParameter(SOURCE_INFO, null); return invokeHttpClient(internalRequest, GetSessionSourceInfoResponse.class); }
java
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, request, LIVE_SESSION, sessionId); internalRequest.addParameter(SOURCE_INFO, null); return invokeHttpClient(internalRequest, GetSessionSourceInfoResponse.class); }
[ "public", "GetSessionSourceInfoResponse", "getSessionSourceInfo", "(", "String", "sessionId", ")", "{", "checkStringNotEmpty", "(", "sessionId", ",", "\"The parameter sessionId should NOT be null or empty string.\"", ")", ";", "GetSessionSourceInfoRequest", "request", "=", "new",...
Get your live session source info by live session id. @param sessionId Live session id. @return Your live session source info
[ "Get", "your", "live", "session", "source", "info", "by", "live", "session", "id", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1076-L1082
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.getRecording
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, recording); return invokeHttpClient(internalRequest, GetRecordingResponse.class); }
java
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, recording); return invokeHttpClient(internalRequest, GetRecordingResponse.class); }
[ "public", "GetRecordingResponse", "getRecording", "(", "String", "recording", ")", "{", "checkStringNotEmpty", "(", "recording", ",", "\"The parameter recording should NOT be null or empty string.\"", ")", ";", "GetRecordingRequest", "request", "=", "new", "GetRecordingRequest"...
Get your live recording preset by live recording preset name. @param recording Live recording preset name. @return Your live recording preset
[ "Get", "your", "live", "recording", "preset", "by", "live", "recording", "preset", "name", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1125-L1130
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.listRecordings
public ListRecordingsResponse listRecordings() { GetRecordingRequest request = new GetRecordingRequest(); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, RECORDING); return invokeHttpClient(internalRequest, ListRecordingsResponse.class); }
java
public ListRecordingsResponse listRecordings() { GetRecordingRequest request = new GetRecordingRequest(); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, RECORDING); return invokeHttpClient(internalRequest, ListRecordingsResponse.class); }
[ "public", "ListRecordingsResponse", "listRecordings", "(", ")", "{", "GetRecordingRequest", "request", "=", "new", "GetRecordingRequest", "(", ")", ";", "InternalRequest", "internalRequest", "=", "createRequest", "(", "HttpMethodName", ".", "GET", ",", "request", ",",...
List all your live recording presets. @return The list of all your live recording preset.
[ "List", "all", "your", "live", "recording", "presets", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1137-L1141
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.listNotifications
public ListNotificationsResponse listNotifications() { ListNotificationsRequest request = new ListNotificationsRequest(); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_NOTIFICATION); return invokeHttpClient(internalRequest, ListNotificationsResponse.class); }
java
public ListNotificationsResponse listNotifications() { ListNotificationsRequest request = new ListNotificationsRequest(); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_NOTIFICATION); return invokeHttpClient(internalRequest, ListNotificationsResponse.class); }
[ "public", "ListNotificationsResponse", "listNotifications", "(", ")", "{", "ListNotificationsRequest", "request", "=", "new", "ListNotificationsRequest", "(", ")", ";", "InternalRequest", "internalRequest", "=", "createRequest", "(", "HttpMethodName", ".", "GET", ",", "...
List all your live notifications. @return The list of all your live notifications
[ "List", "all", "your", "live", "notifications", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1149-L1153
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.createNotification
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(), "The parameter endpoint should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, LIVE_NOTIFICATION); return invokeHttpClient(internalRequest, CreateNotificationResponse.class); }
java
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(), "The parameter endpoint should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, LIVE_NOTIFICATION); return invokeHttpClient(internalRequest, CreateNotificationResponse.class); }
[ "public", "CreateNotificationResponse", "createNotification", "(", "CreateNotificationRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getName", "(", "...
Create a live notification in the live stream service. @param request The request object containing all options for creating live notification. @return the response
[ "Create", "a", "live", "notification", "in", "the", "live", "stream", "service", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1226-L1236
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.listSecurityPolicies
public ListSecurityPoliciesResponse listSecurityPolicies() { ListSecurityPoliciesRequest request = new ListSecurityPoliciesRequest(); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_SECURITY_POLICY); return invokeHttpClient(internalRequest, ListSecurityPoliciesResponse.class); }
java
public ListSecurityPoliciesResponse listSecurityPolicies() { ListSecurityPoliciesRequest request = new ListSecurityPoliciesRequest(); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_SECURITY_POLICY); return invokeHttpClient(internalRequest, ListSecurityPoliciesResponse.class); }
[ "public", "ListSecurityPoliciesResponse", "listSecurityPolicies", "(", ")", "{", "ListSecurityPoliciesRequest", "request", "=", "new", "ListSecurityPoliciesRequest", "(", ")", ";", "InternalRequest", "internalRequest", "=", "createRequest", "(", "HttpMethodName", ".", "GET"...
List all your live security policys. @return The list of all your live security policys
[ "List", "all", "your", "live", "security", "policys", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1243-L1247
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.listDomainApp
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, request, LIVE_DOMAIN, request.getPlayDomain(), LIVE_APP); return invokeHttpClient(internalRequest, ListDomainAppResponse.class); }
java
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, request, LIVE_DOMAIN, request.getPlayDomain(), LIVE_APP); return invokeHttpClient(internalRequest, ListDomainAppResponse.class); }
[ "public", "ListDomainAppResponse", "listDomainApp", "(", "ListDomainAppRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getPlayDomain", "(", ")", ","...
List a domain's app in the live stream service. @param request The request object containing all options for listing domain's app @return the response
[ "List", "a", "domain", "s", "app", "in", "the", "live", "stream", "service", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1435-L1443
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.updateStreamPresets
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"); checkStringNotEmpty(request.getStream(), "Stream should NOT be empty."); // presets can be null for letting stream to use domain's presets, // so no need to check if presets is null InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, LIVE_DOMAIN, request.getDomain(), LIVE_APP, request.getApp(), LIVE_STREAM, request.getStream()); internalRequest.addParameter("presets", null); invokeHttpClient(internalRequest, AbstractBceResponse.class); }
java
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"); checkStringNotEmpty(request.getStream(), "Stream should NOT be empty."); // presets can be null for letting stream to use domain's presets, // so no need to check if presets is null InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, LIVE_DOMAIN, request.getDomain(), LIVE_APP, request.getApp(), LIVE_STREAM, request.getStream()); internalRequest.addParameter("presets", null); invokeHttpClient(internalRequest, AbstractBceResponse.class); }
[ "public", "void", "updateStreamPresets", "(", "UpdateStreamPresetsRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getDomain", "(", ")", ",", "\"Do...
Update stream's presets in the live stream service @param request THe request object containing all options for updating presets
[ "Update", "stream", "s", "presets", "in", "the", "live", "stream", "service" ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1600-L1613
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.updateStreamPresets
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); }
java
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); }
[ "public", "void", "updateStreamPresets", "(", "String", "domain", ",", "String", "app", ",", "String", "stream", ",", "Map", "<", "String", ",", "String", ">", "presets", ")", "{", "UpdateStreamPresetsRequest", "request", "=", "new", "UpdateStreamPresetsRequest", ...
Update stream's presets @param domain The requested domain which the specific stream belongs to @param app The requested app which the specific stream belongs to @param stream The requested stream which need to update the presets @param presets The new presets is setting to the specific stream; it's a map, and key is line number, and value is preset name
[ "Update", "stream", "s", "presets" ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1624-L1631
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.updateStreamRecording
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"); checkStringNotEmpty(request.getStream(), "Stream should NOT be empty."); // recording can be null for letting stream to use domain's recording, // so no need to check if recording is null InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_DOMAIN, request.getDomain(), LIVE_APP, request.getApp(), LIVE_STREAM, request.getStream()); internalRequest.addParameter("recording", request.getRecording()); invokeHttpClient(internalRequest, AbstractBceResponse.class); }
java
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"); checkStringNotEmpty(request.getStream(), "Stream should NOT be empty."); // recording can be null for letting stream to use domain's recording, // so no need to check if recording is null InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_DOMAIN, request.getDomain(), LIVE_APP, request.getApp(), LIVE_STREAM, request.getStream()); internalRequest.addParameter("recording", request.getRecording()); invokeHttpClient(internalRequest, AbstractBceResponse.class); }
[ "public", "void", "updateStreamRecording", "(", "UpdateStreamRecordingRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getDomain", "(", ")", ",", "...
Update stream recording in the live stream service @param request The request object containing all options for updating recording
[ "Update", "stream", "recording", "in", "the", "live", "stream", "service" ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1639-L1653
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.updateStreamRecording
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); }
java
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); }
[ "public", "void", "updateStreamRecording", "(", "String", "domain", ",", "String", "app", ",", "String", "stream", ",", "String", "recording", ")", "{", "UpdateStreamRecordingRequest", "request", "=", "new", "UpdateStreamRecordingRequest", "(", ")", ".", "withDomain...
Update stream recording in live stream service @param domain The requested domain which the specific stream belongs to @param app The requested app which the specific stream belongs to @param stream The requested stream which need to update the recording @param recording The new recording's name
[ "Update", "stream", "recording", "in", "live", "stream", "service" ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1664-L1671
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.updateStreamPullUrl
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"); checkStringNotEmpty(request.getStream(), "Stream should NOT be empty."); checkStringNotEmpty(request.getPullUrl(), "PullUrl should NOT be empty."); InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_DOMAIN, request.getDomain(), LIVE_APP, request.getApp(), LIVE_STREAM, request.getStream()); internalRequest.addParameter("pullUrl", request.getPullUrl()); invokeHttpClient(internalRequest, AbstractBceResponse.class); }
java
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"); checkStringNotEmpty(request.getStream(), "Stream should NOT be empty."); checkStringNotEmpty(request.getPullUrl(), "PullUrl should NOT be empty."); InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_DOMAIN, request.getDomain(), LIVE_APP, request.getApp(), LIVE_STREAM, request.getStream()); internalRequest.addParameter("pullUrl", request.getPullUrl()); invokeHttpClient(internalRequest, AbstractBceResponse.class); }
[ "public", "void", "updateStreamPullUrl", "(", "UpdateStreamPullUrlRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getDomain", "(", ")", ",", "\"Do...
Update stream pullUrl in live stream service @param request The request object containing all options for updating pull url
[ "Update", "stream", "pullUrl", "in", "live", "stream", "service" ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1713-L1725
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.updateStreamPullUrl
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); }
java
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); }
[ "public", "void", "updateStreamPullUrl", "(", "String", "domain", ",", "String", "app", ",", "String", "stream", ",", "String", "pullUrl", ")", "{", "UpdateStreamPullUrlRequest", "request", "=", "new", "UpdateStreamPullUrlRequest", "(", ")", ".", "withDomain", "("...
Update stream's destination push url @param domain The requested domain which the specific stream belongs to @param app The requested app which the specific stream belongs to @param stream The requested stream which need to update pull url @param pullUrl The new pull url is setting to this specific stream
[ "Update", "stream", "s", "destination", "push", "url" ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1735-L1742
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.updateStreamDestinationPushUrl
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"); checkStringNotEmpty(request.getStream(), "Stream should NOT be empty."); InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_DOMAIN, request.getDomain(), LIVE_APP, request.getApp(), LIVE_STREAM, request.getStream()); internalRequest.addParameter("destinationPushUrl", request.getDestinationPushUrl()); invokeHttpClient(internalRequest, AbstractBceResponse.class); }
java
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"); checkStringNotEmpty(request.getStream(), "Stream should NOT be empty."); InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_DOMAIN, request.getDomain(), LIVE_APP, request.getApp(), LIVE_STREAM, request.getStream()); internalRequest.addParameter("destinationPushUrl", request.getDestinationPushUrl()); invokeHttpClient(internalRequest, AbstractBceResponse.class); }
[ "public", "void", "updateStreamDestinationPushUrl", "(", "UpdateStreamDestinationPushUrlRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getDomain", "(",...
Update stream destination push url in live stream service @param request The request object containing all options for updating destination push url
[ "Update", "stream", "destination", "push", "url", "in", "live", "stream", "service" ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1748-L1759
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.getDomainStatistics
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.GET, request, STATISTICS, LIVE_DOMAIN, request.getDomain()); if (request.getStartDate() != null) { internalRequest.addParameter("startDate", request.getStartDate()); } if (request.getEndDate() != null) { internalRequest.addParameter("endDate", request.getEndDate()); } if (request.getAggregate() != null) { internalRequest.addParameter("aggregate", request.getAggregate().toString()); } return invokeHttpClient(internalRequest, GetDomainStatisticsResponse.class); }
java
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.GET, request, STATISTICS, LIVE_DOMAIN, request.getDomain()); if (request.getStartDate() != null) { internalRequest.addParameter("startDate", request.getStartDate()); } if (request.getEndDate() != null) { internalRequest.addParameter("endDate", request.getEndDate()); } if (request.getAggregate() != null) { internalRequest.addParameter("aggregate", request.getAggregate().toString()); } return invokeHttpClient(internalRequest, GetDomainStatisticsResponse.class); }
[ "public", "GetDomainStatisticsResponse", "getDomainStatistics", "(", "GetDomainStatisticsRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getDomain", "("...
get domain's statistics in the live stream service. @param request The request object containing all options for getting domain's statistics @return the response
[ "get", "domain", "s", "statistics", "in", "the", "live", "stream", "service", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1783-L1799
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.getDomainStatistics
public GetDomainStatisticsResponse getDomainStatistics(String domain) { GetDomainStatisticsRequest request = new GetDomainStatisticsRequest(); request.setDomain(domain); return getDomainStatistics(request); }
java
public GetDomainStatisticsResponse getDomainStatistics(String domain) { GetDomainStatisticsRequest request = new GetDomainStatisticsRequest(); request.setDomain(domain); return getDomainStatistics(request); }
[ "public", "GetDomainStatisticsResponse", "getDomainStatistics", "(", "String", "domain", ")", "{", "GetDomainStatisticsRequest", "request", "=", "new", "GetDomainStatisticsRequest", "(", ")", ";", "request", ".", "setDomain", "(", "domain", ")", ";", "return", "getDom...
Get domain's statistics in the live stream service. @param domain The requested domain @return the response
[ "Get", "domain", "s", "statistics", "in", "the", "live", "stream", "service", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1807-L1811
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.getAllDomainsPlayCount
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(), "startTime should NOT be null"); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, STATISTICS, LIVE_DOMAIN, "playcount"); internalRequest.addParameter("timeInterval", request.getTimeInterval()); internalRequest.addParameter("startTime", request.getStartTime()); if (request.getEndTime() != null) { internalRequest.addParameter("endTime", request.getEndTime()); } return invokeHttpClient(internalRequest, GetAllDomainsPlayCountResponse.class); }
java
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(), "startTime should NOT be null"); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, STATISTICS, LIVE_DOMAIN, "playcount"); internalRequest.addParameter("timeInterval", request.getTimeInterval()); internalRequest.addParameter("startTime", request.getStartTime()); if (request.getEndTime() != null) { internalRequest.addParameter("endTime", request.getEndTime()); } return invokeHttpClient(internalRequest, GetAllDomainsPlayCountResponse.class); }
[ "public", "GetAllDomainsPlayCountResponse", "getAllDomainsPlayCount", "(", "GetAllDomainsStatisticsRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getTime...
get all domains' total play count statistics in the live stream service. @param request The request object containing all options for getting all domains' play count statistics @return the response
[ "get", "all", "domains", "total", "play", "count", "statistics", "in", "the", "live", "stream", "service", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1853-L1867
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.getOneDomainPlayCount
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(), "timeInterval should NOT be null"); checkStringNotEmpty(request.getStartTime(), "startTime should NOT be null"); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, STATISTICS, LIVE_DOMAIN, request.getDomain(), "playcount"); internalRequest.addParameter("timeInterval", request.getTimeInterval()); internalRequest.addParameter("startTime", request.getStartTime()); if (request.getEndTime() != null) { internalRequest.addParameter("endTime", request.getEndTime()); } return invokeHttpClient(internalRequest, GetOneDomainPlayCountResponse.class); }
java
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(), "timeInterval should NOT be null"); checkStringNotEmpty(request.getStartTime(), "startTime should NOT be null"); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, STATISTICS, LIVE_DOMAIN, request.getDomain(), "playcount"); internalRequest.addParameter("timeInterval", request.getTimeInterval()); internalRequest.addParameter("startTime", request.getStartTime()); if (request.getEndTime() != null) { internalRequest.addParameter("endTime", request.getEndTime()); } return invokeHttpClient(internalRequest, GetOneDomainPlayCountResponse.class); }
[ "public", "GetOneDomainPlayCountResponse", "getOneDomainPlayCount", "(", "GetOneDomainStatisticsRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkNotNull", "(", "request", ".", "getDomain", "("...
get one domain's play count statistics in the live stream service. @param request The request object containing all options for getting one domain's play count statistics @return the response
[ "get", "one", "domain", "s", "play", "count", "statistics", "in", "the", "live", "stream", "service", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1875-L1891
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.listDomainStatistics
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(HttpMethodName.GET, request, STATISTICS, LIVE_DOMAIN, "list"); internalRequest.addParameter("startTime", request.getStartTime()); if (request.getEndTime() != null) { internalRequest.addParameter("endTime", request.getEndTime()); } if (request.getKeyword() != null) { internalRequest.addParameter("keyword", request.getKeyword()); } if (request.getKeywordType() != null) { internalRequest.addParameter("keywordType", request.getKeywordType()); } if (request.getOrderBy() != null) { internalRequest.addParameter("orderBy", request.getOrderBy()); } return invokeHttpClient(internalRequest, ListDomainStatisticsResponse.class); }
java
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(HttpMethodName.GET, request, STATISTICS, LIVE_DOMAIN, "list"); internalRequest.addParameter("startTime", request.getStartTime()); if (request.getEndTime() != null) { internalRequest.addParameter("endTime", request.getEndTime()); } if (request.getKeyword() != null) { internalRequest.addParameter("keyword", request.getKeyword()); } if (request.getKeywordType() != null) { internalRequest.addParameter("keywordType", request.getKeywordType()); } if (request.getOrderBy() != null) { internalRequest.addParameter("orderBy", request.getOrderBy()); } return invokeHttpClient(internalRequest, ListDomainStatisticsResponse.class); }
[ "public", "ListDomainStatisticsResponse", "listDomainStatistics", "(", "ListDomainStatisticsRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getStartTime",...
list domain's statistics in the live stream service. @param request The request object containing all options for listing domain's traffic statistics @return the response
[ "list", "domain", "s", "statistics", "in", "the", "live", "stream", "service", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1989-L2010
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.listStreamStatistics
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"); checkStringNotEmpty(request.getStartTime(), "StartTime should NOT be null"); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, STATISTICS, LIVE_DOMAIN, request.getDomain(), LIVE_STREAM); internalRequest.addParameter("app", request.getApp()); internalRequest.addParameter("startTime", request.getStartTime()); if (request.getEndTime() != null) { internalRequest.addParameter("endTime", request.getEndTime()); } if (request.getKeyword() != null) { internalRequest.addParameter("keyword", request.getKeyword()); } if (request.getKeywordType() != null) { internalRequest.addParameter("keywordType", request.getKeywordType()); } if (request.getOrderBy() != null) { internalRequest.addParameter("orderBy", request.getOrderBy()); } if (request.getPageNo() != null) { internalRequest.addParameter("pageNo", request.getPageNo().toString()); } if (request.getPageSize() != null) { internalRequest.addParameter("pageSize", request.getPageSize().toString()); } return invokeHttpClient(internalRequest, ListStreamStatisticsResponse.class); }
java
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"); checkStringNotEmpty(request.getStartTime(), "StartTime should NOT be null"); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, STATISTICS, LIVE_DOMAIN, request.getDomain(), LIVE_STREAM); internalRequest.addParameter("app", request.getApp()); internalRequest.addParameter("startTime", request.getStartTime()); if (request.getEndTime() != null) { internalRequest.addParameter("endTime", request.getEndTime()); } if (request.getKeyword() != null) { internalRequest.addParameter("keyword", request.getKeyword()); } if (request.getKeywordType() != null) { internalRequest.addParameter("keywordType", request.getKeywordType()); } if (request.getOrderBy() != null) { internalRequest.addParameter("orderBy", request.getOrderBy()); } if (request.getPageNo() != null) { internalRequest.addParameter("pageNo", request.getPageNo().toString()); } if (request.getPageSize() != null) { internalRequest.addParameter("pageSize", request.getPageSize().toString()); } return invokeHttpClient(internalRequest, ListStreamStatisticsResponse.class); }
[ "public", "ListStreamStatisticsResponse", "listStreamStatistics", "(", "ListStreamStatisticsRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getDomain", ...
list domain's all streams statistics in the live stream service. @param request The request object containing all options for listing domain's all streams traffic statistics @return the response
[ "list", "domain", "s", "all", "streams", "statistics", "in", "the", "live", "stream", "service", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L2018-L2049
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.getStreamStatistics
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"); checkStringNotEmpty(request.getStream(), "Stream should NOT be null"); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, STATISTICS, LIVE_DOMAIN, request.getDomain(), LIVE_APP, request.getApp(), LIVE_STREAM, request.getStream()); if (request.getStartDate() != null) { internalRequest.addParameter("startDate", request.getStartDate()); } if (request.getEndDate() != null) { internalRequest.addParameter("endDate", request.getEndDate()); } if (request.getAggregate() != null) { internalRequest.addParameter("aggregate", request.getAggregate().toString()); } return invokeHttpClient(internalRequest, GetStreamStatisticsResponse.class); }
java
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"); checkStringNotEmpty(request.getStream(), "Stream should NOT be null"); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, STATISTICS, LIVE_DOMAIN, request.getDomain(), LIVE_APP, request.getApp(), LIVE_STREAM, request.getStream()); if (request.getStartDate() != null) { internalRequest.addParameter("startDate", request.getStartDate()); } if (request.getEndDate() != null) { internalRequest.addParameter("endDate", request.getEndDate()); } if (request.getAggregate() != null) { internalRequest.addParameter("aggregate", request.getAggregate().toString()); } return invokeHttpClient(internalRequest, GetStreamStatisticsResponse.class); }
[ "public", "GetStreamStatisticsResponse", "getStreamStatistics", "(", "GetStreamStatisticsRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getDomain", "("...
get a domain's all streams statistics in the live stream service. @param request The request object containing all options for getting a domain's all streams @return the response
[ "get", "a", "domain", "s", "all", "streams", "statistics", "in", "the", "live", "stream", "service", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L2057-L2077
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/vpc/VpcClient.java
VpcClient.createVpc
public CreateVpcResponse createVpc(String name, String cidr) { CreateVpcRequest request = new CreateVpcRequest(); request.withName(name).withCidr(cidr); return createVpc(request); }
java
public CreateVpcResponse createVpc(String name, String cidr) { CreateVpcRequest request = new CreateVpcRequest(); request.withName(name).withCidr(cidr); return createVpc(request); }
[ "public", "CreateVpcResponse", "createVpc", "(", "String", "name", ",", "String", "cidr", ")", "{", "CreateVpcRequest", "request", "=", "new", "CreateVpcRequest", "(", ")", ";", "request", ".", "withName", "(", "name", ")", ".", "withCidr", "(", "cidr", ")",...
Create a vpc with the specified options. @param name The name of vpc @param cidr The CIDR of vpc @return List of vpcId newly created
[ "Create", "a", "vpc", "with", "the", "specified", "options", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vpc/VpcClient.java#L156-L160
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/vpc/VpcClient.java
VpcClient.listVpcs
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.getMarker()); } if (request.getMaxKeys() > 0) { internalRequest.addParameter("maxKeys", String.valueOf(request.getMaxKeys())); } if (request.getIsDefault() != null) { internalRequest.addParameter("isDefault", request.getIsDefault().toString()); } return invokeHttpClient(internalRequest, ListVpcsResponse.class); }
java
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.getMarker()); } if (request.getMaxKeys() > 0) { internalRequest.addParameter("maxKeys", String.valueOf(request.getMaxKeys())); } if (request.getIsDefault() != null) { internalRequest.addParameter("isDefault", request.getIsDefault().toString()); } return invokeHttpClient(internalRequest, ListVpcsResponse.class); }
[ "public", "ListVpcsResponse", "listVpcs", "(", "ListVpcsRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"request should not be null.\"", ")", ";", "InternalRequest", "internalRequest", "=", "this", ".", "createRequest", "(", "request", ",", "Http...
Return a list of vpcs owned by the authenticated user. @param request The request containing all options for listing own's vpc. @return The response containing a list of vpcs owned by the authenticated user.
[ "Return", "a", "list", "of", "vpcs", "owned", "by", "the", "authenticated", "user", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vpc/VpcClient.java#L200-L213
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/vpc/VpcClient.java
VpcClient.getVpc
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, getVpcRequest.getVpcId()); return this.invokeHttpClient(internalRequest, GetVpcResponse.class); }
java
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, getVpcRequest.getVpcId()); return this.invokeHttpClient(internalRequest, GetVpcResponse.class); }
[ "public", "GetVpcResponse", "getVpc", "(", "GetVpcRequest", "getVpcRequest", ")", "{", "checkNotNull", "(", "getVpcRequest", ",", "\"request should not be null.\"", ")", ";", "checkNotNull", "(", "getVpcRequest", ".", "getVpcId", "(", ")", ",", "\"request vpcId should n...
Get the detail information of specified vpc. @param getVpcRequest The request containing all options for getting the vpc info. @return A vpc detail model for the vpcId.
[ "Get", "the", "detail", "information", "of", "specified", "vpc", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vpc/VpcClient.java#L231-L237
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/vpc/VpcClient.java
VpcClient.modifyInstanceAttributes
public void modifyInstanceAttributes(String name, String vpcId) { ModifyVpcAttributesRequest request = new ModifyVpcAttributesRequest(); modifyInstanceAttributes(request.withName(name).withVpcId(vpcId)); }
java
public void modifyInstanceAttributes(String name, String vpcId) { ModifyVpcAttributesRequest request = new ModifyVpcAttributesRequest(); modifyInstanceAttributes(request.withName(name).withVpcId(vpcId)); }
[ "public", "void", "modifyInstanceAttributes", "(", "String", "name", ",", "String", "vpcId", ")", "{", "ModifyVpcAttributesRequest", "request", "=", "new", "ModifyVpcAttributesRequest", "(", ")", ";", "modifyInstanceAttributes", "(", "request", ".", "withName", "(", ...
Modifying the special attribute to new value of the vpc owned by the user. @param name The name of the vpc after modifying @param vpcId the id of the vpc
[ "Modifying", "the", "special", "attribute", "to", "new", "value", "of", "the", "vpc", "owned", "by", "the", "user", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vpc/VpcClient.java#L274-L277
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bmr/BmrClient.java
BmrClient.getCluster
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, HttpMethodName.GET, CLUSTER, request.getClusterId()); return this.invokeHttpClient(internalRequest, GetClusterResponse.class); }
java
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, HttpMethodName.GET, CLUSTER, request.getClusterId()); return this.invokeHttpClient(internalRequest, GetClusterResponse.class); }
[ "public", "GetClusterResponse", "getCluster", "(", "GetClusterRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"request should not be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getClusterId", "(", ")", ",", "\"The parameter clu...
Describe the detail information of the target cluster. @param request The request object containing the ID of the target cluster. @return response containing the detail information of the target cluster.
[ "Describe", "the", "detail", "information", "of", "the", "target", "cluster", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bmr/BmrClient.java#L167-L175
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bmr/BmrClient.java
BmrClient.modifyInstanceGroups
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 be null."); StringWriter writer = new StringWriter(); try { JsonGenerator jsonGenerator = JsonUtils.jsonGeneratorOf(writer); jsonGenerator.writeStartObject(); jsonGenerator.writeArrayFieldStart("instanceGroups"); for (ModifyInstanceGroupConfig instanceGroup : request.getInstanceGroups()) { checkStringNotEmpty(instanceGroup.getId(), "The instanceGroupId should not be null or empty string."); jsonGenerator.writeStartObject(); jsonGenerator.writeStringField("id", instanceGroup.getId()); jsonGenerator.writeNumberField("instanceCount", instanceGroup.getInstanceCount()); jsonGenerator.writeEndObject(); } jsonGenerator.writeEndArray(); jsonGenerator.writeEndObject(); jsonGenerator.close(); } catch (IOException e) { throw new BceClientException("Fail to generate json", e); } byte[] json = null; try { json = writer.toString().getBytes(DEFAULT_ENCODING); } catch (UnsupportedEncodingException e) { throw new BceClientException("Fail to get UTF-8 bytes", e); } InternalRequest internalRequest = this.createRequest(request, HttpMethodName.PUT, CLUSTER, request.getClusterId(), INSTANCE_GROUP); internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(json.length)); internalRequest.addHeader(Headers.CONTENT_TYPE, "application/json"); internalRequest.setContent(RestartableInputStream.wrap(json)); if (request.getClientToken() != null) { internalRequest.addParameter("clientToken", request.getClientToken()); } this.invokeHttpClient(internalRequest, AbstractBceResponse.class); }
java
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 be null."); StringWriter writer = new StringWriter(); try { JsonGenerator jsonGenerator = JsonUtils.jsonGeneratorOf(writer); jsonGenerator.writeStartObject(); jsonGenerator.writeArrayFieldStart("instanceGroups"); for (ModifyInstanceGroupConfig instanceGroup : request.getInstanceGroups()) { checkStringNotEmpty(instanceGroup.getId(), "The instanceGroupId should not be null or empty string."); jsonGenerator.writeStartObject(); jsonGenerator.writeStringField("id", instanceGroup.getId()); jsonGenerator.writeNumberField("instanceCount", instanceGroup.getInstanceCount()); jsonGenerator.writeEndObject(); } jsonGenerator.writeEndArray(); jsonGenerator.writeEndObject(); jsonGenerator.close(); } catch (IOException e) { throw new BceClientException("Fail to generate json", e); } byte[] json = null; try { json = writer.toString().getBytes(DEFAULT_ENCODING); } catch (UnsupportedEncodingException e) { throw new BceClientException("Fail to get UTF-8 bytes", e); } InternalRequest internalRequest = this.createRequest(request, HttpMethodName.PUT, CLUSTER, request.getClusterId(), INSTANCE_GROUP); internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(json.length)); internalRequest.addHeader(Headers.CONTENT_TYPE, "application/json"); internalRequest.setContent(RestartableInputStream.wrap(json)); if (request.getClientToken() != null) { internalRequest.addParameter("clientToken", request.getClientToken()); } this.invokeHttpClient(internalRequest, AbstractBceResponse.class); }
[ "public", "void", "modifyInstanceGroups", "(", "ModifyInstanceGroupsRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"request should not be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getClusterId", "(", ")", ",", "\"The cluster...
Modify the instance groups of the target cluster. @param request The request containing the ID of BMR cluster and the instance groups to be modified.
[ "Modify", "the", "instance", "groups", "of", "the", "target", "cluster", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bmr/BmrClient.java#L292-L332
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bmr/BmrClient.java
BmrClient.terminateCluster
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, HttpMethodName.DELETE, CLUSTER, request.getClusterId()); this.invokeHttpClient(internalRequest, AbstractBceResponse.class); }
java
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, HttpMethodName.DELETE, CLUSTER, request.getClusterId()); this.invokeHttpClient(internalRequest, AbstractBceResponse.class); }
[ "public", "void", "terminateCluster", "(", "TerminateClusterRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"request should not be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getClusterId", "(", ")", ",", "\"The parameter clust...
Terminate a BMR cluster and release all the virtual machine instances. @param request The request containing the ID of the cluster to be terminated.
[ "Terminate", "a", "BMR", "cluster", "and", "release", "all", "the", "virtual", "machine", "instances", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bmr/BmrClient.java#L339-L347
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bmr/BmrClient.java
BmrClient.listInstanceGroups
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.createRequest( request, HttpMethodName.GET, CLUSTER, request.getClusterId(), INSTANCE_GROUP); return this.invokeHttpClient(internalRequest, ListInstanceGroupsResponse.class); }
java
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.createRequest( request, HttpMethodName.GET, CLUSTER, request.getClusterId(), INSTANCE_GROUP); return this.invokeHttpClient(internalRequest, ListInstanceGroupsResponse.class); }
[ "public", "ListInstanceGroupsResponse", "listInstanceGroups", "(", "ListInstanceGroupsRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"request should not be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getClusterId", "(", ")", ","...
List the instance groups of the target BMR cluster. @param request containing the ID of target BMR cluster. @return The response containing a list of InstanceGroup objects.
[ "List", "the", "instance", "groups", "of", "the", "target", "BMR", "cluster", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bmr/BmrClient.java#L364-L372
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bmr/BmrClient.java
BmrClient.listInstances
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 parameter instanceGroupId should not be null or empty string."); InternalRequest internalRequest = this.createRequest( request, HttpMethodName.GET, CLUSTER, request.getClusterId(), INSTANCE_GROUP, request.getInstanceGroupId(), INSTANCE); return this.invokeHttpClient(internalRequest, ListInstancesResponse.class); }
java
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 parameter instanceGroupId should not be null or empty string."); InternalRequest internalRequest = this.createRequest( request, HttpMethodName.GET, CLUSTER, request.getClusterId(), INSTANCE_GROUP, request.getInstanceGroupId(), INSTANCE); return this.invokeHttpClient(internalRequest, ListInstancesResponse.class); }
[ "public", "ListInstancesResponse", "listInstances", "(", "ListInstancesRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"request should not be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getClusterId", "(", ")", ",", "\"The para...
List the instances belonging to the target instance group in the BMR cluster. @param request containing the ID of target BMR cluster and the ID of the instance group. @return The response containing a list of Instance objects.
[ "List", "the", "instances", "belonging", "to", "the", "target", "instance", "group", "in", "the", "BMR", "cluster", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bmr/BmrClient.java#L390-L401
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bmr/BmrClient.java
BmrClient.listInstances
public ListInstancesResponse listInstances(String clusterId, String instanceGroupId) { return listInstances(new ListInstancesRequest().withClusterId(clusterId).withInstanceGroupId(instanceGroupId)); }
java
public ListInstancesResponse listInstances(String clusterId, String instanceGroupId) { return listInstances(new ListInstancesRequest().withClusterId(clusterId).withInstanceGroupId(instanceGroupId)); }
[ "public", "ListInstancesResponse", "listInstances", "(", "String", "clusterId", ",", "String", "instanceGroupId", ")", "{", "return", "listInstances", "(", "new", "ListInstancesRequest", "(", ")", ".", "withClusterId", "(", "clusterId", ")", ".", "withInstanceGroupId"...
List the instances belonging to the target instance in the BMR cluster. @param clusterId the ID of target BMR cluster. @param instanceGroupId the ID of target instance group. @return The response containing a list of Instance objects.
[ "List", "the", "instances", "belonging", "to", "the", "target", "instance", "in", "the", "BMR", "cluster", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bmr/BmrClient.java#L410-L412
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bmr/BmrClient.java
BmrClient.addSteps
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."); StringWriter writer = new StringWriter(); List<StepConfig> steps = request.getSteps(); try { JsonGenerator jsonGenerator = JsonUtils.jsonGeneratorOf(writer); jsonGenerator.writeStartObject(); jsonGenerator.writeArrayFieldStart("steps"); for (StepConfig step : steps) { jsonGenerator.writeStartObject(); if (step.getName() != null) { jsonGenerator.writeStringField("name", step.getName()); } jsonGenerator.writeStringField("type", step.getType()); jsonGenerator.writeStringField("actionOnFailure", step.getActionOnFailure()); jsonGenerator.writeObjectFieldStart("properties"); for (String propertyKey : step.getProperties().keySet()) { jsonGenerator.writeObjectField(propertyKey, step.getProperties().get(propertyKey)); } jsonGenerator.writeEndObject(); jsonGenerator.writeArrayFieldStart("additionalFiles"); for (AdditionalFile additionalFile : step.getAdditionalFiles()) { jsonGenerator.writeStartObject(); jsonGenerator.writeStringField("remote", additionalFile.getRemote()); jsonGenerator.writeStringField("local", additionalFile.getLocal()); jsonGenerator.writeEndObject(); } jsonGenerator.writeEndArray(); jsonGenerator.writeEndObject(); } jsonGenerator.writeEndArray(); jsonGenerator.writeEndObject(); jsonGenerator.close(); } catch (IOException e) { throw new BceClientException("Fail to generate json", e); } byte[] json = null; try { json = writer.toString().getBytes(DEFAULT_ENCODING); } catch (UnsupportedEncodingException e) { throw new BceClientException("Fail to get UTF-8 bytes", e); } InternalRequest internalRequest = this.createRequest( request, HttpMethodName.POST, CLUSTER, request.getClusterId(), STEP); internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(json.length)); internalRequest.addHeader(Headers.CONTENT_TYPE, "application/json"); internalRequest.setContent(RestartableInputStream.wrap(json)); if (request.getClientToken() != null) { internalRequest.addParameter("clientToken", request.getClientToken()); } return this.invokeHttpClient(internalRequest, AddStepsResponse.class); }
java
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."); StringWriter writer = new StringWriter(); List<StepConfig> steps = request.getSteps(); try { JsonGenerator jsonGenerator = JsonUtils.jsonGeneratorOf(writer); jsonGenerator.writeStartObject(); jsonGenerator.writeArrayFieldStart("steps"); for (StepConfig step : steps) { jsonGenerator.writeStartObject(); if (step.getName() != null) { jsonGenerator.writeStringField("name", step.getName()); } jsonGenerator.writeStringField("type", step.getType()); jsonGenerator.writeStringField("actionOnFailure", step.getActionOnFailure()); jsonGenerator.writeObjectFieldStart("properties"); for (String propertyKey : step.getProperties().keySet()) { jsonGenerator.writeObjectField(propertyKey, step.getProperties().get(propertyKey)); } jsonGenerator.writeEndObject(); jsonGenerator.writeArrayFieldStart("additionalFiles"); for (AdditionalFile additionalFile : step.getAdditionalFiles()) { jsonGenerator.writeStartObject(); jsonGenerator.writeStringField("remote", additionalFile.getRemote()); jsonGenerator.writeStringField("local", additionalFile.getLocal()); jsonGenerator.writeEndObject(); } jsonGenerator.writeEndArray(); jsonGenerator.writeEndObject(); } jsonGenerator.writeEndArray(); jsonGenerator.writeEndObject(); jsonGenerator.close(); } catch (IOException e) { throw new BceClientException("Fail to generate json", e); } byte[] json = null; try { json = writer.toString().getBytes(DEFAULT_ENCODING); } catch (UnsupportedEncodingException e) { throw new BceClientException("Fail to get UTF-8 bytes", e); } InternalRequest internalRequest = this.createRequest( request, HttpMethodName.POST, CLUSTER, request.getClusterId(), STEP); internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(json.length)); internalRequest.addHeader(Headers.CONTENT_TYPE, "application/json"); internalRequest.setContent(RestartableInputStream.wrap(json)); if (request.getClientToken() != null) { internalRequest.addParameter("clientToken", request.getClientToken()); } return this.invokeHttpClient(internalRequest, AddStepsResponse.class); }
[ "public", "AddStepsResponse", "addSteps", "(", "AddStepsRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"request should not be null.\"", ")", ";", "checkNotNull", "(", "request", ".", "getSteps", "(", ")", ",", "\"The parameter steps should not be ...
Add steps to a BMR cluster. @param request containing the ID of target BMR cluster and several steps to be added. @return The response containing a list of IDs of newly added steps.
[ "Add", "steps", "to", "a", "BMR", "cluster", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bmr/BmrClient.java#L419-L478
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/doc/DocClient.java
DocClient.getDocumentImages
public GetDocumentImagesResponse getDocumentImages(String documentId) { checkNotNull(documentId, "documentId should not be null."); GetDocumentImagesRequest request = new GetDocumentImagesRequest(); request.setDocumentId(documentId); InternalRequest internalRequest = this.createRequest(HttpMethodName.GET, request, DOC, request.getDocumentId()); internalRequest.addParameter("getImages", null); GetDocumentImagesResponse response; try { response = this.invokeHttpClient(internalRequest, GetDocumentImagesResponse.class); } finally { try { internalRequest.getContent().close(); } catch (Exception e) { // ignore exception } } return response; }
java
public GetDocumentImagesResponse getDocumentImages(String documentId) { checkNotNull(documentId, "documentId should not be null."); GetDocumentImagesRequest request = new GetDocumentImagesRequest(); request.setDocumentId(documentId); InternalRequest internalRequest = this.createRequest(HttpMethodName.GET, request, DOC, request.getDocumentId()); internalRequest.addParameter("getImages", null); GetDocumentImagesResponse response; try { response = this.invokeHttpClient(internalRequest, GetDocumentImagesResponse.class); } finally { try { internalRequest.getContent().close(); } catch (Exception e) { // ignore exception } } return response; }
[ "public", "GetDocumentImagesResponse", "getDocumentImages", "(", "String", "documentId", ")", "{", "checkNotNull", "(", "documentId", ",", "\"documentId should not be null.\"", ")", ";", "GetDocumentImagesRequest", "request", "=", "new", "GetDocumentImagesRequest", "(", ")"...
get a Document Image list if Converted to image. Make Sure the Document convert type is image, otherwise will throw BceServiceException @param documentId the documentId need to get. @return A GetDocumentImageResponse object containing the information returned by Document.
[ "get", "a", "Document", "Image", "list", "if", "Converted", "to", "image", ".", "Make", "Sure", "the", "Document", "convert", "type", "is", "image", "otherwise", "will", "throw", "BceServiceException" ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/doc/DocClient.java#L517-L535
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/doc/DocClient.java
DocClient.listDocuments
public ListDocumentsResponse listDocuments() { ListDocumentsRequest request = new ListDocumentsRequest(); InternalRequest internalRequest = this.createRequest(HttpMethodName.GET, request, DOC); ListDocumentsResponse response; try { response = this.invokeHttpClient(internalRequest, ListDocumentsResponse.class); } finally { try { internalRequest.getContent().close(); } catch (Exception e) { // ignore exception } } return response; }
java
public ListDocumentsResponse listDocuments() { ListDocumentsRequest request = new ListDocumentsRequest(); InternalRequest internalRequest = this.createRequest(HttpMethodName.GET, request, DOC); ListDocumentsResponse response; try { response = this.invokeHttpClient(internalRequest, ListDocumentsResponse.class); } finally { try { internalRequest.getContent().close(); } catch (Exception e) { // ignore exception } } return response; }
[ "public", "ListDocumentsResponse", "listDocuments", "(", ")", "{", "ListDocumentsRequest", "request", "=", "new", "ListDocumentsRequest", "(", ")", ";", "InternalRequest", "internalRequest", "=", "this", ".", "createRequest", "(", "HttpMethodName", ".", "GET", ",", ...
list all Document. @return A ListDocumentsResponse object containing the information returned by Document.
[ "list", "all", "Document", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/doc/DocClient.java#L544-L559
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/doc/DocClient.java
DocClient.getDocumentDownload
public GetDocumentDownloadResponse getDocumentDownload(String documentId) { checkNotNull(documentId, "documentId should not be null."); GetDocumentDownloadRequest request = new GetDocumentDownloadRequest(); request.setDocumentId(documentId); InternalRequest internalRequest = this.createRequest(HttpMethodName.GET, request, DOC, request.getDocumentId()); internalRequest.addParameter("download", null); GetDocumentDownloadResponse response; try { response = this.invokeHttpClient(internalRequest, GetDocumentDownloadResponse.class); } finally { try { internalRequest.getContent().close(); } catch (Exception e) { // ignore exception } } return response; }
java
public GetDocumentDownloadResponse getDocumentDownload(String documentId) { checkNotNull(documentId, "documentId should not be null."); GetDocumentDownloadRequest request = new GetDocumentDownloadRequest(); request.setDocumentId(documentId); InternalRequest internalRequest = this.createRequest(HttpMethodName.GET, request, DOC, request.getDocumentId()); internalRequest.addParameter("download", null); GetDocumentDownloadResponse response; try { response = this.invokeHttpClient(internalRequest, GetDocumentDownloadResponse.class); } finally { try { internalRequest.getContent().close(); } catch (Exception e) { // ignore exception } } return response; }
[ "public", "GetDocumentDownloadResponse", "getDocumentDownload", "(", "String", "documentId", ")", "{", "checkNotNull", "(", "documentId", ",", "\"documentId should not be null.\"", ")", ";", "GetDocumentDownloadRequest", "request", "=", "new", "GetDocumentDownloadRequest", "(...
get a Document Download link. @param documentId the documentId need to download. @return A GetDocumentDownloadResponse object containing the information returned by Document.
[ "get", "a", "Document", "Download", "link", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/doc/DocClient.java#L663-L681
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bos/model/FetchObjectRequest.java
FetchObjectRequest.setMode
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); } }
java
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); } }
[ "public", "void", "setMode", "(", "String", "mode", ")", "{", "checkNotNull", "(", "mode", ",", "\"mode should not be null\"", ")", ";", "if", "(", "MODE_ASYNC", ".", "equals", "(", "mode", ")", "||", "MODE_SYNC", ".", "equals", "(", "mode", ")", ")", "{...
Sets the mode of this fetching job. @param mode The mode of this fetching job.
[ "Sets", "the", "mode", "of", "this", "fetching", "job", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/model/FetchObjectRequest.java#L103-L110
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bmr/model/AddStepsRequest.java
AddStepsRequest.withStep
public AddStepsRequest withStep(StepConfig step) { if (this.steps == null) { this.steps = new ArrayList<StepConfig>(); } this.steps.add(step); return this; }
java
public AddStepsRequest withStep(StepConfig step) { if (this.steps == null) { this.steps = new ArrayList<StepConfig>(); } this.steps.add(step); return this; }
[ "public", "AddStepsRequest", "withStep", "(", "StepConfig", "step", ")", "{", "if", "(", "this", ".", "steps", "==", "null", ")", "{", "this", ".", "steps", "=", "new", "ArrayList", "<", "StepConfig", ">", "(", ")", ";", "}", "this", ".", "steps", "....
Configure the step to be added. @param step a StepConfig object to be added. @return AddStepsRequest
[ "Configure", "the", "step", "to", "be", "added", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bmr/model/AddStepsRequest.java#L73-L79
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/util/HttpUtils.java
HttpUtils.generateHostHeader
public static String generateHostHeader(URI uri) { String host = uri.getHost(); if (isUsingNonDefaultPort(uri)) { host += ":" + uri.getPort(); } return host; }
java
public static String generateHostHeader(URI uri) { String host = uri.getHost(); if (isUsingNonDefaultPort(uri)) { host += ":" + uri.getPort(); } return host; }
[ "public", "static", "String", "generateHostHeader", "(", "URI", "uri", ")", "{", "String", "host", "=", "uri", ".", "getHost", "(", ")", ";", "if", "(", "isUsingNonDefaultPort", "(", "uri", ")", ")", "{", "host", "+=", "\":\"", "+", "uri", ".", "getPor...
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. @param uri the URI @return a host header according to the specified URI.
[ "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", "hostnam...
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/util/HttpUtils.java#L169-L175
train
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/moladb/model/Key.java
Key.withAttribute
public Key withAttribute(String attributeName, AttributeValue value) { if (this.attributes == null) { this.attributes = new HashMap<String, AttributeValue>(); } attributes.put(attributeName, value); return this; }
java
public Key withAttribute(String attributeName, AttributeValue value) { if (this.attributes == null) { this.attributes = new HashMap<String, AttributeValue>(); } attributes.put(attributeName, value); return this; }
[ "public", "Key", "withAttribute", "(", "String", "attributeName", ",", "AttributeValue", "value", ")", "{", "if", "(", "this", ".", "attributes", "==", "null", ")", "{", "this", ".", "attributes", "=", "new", "HashMap", "<", "String", ",", "AttributeValue", ...
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. @param attributeName The attribute name to set for a key. @param value The attribute value to set for a key. @return A reference to this object so that method calls can be chained together.
[ "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", "." ]
f7140f28dd82121515c88ded7bfe769a37d0ec4a
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/moladb/model/Key.java#L79-L85
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/builder/compiler/VueTemplateCompiler.java
VueTemplateCompiler.initEngine
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.printStackTrace(); } }
java
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.printStackTrace(); } }
[ "private", "void", "initEngine", "(", ")", "{", "engine", "=", "(", "NashornScriptEngine", ")", "new", "ScriptEngineManager", "(", ")", ".", "getEngineByName", "(", "\"nashorn\"", ")", ";", "try", "{", "engine", ".", "eval", "(", "\"(function(global){global.glob...
Init the Nashorn engine and load the Vue compiler in it.
[ "Init", "the", "Nashorn", "engine", "and", "load", "the", "Vue", "compiler", "in", "it", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/builder/compiler/VueTemplateCompiler.java#L27-L36
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/builder/compiler/VueTemplateCompiler.java
VueTemplateCompiler.compile
public VueTemplateCompilerResult compile(String htmlTemplate) throws VueTemplateCompilerException { ScriptObjectMirror templateCompilerResult; try { templateCompilerResult = (ScriptObjectMirror) engine.invokeFunction("compile", htmlTemplate); } catch (ScriptException | NoSuchMethodException e) { e.printStackTrace(); throw new VueTemplateCompilerException( "An error occurred while compiling the template: " + htmlTemplate + " -> " + e.getMessage()); } String renderFunction = (String) templateCompilerResult.get("render"); String[] staticRenderFunctions = ((ScriptObjectMirror) templateCompilerResult.get("staticRenderFns")).to(String[].class); return new VueTemplateCompilerResult(renderFunction, staticRenderFunctions); }
java
public VueTemplateCompilerResult compile(String htmlTemplate) throws VueTemplateCompilerException { ScriptObjectMirror templateCompilerResult; try { templateCompilerResult = (ScriptObjectMirror) engine.invokeFunction("compile", htmlTemplate); } catch (ScriptException | NoSuchMethodException e) { e.printStackTrace(); throw new VueTemplateCompilerException( "An error occurred while compiling the template: " + htmlTemplate + " -> " + e.getMessage()); } String renderFunction = (String) templateCompilerResult.get("render"); String[] staticRenderFunctions = ((ScriptObjectMirror) templateCompilerResult.get("staticRenderFns")).to(String[].class); return new VueTemplateCompilerResult(renderFunction, staticRenderFunctions); }
[ "public", "VueTemplateCompilerResult", "compile", "(", "String", "htmlTemplate", ")", "throws", "VueTemplateCompilerException", "{", "ScriptObjectMirror", "templateCompilerResult", ";", "try", "{", "templateCompilerResult", "=", "(", "ScriptObjectMirror", ")", "engine", "."...
Compile the given HTML template to JS functions using vue-template-compiler. @param htmlTemplate The HTML Component template to compile @return An object containing the render functions @throws VueTemplateCompilerException If the compilation fails
[ "Compile", "the", "given", "HTML", "template", "to", "JS", "functions", "using", "vue", "-", "template", "-", "compiler", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/builder/compiler/VueTemplateCompiler.java#L45-L65
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/utils/ComponentGeneratorsUtil.java
ComponentGeneratorsUtil.isMethodVisibleInTemplate
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) && !method.getModifiers().contains(Modifier.STATIC) && !method.getModifiers().contains(Modifier.PRIVATE); }
java
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) && !method.getModifiers().contains(Modifier.STATIC) && !method.getModifiers().contains(Modifier.PRIVATE); }
[ "public", "static", "boolean", "isMethodVisibleInTemplate", "(", "ExecutableElement", "method", ")", "{", "return", "isMethodVisibleInJS", "(", "method", ")", "&&", "!", "hasAnnotation", "(", "method", ",", "Computed", ".", "class", ")", "&&", "!", "hasAnnotation"...
Check if a given method is usable in the template @param method The method we are checking @return true if visible, false otherwise
[ "Check", "if", "a", "given", "method", "is", "usable", "in", "the", "template" ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/utils/ComponentGeneratorsUtil.java#L140-L148
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/utils/ComponentGeneratorsUtil.java
ComponentGeneratorsUtil.getSuperComponentCount
public static int getSuperComponentCount(TypeElement component) { return getSuperComponentType(component) .map(superComponent -> getSuperComponentCount(superComponent) + 1) .orElse(0); }
java
public static int getSuperComponentCount(TypeElement component) { return getSuperComponentType(component) .map(superComponent -> getSuperComponentCount(superComponent) + 1) .orElse(0); }
[ "public", "static", "int", "getSuperComponentCount", "(", "TypeElement", "component", ")", "{", "return", "getSuperComponentType", "(", "component", ")", ".", "map", "(", "superComponent", "->", "getSuperComponentCount", "(", "superComponent", ")", "+", "1", ")", ...
Return the number of super component in the chain of parents @param component The {@link IsVueComponent} to count the super type of @return The number of super components
[ "Return", "the", "number", "of", "super", "component", "in", "the", "chain", "of", "parents" ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/utils/ComponentGeneratorsUtil.java#L202-L206
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/utils/ComponentGeneratorsUtil.java
ComponentGeneratorsUtil.hasTemplate
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.ABSTRACT)) { return false; } return !hasInterface(processingEnvironment, component.asType(), HasRender.class); }
java
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.ABSTRACT)) { return false; } return !hasInterface(processingEnvironment, component.asType(), HasRender.class); }
[ "public", "static", "boolean", "hasTemplate", "(", "ProcessingEnvironment", "processingEnvironment", ",", "TypeElement", "component", ")", "{", "Component", "annotation", "=", "component", ".", "getAnnotation", "(", "Component", ".", "class", ")", ";", "if", "(", ...
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. @param processingEnvironment Environment of the Annotation processor @param component The component to check @return true if has a template, false otherwise
[ "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", "hasTemp...
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/utils/ComponentGeneratorsUtil.java#L217-L229
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/builder/TemplateMethodsBuilder.java
TemplateMethodsBuilder.compileTemplateString
private void compileTemplateString(ComponentExposedTypeGenerator exposedTypeGenerator, TemplateParserResult templateParserResult) { VueTemplateCompilerResult compilerResult; try { VueTemplateCompiler vueTemplateCompiler = new VueTemplateCompiler(); compilerResult = vueTemplateCompiler.compile(templateParserResult.getProcessedTemplate()); } catch (VueTemplateCompilerException e) { e.printStackTrace(); throw new RuntimeException(); } generateGetRenderFunction(exposedTypeGenerator, compilerResult, templateParserResult); generateGetStaticRenderFunctions(exposedTypeGenerator, compilerResult); }
java
private void compileTemplateString(ComponentExposedTypeGenerator exposedTypeGenerator, TemplateParserResult templateParserResult) { VueTemplateCompilerResult compilerResult; try { VueTemplateCompiler vueTemplateCompiler = new VueTemplateCompiler(); compilerResult = vueTemplateCompiler.compile(templateParserResult.getProcessedTemplate()); } catch (VueTemplateCompilerException e) { e.printStackTrace(); throw new RuntimeException(); } generateGetRenderFunction(exposedTypeGenerator, compilerResult, templateParserResult); generateGetStaticRenderFunctions(exposedTypeGenerator, compilerResult); }
[ "private", "void", "compileTemplateString", "(", "ComponentExposedTypeGenerator", "exposedTypeGenerator", ",", "TemplateParserResult", "templateParserResult", ")", "{", "VueTemplateCompilerResult", "compilerResult", ";", "try", "{", "VueTemplateCompiler", "vueTemplateCompiler", "...
Compile the HTML template and transform it to a JS render function. @param exposedTypeGenerator Class generating the ExposedType @param templateParserResult The result of the HTML template parsed by {@link TemplateParser}
[ "Compile", "the", "HTML", "template", "and", "transform", "it", "to", "a", "JS", "render", "function", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/builder/TemplateMethodsBuilder.java#L51-L64
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/builder/TemplateMethodsBuilder.java
TemplateMethodsBuilder.generateGetRenderFunction
private void generateGetRenderFunction(ComponentExposedTypeGenerator exposedTypeGenerator, VueTemplateCompilerResult result, TemplateParserResult templateParserResult) { MethodSpec.Builder getRenderFunctionBuilder = MethodSpec .methodBuilder("getRenderFunction") .addModifiers(Modifier.PRIVATE) .returns(Function.class) .addStatement("String renderFunctionString = $S", result.getRenderFunction()); for (VariableInfo vModelField : templateParserResult.getvModelDataFields()) { String placeHolderVModelValue = vModelFieldToPlaceHolderField(vModelField.getName()); String fieldName = vModelField.getName(); if (vModelField instanceof ComputedVariableInfo) fieldName = ((ComputedVariableInfo) vModelField).getFieldName(); getRenderFunctionBuilder .addStatement( "renderFunctionString = $T.replaceVariableInRenderFunction(renderFunctionString, $S, this, () -> this.$L = $L)", VueGWTTools.class, placeHolderVModelValue, fieldName, getFieldMarkingValueForType(vModelField.getType()) ); } getRenderFunctionBuilder .addStatement("return new $T(renderFunctionString)", Function.class); exposedTypeGenerator.getClassBuilder().addMethod(getRenderFunctionBuilder.build()); }
java
private void generateGetRenderFunction(ComponentExposedTypeGenerator exposedTypeGenerator, VueTemplateCompilerResult result, TemplateParserResult templateParserResult) { MethodSpec.Builder getRenderFunctionBuilder = MethodSpec .methodBuilder("getRenderFunction") .addModifiers(Modifier.PRIVATE) .returns(Function.class) .addStatement("String renderFunctionString = $S", result.getRenderFunction()); for (VariableInfo vModelField : templateParserResult.getvModelDataFields()) { String placeHolderVModelValue = vModelFieldToPlaceHolderField(vModelField.getName()); String fieldName = vModelField.getName(); if (vModelField instanceof ComputedVariableInfo) fieldName = ((ComputedVariableInfo) vModelField).getFieldName(); getRenderFunctionBuilder .addStatement( "renderFunctionString = $T.replaceVariableInRenderFunction(renderFunctionString, $S, this, () -> this.$L = $L)", VueGWTTools.class, placeHolderVModelValue, fieldName, getFieldMarkingValueForType(vModelField.getType()) ); } getRenderFunctionBuilder .addStatement("return new $T(renderFunctionString)", Function.class); exposedTypeGenerator.getClassBuilder().addMethod(getRenderFunctionBuilder.build()); }
[ "private", "void", "generateGetRenderFunction", "(", "ComponentExposedTypeGenerator", "exposedTypeGenerator", ",", "VueTemplateCompilerResult", "result", ",", "TemplateParserResult", "templateParserResult", ")", "{", "MethodSpec", ".", "Builder", "getRenderFunctionBuilder", "=", ...
Generate the method that returns the body of the render function. @param exposedTypeGenerator Class generating the ExposedType @param result The result from compilation using vue-template-compiler @param templateParserResult The result of the HTML template parsed by {@link TemplateParser}
[ "Generate", "the", "method", "that", "returns", "the", "body", "of", "the", "render", "function", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/builder/TemplateMethodsBuilder.java#L73-L103
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/builder/TemplateMethodsBuilder.java
TemplateMethodsBuilder.generateGetStaticRenderFunctions
private void generateGetStaticRenderFunctions(ComponentExposedTypeGenerator exposedTypeGenerator, VueTemplateCompilerResult result) { CodeBlock.Builder staticFunctions = CodeBlock.builder(); boolean isFirst = true; for (String staticRenderFunction : result.getStaticRenderFunctions()) { if (!isFirst) { staticFunctions.add(", "); } else { isFirst = false; } staticFunctions.add("new $T($S)", Function.class, staticRenderFunction); } MethodSpec.Builder getStaticRenderFunctionsBuilder = MethodSpec .methodBuilder("getStaticRenderFunctions") .addModifiers(Modifier.PRIVATE) .returns(Function[].class) .addStatement("return new $T[] { $L }", Function.class, staticFunctions.build()); exposedTypeGenerator.getClassBuilder().addMethod(getStaticRenderFunctionsBuilder.build()); }
java
private void generateGetStaticRenderFunctions(ComponentExposedTypeGenerator exposedTypeGenerator, VueTemplateCompilerResult result) { CodeBlock.Builder staticFunctions = CodeBlock.builder(); boolean isFirst = true; for (String staticRenderFunction : result.getStaticRenderFunctions()) { if (!isFirst) { staticFunctions.add(", "); } else { isFirst = false; } staticFunctions.add("new $T($S)", Function.class, staticRenderFunction); } MethodSpec.Builder getStaticRenderFunctionsBuilder = MethodSpec .methodBuilder("getStaticRenderFunctions") .addModifiers(Modifier.PRIVATE) .returns(Function[].class) .addStatement("return new $T[] { $L }", Function.class, staticFunctions.build()); exposedTypeGenerator.getClassBuilder().addMethod(getStaticRenderFunctionsBuilder.build()); }
[ "private", "void", "generateGetStaticRenderFunctions", "(", "ComponentExposedTypeGenerator", "exposedTypeGenerator", ",", "VueTemplateCompilerResult", "result", ")", "{", "CodeBlock", ".", "Builder", "staticFunctions", "=", "CodeBlock", ".", "builder", "(", ")", ";", "boo...
Generate the method that returns the body of the static render functions. @param exposedTypeGenerator Class generating the ExposedType @param result The result from compilation using vue-template-compiler
[ "Generate", "the", "method", "that", "returns", "the", "body", "of", "the", "static", "render", "functions", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/builder/TemplateMethodsBuilder.java#L111-L133
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/builder/TemplateMethodsBuilder.java
TemplateMethodsBuilder.processTemplateExpressions
private void processTemplateExpressions(ComponentExposedTypeGenerator exposedTypeGenerator, TemplateParserResult templateParserResult) { for (TemplateExpression expression : templateParserResult.getExpressions()) { generateTemplateExpressionMethod(exposedTypeGenerator, expression, templateParserResult.getTemplateName()); } // Declare methods in the component String templateMethods = templateParserResult.getExpressions() .stream() .map(expression -> "p." + expression.getId()) .collect(Collectors.joining(", ")); exposedTypeGenerator.getOptionsBuilder() .addStatement("options.registerTemplateMethods($L)", templateMethods); }
java
private void processTemplateExpressions(ComponentExposedTypeGenerator exposedTypeGenerator, TemplateParserResult templateParserResult) { for (TemplateExpression expression : templateParserResult.getExpressions()) { generateTemplateExpressionMethod(exposedTypeGenerator, expression, templateParserResult.getTemplateName()); } // Declare methods in the component String templateMethods = templateParserResult.getExpressions() .stream() .map(expression -> "p." + expression.getId()) .collect(Collectors.joining(", ")); exposedTypeGenerator.getOptionsBuilder() .addStatement("options.registerTemplateMethods($L)", templateMethods); }
[ "private", "void", "processTemplateExpressions", "(", "ComponentExposedTypeGenerator", "exposedTypeGenerator", ",", "TemplateParserResult", "templateParserResult", ")", "{", "for", "(", "TemplateExpression", "expression", ":", "templateParserResult", ".", "getExpressions", "(",...
Process the expressions found in the HTML template @param exposedTypeGenerator Class generating the ExposedType @param templateParserResult Result from the parsing of the HTML Template
[ "Process", "the", "expressions", "found", "in", "the", "HTML", "template" ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/builder/TemplateMethodsBuilder.java#L141-L157
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/builder/TemplateMethodsBuilder.java
TemplateMethodsBuilder.generateTemplateExpressionMethod
private void generateTemplateExpressionMethod(ComponentExposedTypeGenerator exposedTypeGenerator, TemplateExpression expression, String templateName) { MethodSpec.Builder templateExpressionMethodBuilder = MethodSpec .methodBuilder(expression.getId()) .addModifiers(Modifier.PUBLIC) .addAnnotation(JsMethod.class) .addAnnotation(getUnusableByJSAnnotation()) .returns(expression.getType()); String expressionPosition = templateName; if (expression.getLineInHtml() != null) { expressionPosition += ", line " + expression.getLineInHtml(); } templateExpressionMethodBuilder.addComment(expressionPosition); expression .getParameters() .forEach(parameter -> templateExpressionMethodBuilder.addParameter(parameter.getType(), parameter.getName())); if (expression.isReturnString()) { templateExpressionMethodBuilder.addStatement("return $T.templateExpressionToString($L)", VueGWTTools.class, expression.getBody()); } else if (expression.isReturnVoid()) { templateExpressionMethodBuilder.addStatement("$L", expression.getBody()); } else if (expression.isReturnAny()) { templateExpressionMethodBuilder.addStatement("return $T.asAny($L)", Js.class, expression.getBody()); } else if (expression.isShouldCast()) { templateExpressionMethodBuilder.addStatement("return ($T) ($L)", expression.getType(), expression.getBody()); } else { templateExpressionMethodBuilder.addStatement("return $L", expression.getBody()); } exposedTypeGenerator.getClassBuilder().addMethod(templateExpressionMethodBuilder.build()); exposedTypeGenerator.addMethodToProto(expression.getId()); }
java
private void generateTemplateExpressionMethod(ComponentExposedTypeGenerator exposedTypeGenerator, TemplateExpression expression, String templateName) { MethodSpec.Builder templateExpressionMethodBuilder = MethodSpec .methodBuilder(expression.getId()) .addModifiers(Modifier.PUBLIC) .addAnnotation(JsMethod.class) .addAnnotation(getUnusableByJSAnnotation()) .returns(expression.getType()); String expressionPosition = templateName; if (expression.getLineInHtml() != null) { expressionPosition += ", line " + expression.getLineInHtml(); } templateExpressionMethodBuilder.addComment(expressionPosition); expression .getParameters() .forEach(parameter -> templateExpressionMethodBuilder.addParameter(parameter.getType(), parameter.getName())); if (expression.isReturnString()) { templateExpressionMethodBuilder.addStatement("return $T.templateExpressionToString($L)", VueGWTTools.class, expression.getBody()); } else if (expression.isReturnVoid()) { templateExpressionMethodBuilder.addStatement("$L", expression.getBody()); } else if (expression.isReturnAny()) { templateExpressionMethodBuilder.addStatement("return $T.asAny($L)", Js.class, expression.getBody()); } else if (expression.isShouldCast()) { templateExpressionMethodBuilder.addStatement("return ($T) ($L)", expression.getType(), expression.getBody()); } else { templateExpressionMethodBuilder.addStatement("return $L", expression.getBody()); } exposedTypeGenerator.getClassBuilder().addMethod(templateExpressionMethodBuilder.build()); exposedTypeGenerator.addMethodToProto(expression.getId()); }
[ "private", "void", "generateTemplateExpressionMethod", "(", "ComponentExposedTypeGenerator", "exposedTypeGenerator", ",", "TemplateExpression", "expression", ",", "String", "templateName", ")", "{", "MethodSpec", ".", "Builder", "templateExpressionMethodBuilder", "=", "MethodSp...
Generate the Java method for an expression in the Template @param exposedTypeGenerator Class generating the ExposedType @param templateName The name of the Template the expression is from
[ "Generate", "the", "Java", "method", "for", "an", "expression", "in", "the", "Template" ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/builder/TemplateMethodsBuilder.java#L165-L207
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/utils/GeneratorsNameUtil.java
GeneratorsNameUtil.componentToTagName
public static String componentToTagName(Element componentElement) throws MissingComponentAnnotationException { Component componentAnnotation = componentElement.getAnnotation(Component.class); JsComponent jsComponentAnnotation = componentElement.getAnnotation(JsComponent.class); String annotationNameValue; if (componentAnnotation != null) { annotationNameValue = componentAnnotation.name(); } else if (jsComponentAnnotation != null) { annotationNameValue = jsComponentAnnotation.value(); } else { throw new MissingComponentAnnotationException(); } if (!"".equals(annotationNameValue)) { return annotationNameValue; } // Drop "Component" at the end of the class name String componentClassName = componentElement .getSimpleName() .toString() .replaceAll("Component$", ""); // Convert from CamelCase to kebab-case return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, componentClassName).toLowerCase(); }
java
public static String componentToTagName(Element componentElement) throws MissingComponentAnnotationException { Component componentAnnotation = componentElement.getAnnotation(Component.class); JsComponent jsComponentAnnotation = componentElement.getAnnotation(JsComponent.class); String annotationNameValue; if (componentAnnotation != null) { annotationNameValue = componentAnnotation.name(); } else if (jsComponentAnnotation != null) { annotationNameValue = jsComponentAnnotation.value(); } else { throw new MissingComponentAnnotationException(); } if (!"".equals(annotationNameValue)) { return annotationNameValue; } // Drop "Component" at the end of the class name String componentClassName = componentElement .getSimpleName() .toString() .replaceAll("Component$", ""); // Convert from CamelCase to kebab-case return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, componentClassName).toLowerCase(); }
[ "public", "static", "String", "componentToTagName", "(", "Element", "componentElement", ")", "throws", "MissingComponentAnnotationException", "{", "Component", "componentAnnotation", "=", "componentElement", ".", "getAnnotation", "(", "Component", ".", "class", ")", ";", ...
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. @param componentElement The Element for the {@link IsVueComponent} we want the name of @return The name of the component as kebab case @throws MissingComponentAnnotationException If the {@link IsVueComponent} doesn't have a Component or JsComponent annotation
[ "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"...
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/utils/GeneratorsNameUtil.java#L114-L140
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/utils/GeneratorsNameUtil.java
GeneratorsNameUtil.directiveToTagName
public static String directiveToTagName(String directiveClassName) { // Drop "Component" at the end of the class name directiveClassName = directiveClassName.replaceAll("Directive$", ""); // Convert from CamelCase to kebab-case return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, directiveClassName).toLowerCase(); }
java
public static String directiveToTagName(String directiveClassName) { // Drop "Component" at the end of the class name directiveClassName = directiveClassName.replaceAll("Directive$", ""); // Convert from CamelCase to kebab-case return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, directiveClassName).toLowerCase(); }
[ "public", "static", "String", "directiveToTagName", "(", "String", "directiveClassName", ")", "{", "// Drop \"Component\" at the end of the class name", "directiveClassName", "=", "directiveClassName", ".", "replaceAll", "(", "\"Directive$\"", ",", "\"\"", ")", ";", "// Con...
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 @param directiveClassName The class name of the {@link VueDirective} @return The name of the directive as kebab case
[ "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", "...
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/utils/GeneratorsNameUtil.java#L150-L155
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/VForDefinition.java
VForDefinition.initLoopVariable
private void initLoopVariable(String type, String name, TemplateParserContext context) { this.loopVariableInfo = context.addLocalVariable(context.getFullyQualifiedNameForClassName(type.trim()), name.trim()); }
java
private void initLoopVariable(String type, String name, TemplateParserContext context) { this.loopVariableInfo = context.addLocalVariable(context.getFullyQualifiedNameForClassName(type.trim()), name.trim()); }
[ "private", "void", "initLoopVariable", "(", "String", "type", ",", "String", "name", ",", "TemplateParserContext", "context", ")", "{", "this", ".", "loopVariableInfo", "=", "context", ".", "addLocalVariable", "(", "context", ".", "getFullyQualifiedNameForClassName", ...
Init the loop variable and add it to the parser context @param type Java type of the variable, will look for qualified class name in the context @param name Name of the variable @param context Context of the template parser
[ "Init", "the", "loop", "variable", "and", "add", "it", "to", "the", "parser", "context" ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/VForDefinition.java#L157-L161
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/VForDefinition.java
VForDefinition.initIndexVariable
private void initIndexVariable(String name, TemplateParserContext context) { this.indexVariableInfo = context.addLocalVariable("int", name.trim()); }
java
private void initIndexVariable(String name, TemplateParserContext context) { this.indexVariableInfo = context.addLocalVariable("int", name.trim()); }
[ "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 @param name Name of the variable @param context Context of the template parser
[ "Init", "the", "index", "variable", "and", "add", "it", "to", "the", "parser", "context" ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/VForDefinition.java#L169-L171
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/VForDefinition.java
VForDefinition.initKeyVariable
private void initKeyVariable(String name, TemplateParserContext context) { this.keyVariableInfo = context.addLocalVariable("String", name.trim()); }
java
private void initKeyVariable(String name, TemplateParserContext context) { this.keyVariableInfo = context.addLocalVariable("String", name.trim()); }
[ "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 @param name Name of the variable @param context Context of the template parser
[ "Init", "the", "key", "variable", "and", "add", "it", "to", "the", "parser", "context" ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/VForDefinition.java#L179-L181
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/result/TemplateExpression.java
TemplateExpression.toTemplateString
public String toTemplateString() { String[] parametersName = this.parameters.stream().map(VariableInfo::getName).toArray(String[]::new); return this.getId() + "(" + String.join(", ", parametersName) + ")"; }
java
public String toTemplateString() { String[] parametersName = this.parameters.stream().map(VariableInfo::getName).toArray(String[]::new); return this.getId() + "(" + String.join(", ", parametersName) + ")"; }
[ "public", "String", "toTemplateString", "(", ")", "{", "String", "[", "]", "parametersName", "=", "this", ".", "parameters", ".", "stream", "(", ")", ".", "map", "(", "VariableInfo", "::", "getName", ")", ".", "toArray", "(", "String", "[", "]", "::", ...
Return this expression as a string that can be placed in the template as a replacement of the Java expression. @return An expression that can be interpreted by Vue.js
[ "Return", "this", "expression", "as", "a", "string", "that", "can", "be", "placed", "in", "the", "template", "as", "a", "replacement", "of", "the", "Java", "expression", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/result/TemplateExpression.java#L93-L98
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java
TemplateParser.parseHtmlTemplate
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); this.htmlTemplateUri = htmlTemplateUri; initJerichoConfig(this.logger); Source source = new Source(htmlTemplate); outputDocument = new OutputDocument(source); result = new TemplateParserResult(context); processImports(source); result.setScopedCss(processScopedCss(source)); source.getChildElements().forEach(this::processElement); result.setProcessedTemplate(outputDocument.toString()); return result; }
java
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); this.htmlTemplateUri = htmlTemplateUri; initJerichoConfig(this.logger); Source source = new Source(htmlTemplate); outputDocument = new OutputDocument(source); result = new TemplateParserResult(context); processImports(source); result.setScopedCss(processScopedCss(source)); source.getChildElements().forEach(this::processElement); result.setProcessedTemplate(outputDocument.toString()); return result; }
[ "public", "TemplateParserResult", "parseHtmlTemplate", "(", "String", "htmlTemplate", ",", "TemplateParserContext", "context", ",", "Elements", "elements", ",", "Messager", "messager", ",", "URI", "htmlTemplateUri", ")", "{", "this", ".", "context", "=", "context", ...
Parse a given HTML template and return the a result object containing the expressions and a transformed HTML. @param htmlTemplate The HTML template to process, as a String @param context Context of the Component we are currently processing @param messager Used to report errors in template during Annotation Processing @return A {@link TemplateParserResult} containing the processed template and expressions
[ "Parse", "a", "given", "HTML", "template", "and", "return", "the", "a", "result", "object", "containing", "the", "expressions", "and", "a", "transformed", "HTML", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java#L101-L121
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java
TemplateParser.processImports
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.addImport(classAttributeValue); } String staticAttributeValue = importElement.getAttributeValue("static"); if (staticAttributeValue != null) { context.addStaticImport(staticAttributeValue); } }) .forEach(outputDocument::remove); }
java
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.addImport(classAttributeValue); } String staticAttributeValue = importElement.getAttributeValue("static"); if (staticAttributeValue != null) { context.addStaticImport(staticAttributeValue); } }) .forEach(outputDocument::remove); }
[ "private", "void", "processImports", "(", "Source", "doc", ")", "{", "doc", ".", "getAllElements", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "element", "->", "\"vue-gwt:import\"", ".", "equalsIgnoreCase", "(", "element", ".", "getName", "(", "...
Add java imports in the template to the context. @param doc The document to process
[ "Add", "java", "imports", "in", "the", "template", "to", "the", "context", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java#L137-L154
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java
TemplateParser.processElement
private void processElement(Element element) { context.setCurrentSegment(element); currentProp = null; currentAttribute = null; // Process attributes boolean shouldPopContext = processElementAttributes(element); // Process text segments StreamSupport .stream(((Iterable<Segment>) element::getNodeIterator).spliterator(), false) .filter(segment -> !(segment instanceof Tag) && !(segment instanceof CharacterReference)) .filter(segment -> { for (Element child : element.getChildElements()) { if (child.encloses(segment)) { return false; } } return true; }) .forEach(this::processTextNode); // Recurse downwards element.getChildElements(). forEach(this::processElement); // After downward recursion, pop the context layer if necessary if (shouldPopContext) { context.popContextLayer(); } }
java
private void processElement(Element element) { context.setCurrentSegment(element); currentProp = null; currentAttribute = null; // Process attributes boolean shouldPopContext = processElementAttributes(element); // Process text segments StreamSupport .stream(((Iterable<Segment>) element::getNodeIterator).spliterator(), false) .filter(segment -> !(segment instanceof Tag) && !(segment instanceof CharacterReference)) .filter(segment -> { for (Element child : element.getChildElements()) { if (child.encloses(segment)) { return false; } } return true; }) .forEach(this::processTextNode); // Recurse downwards element.getChildElements(). forEach(this::processElement); // After downward recursion, pop the context layer if necessary if (shouldPopContext) { context.popContextLayer(); } }
[ "private", "void", "processElement", "(", "Element", "element", ")", "{", "context", ".", "setCurrentSegment", "(", "element", ")", ";", "currentProp", "=", "null", ";", "currentAttribute", "=", "null", ";", "// Process attributes", "boolean", "shouldPopContext", ...
Recursive method that will process the whole template DOM tree. @param element Current element being processed
[ "Recursive", "method", "that", "will", "process", "the", "whole", "template", "DOM", "tree", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java#L206-L237
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java
TemplateParser.getTypeFromDOMElement
private TypeMirror getTypeFromDOMElement(Element element) { return DOMElementsUtil .getTypeForElementTag(element.getStartTag().getName()) .map(Class::getCanonicalName) .map(elements::getTypeElement) .map(TypeElement::asType) .orElse(null); }
java
private TypeMirror getTypeFromDOMElement(Element element) { return DOMElementsUtil .getTypeForElementTag(element.getStartTag().getName()) .map(Class::getCanonicalName) .map(elements::getTypeElement) .map(TypeElement::asType) .orElse(null); }
[ "private", "TypeMirror", "getTypeFromDOMElement", "(", "Element", "element", ")", "{", "return", "DOMElementsUtil", ".", "getTypeForElementTag", "(", "element", ".", "getStartTag", "(", ")", ".", "getName", "(", ")", ")", ".", "map", "(", "Class", "::", "getCa...
Find the corresponding TypeMirror from Elemental2 for a given DOM Element @param element The element we want the TypeMirror of @return The type mirror
[ "Find", "the", "corresponding", "TypeMirror", "from", "Elemental2", "for", "a", "given", "DOM", "Element" ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java#L333-L340
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java
TemplateParser.registerMandatoryAttributes
private void registerMandatoryAttributes(Attributes attributes) { // see https://sourceforge.net/p/jerichohtml/discussion/350024/thread/501a7d05/ 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.getBegin(), " " + i.getKey() + " "); } else { outputDocument.insert(attributes.getBegin(), " " + i.getKey() + "\"" + v + "\" "); } } } }
java
private void registerMandatoryAttributes(Attributes attributes) { // see https://sourceforge.net/p/jerichohtml/discussion/350024/thread/501a7d05/ 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.getBegin(), " " + i.getKey() + " "); } else { outputDocument.insert(attributes.getBegin(), " " + i.getKey() + "\"" + v + "\" "); } } } }
[ "private", "void", "registerMandatoryAttributes", "(", "Attributes", "attributes", ")", "{", "// see https://sourceforge.net/p/jerichohtml/discussion/350024/thread/501a7d05/", "Map", "<", "String", ",", "String", ">", "attrs", "=", "context", ".", "getMandatoryAttributes", "(...
Register mandatory attributes for Scoped CSS
[ "Register", "mandatory", "attributes", "for", "Scoped", "CSS" ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java#L351-L364
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java
TemplateParser.getExpressionReturnTypeForAttribute
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".equals(attributeName) || "v-show".equals(attributeName)) { return TypeName.BOOLEAN; } if (isBoundedAttribute(attributeName)) { String unboundedAttributeName = boundedAttributeToAttributeName(attributeName); if (unboundedAttributeName.equals("class") || unboundedAttributeName.equals("style")) { return TypeName.get(Any.class); } if (propertiesTypes.containsKey(unboundedAttributeName)) { return TypeName.get(propertiesTypes.get(unboundedAttributeName)); } } if (currentProp != null) { return currentProp.getType(); } return TypeName.get(Any.class); }
java
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".equals(attributeName) || "v-show".equals(attributeName)) { return TypeName.BOOLEAN; } if (isBoundedAttribute(attributeName)) { String unboundedAttributeName = boundedAttributeToAttributeName(attributeName); if (unboundedAttributeName.equals("class") || unboundedAttributeName.equals("style")) { return TypeName.get(Any.class); } if (propertiesTypes.containsKey(unboundedAttributeName)) { return TypeName.get(propertiesTypes.get(unboundedAttributeName)); } } if (currentProp != null) { return currentProp.getType(); } return TypeName.get(Any.class); }
[ "private", "TypeName", "getExpressionReturnTypeForAttribute", "(", "Attribute", "attribute", ",", "Map", "<", "String", ",", "Class", "<", "?", ">", ">", "propertiesTypes", ")", "{", "String", "attributeName", "=", "attribute", ".", "getKey", "(", ")", ".", "t...
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. @param attribute The attribute the expression is in
[ "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", ...
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java#L485-L514
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java
TemplateParser.processVForValue
private String processVForValue(String vForValue) { VForDefinition vForDef = new VForDefinition(vForValue, context, logger); // Set return of the "in" expression currentExpressionReturnType = vForDef.getInExpressionType(); String inExpression = this.processExpression(vForDef.getInExpression()); // And return the newly built definition return vForDef.getVariableDefinition() + " in " + inExpression; }
java
private String processVForValue(String vForValue) { VForDefinition vForDef = new VForDefinition(vForValue, context, logger); // Set return of the "in" expression currentExpressionReturnType = vForDef.getInExpressionType(); String inExpression = this.processExpression(vForDef.getInExpression()); // And return the newly built definition return vForDef.getVariableDefinition() + " in " + inExpression; }
[ "private", "String", "processVForValue", "(", "String", "vForValue", ")", "{", "VForDefinition", "vForDef", "=", "new", "VForDefinition", "(", "vForValue", ",", "context", ",", "logger", ")", ";", "// Set return of the \"in\" expression", "currentExpressionReturnType", ...
Process a v-for value. It will register the loop variables as a local variable in the context stack. @param vForValue The value of the v-for attribute @return A processed v-for value, should be placed in the HTML in place of the original v-for value
[ "Process", "a", "v", "-", "for", "value", ".", "It", "will", "register", "the", "loop", "variables", "as", "a", "local", "variable", "in", "the", "context", "stack", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java#L524-L534
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java
TemplateParser.processSlotScopeValue
private String processSlotScopeValue(String value) { SlotScopeDefinition slotScopeDefinition = new SlotScopeDefinition(value, context, logger); return slotScopeDefinition.getSlotScopeVariableName(); }
java
private String processSlotScopeValue(String value) { SlotScopeDefinition slotScopeDefinition = new SlotScopeDefinition(value, context, logger); return slotScopeDefinition.getSlotScopeVariableName(); }
[ "private", "String", "processSlotScopeValue", "(", "String", "value", ")", "{", "SlotScopeDefinition", "slotScopeDefinition", "=", "new", "SlotScopeDefinition", "(", "value", ",", "context", ",", "logger", ")", ";", "return", "slotScopeDefinition", ".", "getSlotScopeV...
Process a scoped-slot value.
[ "Process", "a", "scoped", "-", "slot", "value", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java#L539-L542
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java
TemplateParser.processExpression
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 empty string then simply don't use binding: my-attribute=\"\"", currentAttribute.toString()); } else if (isEventBinding(currentAttribute)) { logger.error("Empty expression in template event binding.", currentAttribute.toString()); } else { return ""; } } if (expressionString.startsWith("{")) { logger.error( "Object literal syntax are not supported yet in Vue GWT, please use map(e(\"key1\", myValue), e(\"key2\", myValue2 > 5)...) instead. The object returned by map() is a regular Javascript Object (JsObject) with the given key/values.", expressionString); } if (expressionString.startsWith("[")) { logger.error( "Array literal syntax are not supported yet in Vue GWT, please use array(myValue, myValue2 > 5...) instead. The object returned by array() is a regular Javascript Array (JsArray) with the given values.", expressionString); } if (shouldSkipExpressionProcessing(expressionString)) { return expressionString; } return processJavaExpression(expressionString).toTemplateString(); }
java
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 empty string then simply don't use binding: my-attribute=\"\"", currentAttribute.toString()); } else if (isEventBinding(currentAttribute)) { logger.error("Empty expression in template event binding.", currentAttribute.toString()); } else { return ""; } } if (expressionString.startsWith("{")) { logger.error( "Object literal syntax are not supported yet in Vue GWT, please use map(e(\"key1\", myValue), e(\"key2\", myValue2 > 5)...) instead. The object returned by map() is a regular Javascript Object (JsObject) with the given key/values.", expressionString); } if (expressionString.startsWith("[")) { logger.error( "Array literal syntax are not supported yet in Vue GWT, please use array(myValue, myValue2 > 5...) instead. The object returned by array() is a regular Javascript Array (JsArray) with the given values.", expressionString); } if (shouldSkipExpressionProcessing(expressionString)) { return expressionString; } return processJavaExpression(expressionString).toTemplateString(); }
[ "private", "String", "processExpression", "(", "String", "expressionString", ")", "{", "expressionString", "=", "expressionString", "==", "null", "?", "\"\"", ":", "expressionString", ".", "trim", "(", ")", ";", "if", "(", "expressionString", ".", "isEmpty", "("...
Process a given template expression @param expressionString Should be either empty or a valid Java expression @return The processed expression
[ "Process", "a", "given", "template", "expression" ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java#L550-L582
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java
TemplateParser.shouldSkipExpressionProcessing
private boolean shouldSkipExpressionProcessing(String expressionString) { // We don't skip if it's a component prop as we want Java validation // We don't optimize String expression, as we want GWT to convert Java values // to String for us (Enums, wrapped primitives...) return currentProp == null && !String.class .getCanonicalName() .equals(currentExpressionReturnType.toString()) && isSimpleVueJsExpression( expressionString); }
java
private boolean shouldSkipExpressionProcessing(String expressionString) { // We don't skip if it's a component prop as we want Java validation // We don't optimize String expression, as we want GWT to convert Java values // to String for us (Enums, wrapped primitives...) return currentProp == null && !String.class .getCanonicalName() .equals(currentExpressionReturnType.toString()) && isSimpleVueJsExpression( expressionString); }
[ "private", "boolean", "shouldSkipExpressionProcessing", "(", "String", "expressionString", ")", "{", "// We don't skip if it's a component prop as we want Java validation", "// We don't optimize String expression, as we want GWT to convert Java values", "// to String for us (Enums, wrapped primi...
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. @param expressionString The expression to asses @return true if we can skip the expression
[ "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", "me...
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java#L591-L599
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java
TemplateParser.processJavaExpression
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); throw parseException; } resolveTypesUsingImports(expression); resolveStaticMethodsUsingImports(expression); checkMethodNames(expression); // Find the parameters used by the expression List<VariableInfo> expressionParameters = new LinkedList<>(); findExpressionParameters(expression, expressionParameters); // If there is a cast first, we use this as the type of our expression if (currentProp == null) { expression = getTypeFromCast(expression); } // Update the expression as it might have been changed expressionString = expression.toString(); // Add the resulting expression to our result return result.addExpression(expressionString, currentExpressionReturnType, currentProp == null, expressionParameters); }
java
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); throw parseException; } resolveTypesUsingImports(expression); resolveStaticMethodsUsingImports(expression); checkMethodNames(expression); // Find the parameters used by the expression List<VariableInfo> expressionParameters = new LinkedList<>(); findExpressionParameters(expression, expressionParameters); // If there is a cast first, we use this as the type of our expression if (currentProp == null) { expression = getTypeFromCast(expression); } // Update the expression as it might have been changed expressionString = expression.toString(); // Add the resulting expression to our result return result.addExpression(expressionString, currentExpressionReturnType, currentProp == null, expressionParameters); }
[ "private", "TemplateExpression", "processJavaExpression", "(", "String", "expressionString", ")", "{", "Expression", "expression", ";", "try", "{", "expression", "=", "JavaParser", ".", "parseExpression", "(", "expressionString", ")", ";", "}", "catch", "(", "ParseP...
Process the given string as a Java expression. @param expressionString A valid Java expression @return A processed expression, should be placed in the HTML in place of the original expression
[ "Process", "the", "given", "string", "as", "a", "Java", "expression", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java#L635-L667
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java
TemplateParser.resolveTypesUsingImports
private void resolveTypesUsingImports(Expression expression) { if (expression instanceof NodeWithType) { NodeWithType<?, ?> nodeWithType = ((NodeWithType<?, ?>) expression); nodeWithType.setType(getQualifiedName(nodeWithType.getType())); } // Recurse downward in the expression expression .getChildNodes() .stream() .filter(Expression.class::isInstance) .map(Expression.class::cast) .forEach(this::resolveTypesUsingImports); }
java
private void resolveTypesUsingImports(Expression expression) { if (expression instanceof NodeWithType) { NodeWithType<?, ?> nodeWithType = ((NodeWithType<?, ?>) expression); nodeWithType.setType(getQualifiedName(nodeWithType.getType())); } // Recurse downward in the expression expression .getChildNodes() .stream() .filter(Expression.class::isInstance) .map(Expression.class::cast) .forEach(this::resolveTypesUsingImports); }
[ "private", "void", "resolveTypesUsingImports", "(", "Expression", "expression", ")", "{", "if", "(", "expression", "instanceof", "NodeWithType", ")", "{", "NodeWithType", "<", "?", ",", "?", ">", "nodeWithType", "=", "(", "(", "NodeWithType", "<", "?", ",", ...
Resolve all the types in the expression. This will replace the Class with the full qualified name using the template imports. @param expression A Java expression from the Template
[ "Resolve", "all", "the", "types", "in", "the", "expression", ".", "This", "will", "replace", "the", "Class", "with", "the", "full", "qualified", "name", "using", "the", "template", "imports", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java#L708-L721
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java
TemplateParser.resolveStaticMethodsUsingImports
private void resolveStaticMethodsUsingImports(Expression expression) { if (expression instanceof MethodCallExpr) { MethodCallExpr methodCall = ((MethodCallExpr) expression); String methodName = methodCall.getName().getIdentifier(); if (!methodCall.getScope().isPresent() && context.hasStaticMethod(methodName)) { methodCall.setName(context.getFullyQualifiedNameForMethodName(methodName)); } } // Recurse downward in the expression expression .getChildNodes() .stream() .filter(Expression.class::isInstance) .map(Expression.class::cast) .forEach(this::resolveStaticMethodsUsingImports); }
java
private void resolveStaticMethodsUsingImports(Expression expression) { if (expression instanceof MethodCallExpr) { MethodCallExpr methodCall = ((MethodCallExpr) expression); String methodName = methodCall.getName().getIdentifier(); if (!methodCall.getScope().isPresent() && context.hasStaticMethod(methodName)) { methodCall.setName(context.getFullyQualifiedNameForMethodName(methodName)); } } // Recurse downward in the expression expression .getChildNodes() .stream() .filter(Expression.class::isInstance) .map(Expression.class::cast) .forEach(this::resolveStaticMethodsUsingImports); }
[ "private", "void", "resolveStaticMethodsUsingImports", "(", "Expression", "expression", ")", "{", "if", "(", "expression", "instanceof", "MethodCallExpr", ")", "{", "MethodCallExpr", "methodCall", "=", "(", "(", "MethodCallExpr", ")", "expression", ")", ";", "String...
Resolve static method calls using static imports @param expression The expression to resolve
[ "Resolve", "static", "method", "calls", "using", "static", "imports" ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java#L728-L744
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java
TemplateParser.checkMethodNames
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(methodName) && !context.hasStaticMethod(methodName)) { logger.error("Couldn't find the method \"" + methodName + "\". " + "Make sure it is not private."); } } } for (com.github.javaparser.ast.Node node : expression.getChildNodes()) { if (!(node instanceof Expression)) { continue; } Expression childExpr = (Expression) node; checkMethodNames(childExpr); } }
java
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(methodName) && !context.hasStaticMethod(methodName)) { logger.error("Couldn't find the method \"" + methodName + "\". " + "Make sure it is not private."); } } } for (com.github.javaparser.ast.Node node : expression.getChildNodes()) { if (!(node instanceof Expression)) { continue; } Expression childExpr = (Expression) node; checkMethodNames(childExpr); } }
[ "private", "void", "checkMethodNames", "(", "Expression", "expression", ")", "{", "if", "(", "expression", "instanceof", "MethodCallExpr", ")", "{", "MethodCallExpr", "methodCall", "=", "(", "(", "MethodCallExpr", ")", "expression", ")", ";", "if", "(", "!", "...
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. @param expression The expression to check
[ "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",...
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java#L754-L776
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/factory/AbstractVueComponentFactoryGenerator.java
AbstractVueComponentFactoryGenerator.createStaticGetMethod
private void createStaticGetMethod(TypeElement component, ClassName vueFactoryClassName, Builder vueFactoryBuilder, List<CodeBlock> staticInitParameters) { MethodSpec.Builder getBuilder = MethodSpec .methodBuilder("get") .addModifiers(Modifier.STATIC, Modifier.PUBLIC) .returns(vueFactoryClassName); getBuilder.beginControlFlow("if ($L == null)", INSTANCE_PROP); getBuilder.addStatement("$L = new $T()", INSTANCE_PROP, vueFactoryClassName); if (hasTemplate(processingEnv, component)) { getBuilder.addStatement("$L.injectComponentCss($T.getScopedCss())", INSTANCE_PROP, componentExposedTypeName(component)); } getBuilder.addCode("$L.init(", INSTANCE_PROP); boolean isFirst = true; for (CodeBlock staticInitParameter : staticInitParameters) { if (!isFirst) { getBuilder.addCode(", "); } getBuilder.addCode(staticInitParameter); isFirst = false; } getBuilder.addCode(");"); getBuilder.endControlFlow(); getBuilder.addStatement("return $L", INSTANCE_PROP); vueFactoryBuilder.addMethod(getBuilder.build()); }
java
private void createStaticGetMethod(TypeElement component, ClassName vueFactoryClassName, Builder vueFactoryBuilder, List<CodeBlock> staticInitParameters) { MethodSpec.Builder getBuilder = MethodSpec .methodBuilder("get") .addModifiers(Modifier.STATIC, Modifier.PUBLIC) .returns(vueFactoryClassName); getBuilder.beginControlFlow("if ($L == null)", INSTANCE_PROP); getBuilder.addStatement("$L = new $T()", INSTANCE_PROP, vueFactoryClassName); if (hasTemplate(processingEnv, component)) { getBuilder.addStatement("$L.injectComponentCss($T.getScopedCss())", INSTANCE_PROP, componentExposedTypeName(component)); } getBuilder.addCode("$L.init(", INSTANCE_PROP); boolean isFirst = true; for (CodeBlock staticInitParameter : staticInitParameters) { if (!isFirst) { getBuilder.addCode(", "); } getBuilder.addCode(staticInitParameter); isFirst = false; } getBuilder.addCode(");"); getBuilder.endControlFlow(); getBuilder.addStatement("return $L", INSTANCE_PROP); vueFactoryBuilder.addMethod(getBuilder.build()); }
[ "private", "void", "createStaticGetMethod", "(", "TypeElement", "component", ",", "ClassName", "vueFactoryClassName", ",", "Builder", "vueFactoryBuilder", ",", "List", "<", "CodeBlock", ">", "staticInitParameters", ")", "{", "MethodSpec", ".", "Builder", "getBuilder", ...
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. @param component The Component we generate for @param vueFactoryClassName The type name of our generated {@link VueComponentFactory} @param vueFactoryBuilder The builder to create our {@link VueComponentFactory} class @param staticInitParameters Parameters from the init method when called on static
[ "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", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/factory/AbstractVueComponentFactoryGenerator.java#L164-L197
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/result/TemplateParserResult.java
TemplateParserResult.addExpression
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, parameters, context.getCurrentLine().orElse(null)); this.expressions.add(templateExpression); return templateExpression; }
java
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, parameters, context.getCurrentLine().orElse(null)); this.expressions.add(templateExpression); return templateExpression; }
[ "public", "TemplateExpression", "addExpression", "(", "String", "expression", ",", "TypeName", "expressionType", ",", "boolean", "shouldCast", ",", "List", "<", "VariableInfo", ">", "parameters", ")", "{", "String", "id", "=", "\"exp$\"", "+", "this", ".", "expr...
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. @param expression The Java expression @param expressionType The type of the expression, determined depending on the context it is used in. @param shouldCast Should the expression be cast to the given expressionType @param parameters The parameters this expression depends on (can be empty) @return The {@link TemplateExpression} for this Java expression, will be used to get the string to put in the template instead.
[ "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", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/result/TemplateParserResult.java#L68-L81
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/result/TemplateParserResult.java
TemplateParserResult.addRef
public void addRef(String name, TypeMirror elementType, boolean isArray) { refs.add(new RefInfo(name, elementType, isArray)); }
java
public void addRef(String name, TypeMirror elementType, boolean isArray) { refs.add(new RefInfo(name, elementType, isArray)); }
[ "public", "void", "addRef", "(", "String", "name", ",", "TypeMirror", "elementType", ",", "boolean", "isArray", ")", "{", "refs", ".", "add", "(", "new", "RefInfo", "(", "name", ",", "elementType", ",", "isArray", ")", ")", ";", "}" ]
Register a ref found in the template @param name The name of the ref @param elementType The type of the element the Ref is on @param isArray Whether the ref is in a v-for (should be an array)
[ "Register", "a", "ref", "found", "in", "the", "template" ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/result/TemplateParserResult.java#L97-L99
train
VueGWT/vue-gwt
core/src/main/java/com/axellience/vuegwt/core/client/tools/VueGWTTools.java
VueGWTTools.escapeStringForJsRegexp
public static String escapeStringForJsRegexp(String input) { JsString string = uncheckedCast(input); return string.replace(ESCAPE_JS_STRING_REGEXP, "\\$&"); }
java
public static String escapeStringForJsRegexp(String input) { JsString string = uncheckedCast(input); return string.replace(ESCAPE_JS_STRING_REGEXP, "\\$&"); }
[ "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 @param input The String we want to escape @return The escaped String
[ "Escape", "a", "String", "to", "be", "used", "in", "a", "JsRegexp", "as", "a", "String", "literal" ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/core/src/main/java/com/axellience/vuegwt/core/client/tools/VueGWTTools.java#L218-L221
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/factory/VueComponentFactoryGenerator.java
VueComponentFactoryGenerator.registerLocalDirectives
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.addStatement("directives.set($S, new $T())", directiveToTagName(clazz.getName()), directiveOptionsName(clazz))); } catch (MirroredTypesException mte) { List<DeclaredType> classTypeMirrors = (List<DeclaredType>) mte.getTypeMirrors(); if (!classTypeMirrors.isEmpty()) { addGetDirectivesStatement(initBuilder); } classTypeMirrors.forEach(classTypeMirror -> { TypeElement classTypeElement = (TypeElement) classTypeMirror.asElement(); initBuilder.addStatement("directives.set($S, new $T())", directiveToTagName(classTypeElement.getSimpleName().toString()), directiveOptionsName(classTypeElement)); }); } }
java
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.addStatement("directives.set($S, new $T())", directiveToTagName(clazz.getName()), directiveOptionsName(clazz))); } catch (MirroredTypesException mte) { List<DeclaredType> classTypeMirrors = (List<DeclaredType>) mte.getTypeMirrors(); if (!classTypeMirrors.isEmpty()) { addGetDirectivesStatement(initBuilder); } classTypeMirrors.forEach(classTypeMirror -> { TypeElement classTypeElement = (TypeElement) classTypeMirror.asElement(); initBuilder.addStatement("directives.set($S, new $T())", directiveToTagName(classTypeElement.getSimpleName().toString()), directiveOptionsName(classTypeElement)); }); } }
[ "private", "void", "registerLocalDirectives", "(", "Component", "annotation", ",", "MethodSpec", ".", "Builder", "initBuilder", ")", "{", "try", "{", "Class", "<", "?", ">", "[", "]", "componentsClass", "=", "annotation", ".", "directives", "(", ")", ";", "i...
Register directives passed to the annotation. @param annotation The Component annotation on the Component we generate for @param initBuilder The builder for the init method
[ "Register", "directives", "passed", "to", "the", "annotation", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/factory/VueComponentFactoryGenerator.java#L179-L206
train
VueGWT/vue-gwt
core/src/main/java/com/axellience/vuegwt/core/client/component/options/VueComponentOptions.java
VueComponentOptions.initRenderFunctions
@JsOverlay public final void initRenderFunctions(Function renderFunctionString, Function[] staticRenderFnsStrings) { this.setRender(renderFunctionString); this.setStaticRenderFns(cast(staticRenderFnsStrings)); }
java
@JsOverlay public final void initRenderFunctions(Function renderFunctionString, Function[] staticRenderFnsStrings) { this.setRender(renderFunctionString); this.setStaticRenderFns(cast(staticRenderFnsStrings)); }
[ "@", "JsOverlay", "public", "final", "void", "initRenderFunctions", "(", "Function", "renderFunctionString", ",", "Function", "[", "]", "staticRenderFnsStrings", ")", "{", "this", ".", "setRender", "(", "renderFunctionString", ")", ";", "this", ".", "setStaticRender...
Initialise the render functions from our template. @param renderFunctionString The render function @param staticRenderFnsStrings The static render functions
[ "Initialise", "the", "render", "functions", "from", "our", "template", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/core/src/main/java/com/axellience/vuegwt/core/client/component/options/VueComponentOptions.java#L68-L73
train
VueGWT/vue-gwt
core/src/main/java/com/axellience/vuegwt/core/client/component/options/VueComponentOptions.java
VueComponentOptions.initData
@JsOverlay 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 field name starts with $ or _ Vue.js won't proxify it so we must do it if (fieldName.startsWith("$") || fieldName.startsWith("_")) { dataFieldsToProxy.add(fieldName); } } if (useFactory) { String dataFieldsJSON = JSON.stringify(dataFields); this.setData((DataFactory) () -> JSON.parse(dataFieldsJSON)); } else { this.setData((DataFactory) () -> dataFields); } }
java
@JsOverlay 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 field name starts with $ or _ Vue.js won't proxify it so we must do it if (fieldName.startsWith("$") || fieldName.startsWith("_")) { dataFieldsToProxy.add(fieldName); } } if (useFactory) { String dataFieldsJSON = JSON.stringify(dataFields); this.setData((DataFactory) () -> JSON.parse(dataFieldsJSON)); } else { this.setData((DataFactory) () -> dataFields); } }
[ "@", "JsOverlay", "public", "final", "void", "initData", "(", "boolean", "useFactory", ",", "Set", "<", "String", ">", "fieldNames", ")", "{", "JsPropertyMap", "<", "Object", ">", "dataFields", "=", "JsPropertyMap", ".", "of", "(", ")", ";", "dataFieldsToPro...
Initialise the data structure, then set it to either a Factory or directly on the Component. @param useFactory Boolean representing whether or not to use a Factory. @param fieldNames Name of the data fields in the object
[ "Initialise", "the", "data", "structure", "then", "set", "it", "to", "either", "a", "Factory", "or", "directly", "on", "the", "Component", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/core/src/main/java/com/axellience/vuegwt/core/client/component/options/VueComponentOptions.java#L81-L100
train
VueGWT/vue-gwt
core/src/main/java/com/axellience/vuegwt/core/client/component/options/VueComponentOptions.java
VueComponentOptions.addJavaComputed
@JsOverlay public final void addJavaComputed(Function javaMethod, String computedPropertyName, ComputedKind kind) { ComputedOptions computedDefinition = getComputedOptions(computedPropertyName); if (computedDefinition == null) { computedDefinition = new ComputedOptions(); addComputedOptions(computedPropertyName, computedDefinition); } if (kind == ComputedKind.GETTER) { computedDefinition.get = javaMethod; } else if (kind == ComputedKind.SETTER) { computedDefinition.set = javaMethod; } }
java
@JsOverlay public final void addJavaComputed(Function javaMethod, String computedPropertyName, ComputedKind kind) { ComputedOptions computedDefinition = getComputedOptions(computedPropertyName); if (computedDefinition == null) { computedDefinition = new ComputedOptions(); addComputedOptions(computedPropertyName, computedDefinition); } if (kind == ComputedKind.GETTER) { computedDefinition.get = javaMethod; } else if (kind == ComputedKind.SETTER) { computedDefinition.set = javaMethod; } }
[ "@", "JsOverlay", "public", "final", "void", "addJavaComputed", "(", "Function", "javaMethod", ",", "String", "computedPropertyName", ",", "ComputedKind", "kind", ")", "{", "ComputedOptions", "computedDefinition", "=", "getComputedOptions", "(", "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. @param javaMethod Function pointer to the method in the {@link IsVueComponent} @param computedPropertyName Name of the computed property in the Template and the ComponentOptions @param kind Kind of the computed method (getter or setter)
[ "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", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/core/src/main/java/com/axellience/vuegwt/core/client/component/options/VueComponentOptions.java#L111-L125
train
VueGWT/vue-gwt
core/src/main/java/com/axellience/vuegwt/core/client/component/options/VueComponentOptions.java
VueComponentOptions.addJavaWatch
@JsOverlay 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", javaMethod); watchDefinition.set("deep", isDeep); watchDefinition.set("immediate", isImmediate); addWatch(watchedPropertyName, watchDefinition); }
java
@JsOverlay 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", javaMethod); watchDefinition.set("deep", isDeep); watchDefinition.set("immediate", isImmediate); addWatch(watchedPropertyName, watchDefinition); }
[ "@", "JsOverlay", "public", "final", "void", "addJavaWatch", "(", "Function", "javaMethod", ",", "String", "watchedPropertyName", ",", "boolean", "isDeep", ",", "boolean", "isImmediate", ")", "{", "if", "(", "!", "isDeep", "&&", "!", "isImmediate", ")", "{", ...
Add a watch property to this Component Definition @param javaMethod Function pointer to the method in the {@link IsVueComponent} @param watchedPropertyName Name of the property name to watch in the data model @param isDeep Is the watcher deep (will watch child properties) @param isImmediate Is the watcher immediate (will trigger on initial value)
[ "Add", "a", "watch", "property", "to", "this", "Component", "Definition" ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/core/src/main/java/com/axellience/vuegwt/core/client/component/options/VueComponentOptions.java#L135-L148
train
VueGWT/vue-gwt
core/src/main/java/com/axellience/vuegwt/core/client/component/options/VueComponentOptions.java
VueComponentOptions.addJavaProp
@JsOverlay 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) { propDefinition.type = ((JsPropertyMap<Object>) DomGlobal.window).get(exposedTypeName); } propsToProxy.add(new PropProxyDefinition(propName, fieldName)); addProp(propName, propDefinition); }
java
@JsOverlay 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) { propDefinition.type = ((JsPropertyMap<Object>) DomGlobal.window).get(exposedTypeName); } propsToProxy.add(new PropProxyDefinition(propName, fieldName)); addProp(propName, propDefinition); }
[ "@", "JsOverlay", "public", "final", "void", "addJavaProp", "(", "String", "propName", ",", "String", "fieldName", ",", "boolean", "required", ",", "String", "exposedTypeName", ")", "{", "if", "(", "propsToProxy", "==", "null", ")", "{", "propsToProxy", "=", ...
Add a prop to our ComponentOptions. This will allow to receive data from the outside of our Component. @param propName The name of the prop @param fieldName The name of the java field for that prop @param required Is the property required (mandatory) @param exposedTypeName JS name of the type of this property, if not null we will ask Vue to type check based on it
[ "Add", "a", "prop", "to", "our", "ComponentOptions", ".", "This", "will", "allow", "to", "receive", "data", "from", "the", "outside", "of", "our", "Component", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/core/src/main/java/com/axellience/vuegwt/core/client/component/options/VueComponentOptions.java#L171-L187
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/ComponentTemplateProcessor.java
ComponentTemplateProcessor.findLocalComponentsForComponent
private void findLocalComponentsForComponent(LocalComponents localComponents, TypeElement componentTypeElement) { Component componentAnnotation = componentTypeElement.getAnnotation(Component.class); if (componentAnnotation == null) { return; } processLocalComponentClass(localComponents, componentTypeElement); getComponentLocalComponents(elements, componentTypeElement) .stream() .map(DeclaredType.class::cast) .map(DeclaredType::asElement) .map(TypeElement.class::cast) .forEach(childTypeElement -> processLocalComponentClass(localComponents, childTypeElement)); getSuperComponentType(componentTypeElement) .ifPresent(superComponentType -> findLocalComponentsForComponent( localComponents, superComponentType)); }
java
private void findLocalComponentsForComponent(LocalComponents localComponents, TypeElement componentTypeElement) { Component componentAnnotation = componentTypeElement.getAnnotation(Component.class); if (componentAnnotation == null) { return; } processLocalComponentClass(localComponents, componentTypeElement); getComponentLocalComponents(elements, componentTypeElement) .stream() .map(DeclaredType.class::cast) .map(DeclaredType::asElement) .map(TypeElement.class::cast) .forEach(childTypeElement -> processLocalComponentClass(localComponents, childTypeElement)); getSuperComponentType(componentTypeElement) .ifPresent(superComponentType -> findLocalComponentsForComponent( localComponents, superComponentType)); }
[ "private", "void", "findLocalComponentsForComponent", "(", "LocalComponents", "localComponents", ",", "TypeElement", "componentTypeElement", ")", "{", "Component", "componentAnnotation", "=", "componentTypeElement", ".", "getAnnotation", "(", "Component", ".", "class", ")",...
Register all locally declared components. @param localComponents The {@link LocalComponents} where we register our local components @param componentTypeElement The class to process
[ "Register", "all", "locally", "declared", "components", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/ComponentTemplateProcessor.java#L186-L206
train
VueGWT/vue-gwt
core/src/main/java/com/axellience/vuegwt/core/client/observer/VueGWTObserverManager.java
VueGWTObserverManager.customizeVueObserverPrototype
public void customizeVueObserverPrototype(VueObserver vueObserver) { vueObserveArrayFunction = vueObserver.getObserveArray(); vueWalkFunction = vueObserver.getWalk(); vueObserver.setWalk(toObserve -> { if (observeJavaObject(toObserve)) { return; } vueWalkFunction.call(this, toObserve); }); }
java
public void customizeVueObserverPrototype(VueObserver vueObserver) { vueObserveArrayFunction = vueObserver.getObserveArray(); vueWalkFunction = vueObserver.getWalk(); vueObserver.setWalk(toObserve -> { if (observeJavaObject(toObserve)) { return; } vueWalkFunction.call(this, toObserve); }); }
[ "public", "void", "customizeVueObserverPrototype", "(", "VueObserver", "vueObserver", ")", "{", "vueObserveArrayFunction", "=", "vueObserver", ".", "getObserveArray", "(", ")", ";", "vueWalkFunction", "=", "vueObserver", ".", "getWalk", "(", ")", ";", "vueObserver", ...
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. @param vueObserver A {@link VueObserver}
[ "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", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/core/src/main/java/com/axellience/vuegwt/core/client/observer/VueGWTObserverManager.java#L135-L146
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/utils/InjectedDependenciesUtil.java
InjectedDependenciesUtil.hasInjectAnnotation
public static boolean hasInjectAnnotation(Element element) { for (AnnotationMirror annotationMirror : element.getAnnotationMirrors()) { String annotationQualifiedName = annotationMirror.getAnnotationType().toString(); if (annotationQualifiedName.equals(Inject.class.getCanonicalName())) { return true; } if (annotationQualifiedName.equals("com.google.inject.Inject")) { return true; } } return false; }
java
public static boolean hasInjectAnnotation(Element element) { for (AnnotationMirror annotationMirror : element.getAnnotationMirrors()) { String annotationQualifiedName = annotationMirror.getAnnotationType().toString(); if (annotationQualifiedName.equals(Inject.class.getCanonicalName())) { return true; } if (annotationQualifiedName.equals("com.google.inject.Inject")) { return true; } } return false; }
[ "public", "static", "boolean", "hasInjectAnnotation", "(", "Element", "element", ")", "{", "for", "(", "AnnotationMirror", "annotationMirror", ":", "element", ".", "getAnnotationMirrors", "(", ")", ")", "{", "String", "annotationQualifiedName", "=", "annotationMirror"...
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 @param element The element we want to check @return True if has an Inject annotation, false otherwise
[ "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", ...
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/utils/InjectedDependenciesUtil.java#L38-L49
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/directive/VueDirectiveOptionsGenerator.java
VueDirectiveOptionsGenerator.generate
public void generate(TypeElement directiveTypeElement) { ClassName optionsClassName = GeneratorsNameUtil.directiveOptionsName(directiveTypeElement); Builder componentClassBuilder = TypeSpec .classBuilder(optionsClassName) .addModifiers(Modifier.PUBLIC, Modifier.FINAL) .superclass(VueDirectiveOptions.class) .addAnnotation(JsType.class) .addJavadoc("VueComponent Directive Options for directive {@link $S}", directiveTypeElement.getQualifiedName().toString()); // Initialize constructor MethodSpec.Builder constructorBuilder = MethodSpec.constructorBuilder().addModifiers(Modifier.PUBLIC); // Add the Java Component Instance initialization constructorBuilder.addStatement("this.$L = new $T()", "vuegwt$javaDirectiveInstance", TypeName.get(directiveTypeElement.asType())); // Call the method to copy hooks functions constructorBuilder.addStatement("this.copyHooks()"); // Finish building the constructor componentClassBuilder.addMethod(constructorBuilder.build()); // Build the DirectiveOptions class GeneratorsUtil.toJavaFile(filer, componentClassBuilder, optionsClassName, directiveTypeElement); }
java
public void generate(TypeElement directiveTypeElement) { ClassName optionsClassName = GeneratorsNameUtil.directiveOptionsName(directiveTypeElement); Builder componentClassBuilder = TypeSpec .classBuilder(optionsClassName) .addModifiers(Modifier.PUBLIC, Modifier.FINAL) .superclass(VueDirectiveOptions.class) .addAnnotation(JsType.class) .addJavadoc("VueComponent Directive Options for directive {@link $S}", directiveTypeElement.getQualifiedName().toString()); // Initialize constructor MethodSpec.Builder constructorBuilder = MethodSpec.constructorBuilder().addModifiers(Modifier.PUBLIC); // Add the Java Component Instance initialization constructorBuilder.addStatement("this.$L = new $T()", "vuegwt$javaDirectiveInstance", TypeName.get(directiveTypeElement.asType())); // Call the method to copy hooks functions constructorBuilder.addStatement("this.copyHooks()"); // Finish building the constructor componentClassBuilder.addMethod(constructorBuilder.build()); // Build the DirectiveOptions class GeneratorsUtil.toJavaFile(filer, componentClassBuilder, optionsClassName, directiveTypeElement); }
[ "public", "void", "generate", "(", "TypeElement", "directiveTypeElement", ")", "{", "ClassName", "optionsClassName", "=", "GeneratorsNameUtil", ".", "directiveOptionsName", "(", "directiveTypeElement", ")", ";", "Builder", "componentClassBuilder", "=", "TypeSpec", ".", ...
Generate and save the Java file for the typeElement passed to the constructor @param directiveTypeElement The {@link VueDirective} class to generate {@link VueDirectiveOptions} from
[ "Generate", "and", "save", "the", "Java", "file", "for", "the", "typeElement", "passed", "to", "the", "constructor" ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/directive/VueDirectiveOptionsGenerator.java#L40-L71
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java
ComponentExposedTypeGenerator.exposeExposedFieldsToJs
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()", field.getName(), FieldsExposer.class) ); exposeFieldMethod .addStatement( "$T.e($L)", FieldsExposer.class, String.join( ",", fieldsWithNameExposed.stream() .map(ExposedField::getName) .collect(Collectors.toList()) ) ); componentExposedTypeBuilder.addMethod(exposeFieldMethod.build()); }
java
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()", field.getName(), FieldsExposer.class) ); exposeFieldMethod .addStatement( "$T.e($L)", FieldsExposer.class, String.join( ",", fieldsWithNameExposed.stream() .map(ExposedField::getName) .collect(Collectors.toList()) ) ); componentExposedTypeBuilder.addMethod(exposeFieldMethod.build()); }
[ "private", "void", "exposeExposedFieldsToJs", "(", ")", "{", "if", "(", "fieldsWithNameExposed", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "MethodSpec", ".", "Builder", "exposeFieldMethod", "=", "MethodSpec", ".", "methodBuilder", "(", "\"vg$ef\"",...
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.
[ "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", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java#L290-L318
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java
ComponentExposedTypeGenerator.processComputed
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(method); String fieldName = computedPropertyNameToFieldName(getComputedPropertyName(method)); TypeMirror propertyType = getComputedPropertyTypeFromMethod(method); fieldsWithNameExposed.add(new ExposedField(fieldName, propertyType)); optionsBuilder.addStatement( "options.addJavaComputed(p.$L, $T.getFieldName(this, () -> this.$L = $L), $T.$L)", exposedMethodName, VueGWTTools.class, fieldName, getFieldMarkingValueForType(propertyType), ComputedKind.class, kind ); }); addFieldsForComputedMethod(component, new HashSet<>()); }
java
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(method); String fieldName = computedPropertyNameToFieldName(getComputedPropertyName(method)); TypeMirror propertyType = getComputedPropertyTypeFromMethod(method); fieldsWithNameExposed.add(new ExposedField(fieldName, propertyType)); optionsBuilder.addStatement( "options.addJavaComputed(p.$L, $T.getFieldName(this, () -> this.$L = $L), $T.$L)", exposedMethodName, VueGWTTools.class, fieldName, getFieldMarkingValueForType(propertyType), ComputedKind.class, kind ); }); addFieldsForComputedMethod(component, new HashSet<>()); }
[ "private", "void", "processComputed", "(", ")", "{", "getMethodsWithAnnotation", "(", "component", ",", "Computed", ".", "class", ")", ".", "forEach", "(", "method", "->", "{", "ComputedKind", "kind", "=", "ComputedKind", ".", "GETTER", ";", "if", "(", "\"vo...
Process computed properties from the Component Class.
[ "Process", "computed", "properties", "from", "the", "Component", "Class", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java#L351-L374
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java
ComponentExposedTypeGenerator.addFieldsForComputedMethod
private void addFieldsForComputedMethod(TypeElement component, Set<String> alreadyDone) { getMethodsWithAnnotation(component, Computed.class).forEach(method -> { String propertyName = computedPropertyNameToFieldName(getComputedPropertyName(method)); if (alreadyDone.contains(propertyName)) { return; } TypeMirror propertyType = getComputedPropertyTypeFromMethod(method); componentExposedTypeBuilder .addField(FieldSpec .builder(TypeName.get(propertyType), propertyName, Modifier.PROTECTED) .addAnnotation(JsProperty.class) .build()); alreadyDone.add(propertyName); }); getSuperComponentType(component) .ifPresent(superComponent -> addFieldsForComputedMethod(superComponent, alreadyDone)); }
java
private void addFieldsForComputedMethod(TypeElement component, Set<String> alreadyDone) { getMethodsWithAnnotation(component, Computed.class).forEach(method -> { String propertyName = computedPropertyNameToFieldName(getComputedPropertyName(method)); if (alreadyDone.contains(propertyName)) { return; } TypeMirror propertyType = getComputedPropertyTypeFromMethod(method); componentExposedTypeBuilder .addField(FieldSpec .builder(TypeName.get(propertyType), propertyName, Modifier.PROTECTED) .addAnnotation(JsProperty.class) .build()); alreadyDone.add(propertyName); }); getSuperComponentType(component) .ifPresent(superComponent -> addFieldsForComputedMethod(superComponent, alreadyDone)); }
[ "private", "void", "addFieldsForComputedMethod", "(", "TypeElement", "component", ",", "Set", "<", "String", ">", "alreadyDone", ")", "{", "getMethodsWithAnnotation", "(", "component", ",", "Computed", ".", "class", ")", ".", "forEach", "(", "method", "->", "{",...
Add fields for computed methods so they are visible in the template @param component Component we are currently processing @param alreadyDone Already processed computed properties (in case there is a getter and a
[ "Add", "fields", "for", "computed", "methods", "so", "they", "are", "visible", "in", "the", "template" ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java#L415-L436
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java
ComponentExposedTypeGenerator.processWatchers
private void processWatchers(MethodSpec.Builder createdMethodBuilder) { createdMethodBuilder.addStatement("Proto p = __proto__"); getMethodsWithAnnotation(component, Watch.class) .forEach(method -> processWatcher(createdMethodBuilder, method)); }
java
private void processWatchers(MethodSpec.Builder createdMethodBuilder) { createdMethodBuilder.addStatement("Proto p = __proto__"); getMethodsWithAnnotation(component, Watch.class) .forEach(method -> processWatcher(createdMethodBuilder, method)); }
[ "private", "void", "processWatchers", "(", "MethodSpec", ".", "Builder", "createdMethodBuilder", ")", "{", "createdMethodBuilder", ".", "addStatement", "(", "\"Proto p = __proto__\"", ")", ";", "getMethodsWithAnnotation", "(", "component", ",", "Watch", ".", "class", ...
Process watchers from the Component Class. @param createdMethodBuilder Builder for the created hook method
[ "Process", "watchers", "from", "the", "Component", "Class", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java#L453-L457
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java
ComponentExposedTypeGenerator.processWatcher
private void processWatcher(MethodSpec.Builder createdMethodBuilder, ExecutableElement method) { Watch watch = method.getAnnotation(Watch.class); String exposedMethodName = exposeExistingJavaMethodToJs(method); String watcherTriggerMethodName = addNewMethodToProto(); MethodSpec.Builder watcherMethodBuilder = MethodSpec .methodBuilder(watcherTriggerMethodName) .addModifiers(Modifier.PUBLIC) .addAnnotation(JsMethod.class) .returns(Object.class); String[] valueSplit = watch.value().split("\\."); String currentExpression = ""; for (int i = 0; i < valueSplit.length - 1; i++) { currentExpression += valueSplit[i]; watcherMethodBuilder.addStatement("if ($L == null) return null", currentExpression); currentExpression += "."; } watcherMethodBuilder.addStatement("return $L", watch.value()); componentExposedTypeBuilder.addMethod(watcherMethodBuilder.build()); createdMethodBuilder .addStatement("vue().$L(p.$L, p.$L, $T.of($L, $L))", "$watch", watcherTriggerMethodName, exposedMethodName, WatchOptions.class, watch.isDeep(), watch.isImmediate()); }
java
private void processWatcher(MethodSpec.Builder createdMethodBuilder, ExecutableElement method) { Watch watch = method.getAnnotation(Watch.class); String exposedMethodName = exposeExistingJavaMethodToJs(method); String watcherTriggerMethodName = addNewMethodToProto(); MethodSpec.Builder watcherMethodBuilder = MethodSpec .methodBuilder(watcherTriggerMethodName) .addModifiers(Modifier.PUBLIC) .addAnnotation(JsMethod.class) .returns(Object.class); String[] valueSplit = watch.value().split("\\."); String currentExpression = ""; for (int i = 0; i < valueSplit.length - 1; i++) { currentExpression += valueSplit[i]; watcherMethodBuilder.addStatement("if ($L == null) return null", currentExpression); currentExpression += "."; } watcherMethodBuilder.addStatement("return $L", watch.value()); componentExposedTypeBuilder.addMethod(watcherMethodBuilder.build()); createdMethodBuilder .addStatement("vue().$L(p.$L, p.$L, $T.of($L, $L))", "$watch", watcherTriggerMethodName, exposedMethodName, WatchOptions.class, watch.isDeep(), watch.isImmediate()); }
[ "private", "void", "processWatcher", "(", "MethodSpec", ".", "Builder", "createdMethodBuilder", ",", "ExecutableElement", "method", ")", "{", "Watch", "watch", "=", "method", ".", "getAnnotation", "(", "Watch", ".", "class", ")", ";", "String", "exposedMethodName"...
Process a watcher from the Component Class. @param createdMethodBuilder Builder for the created hook method @param method The method we are currently processing
[ "Process", "a", "watcher", "from", "the", "Component", "Class", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java#L465-L494
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java
ComponentExposedTypeGenerator.processPropValidators
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 " + method.getSimpleName() + " annotated with PropValidator must return a boolean."); } String exposedMethodName = exposeExistingJavaMethodToJs(method); String propertyName = propValidator.value(); optionsBuilder.addStatement("options.addJavaPropValidator(p.$L, $S)", exposedMethodName, propertyName); }); }
java
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 " + method.getSimpleName() + " annotated with PropValidator must return a boolean."); } String exposedMethodName = exposeExistingJavaMethodToJs(method); String propertyName = propValidator.value(); optionsBuilder.addStatement("options.addJavaPropValidator(p.$L, $S)", exposedMethodName, propertyName); }); }
[ "private", "void", "processPropValidators", "(", ")", "{", "getMethodsWithAnnotation", "(", "component", ",", "PropValidator", ".", "class", ")", ".", "forEach", "(", "method", "->", "{", "PropValidator", "propValidator", "=", "method", ".", "getAnnotation", "(", ...
Process prop validators from the Component Class.
[ "Process", "prop", "validators", "from", "the", "Component", "Class", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java#L499-L515
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java
ComponentExposedTypeGenerator.processPropDefaultValues
private void processPropDefaultValues() { getMethodsWithAnnotation(component, PropDefault.class).forEach(method -> { PropDefault propValidator = method.getAnnotation(PropDefault.class); String exposedMethodName = exposeExistingJavaMethodToJs(method); String propertyName = propValidator.value(); optionsBuilder.addStatement("options.addJavaPropDefaultValue(p.$L, $S)", exposedMethodName, propertyName); }); }
java
private void processPropDefaultValues() { getMethodsWithAnnotation(component, PropDefault.class).forEach(method -> { PropDefault propValidator = method.getAnnotation(PropDefault.class); String exposedMethodName = exposeExistingJavaMethodToJs(method); String propertyName = propValidator.value(); optionsBuilder.addStatement("options.addJavaPropDefaultValue(p.$L, $S)", exposedMethodName, propertyName); }); }
[ "private", "void", "processPropDefaultValues", "(", ")", "{", "getMethodsWithAnnotation", "(", "component", ",", "PropDefault", ".", "class", ")", ".", "forEach", "(", "method", "->", "{", "PropDefault", "propValidator", "=", "method", ".", "getAnnotation", "(", ...
Process prop default values from the Component Class.
[ "Process", "prop", "default", "values", "from", "the", "Component", "Class", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java#L520-L530
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java
ComponentExposedTypeGenerator.processHooks
private void processHooks(Set<ExecutableElement> hookMethodsFromInterfaces) { ElementFilter .methodsIn(component.getEnclosedElements()) .stream() .filter(method -> isHookMethod(component, method, hookMethodsFromInterfaces)) // Created hook is already added by createCreatedHook .filter(method -> !"created".equals(method.getSimpleName().toString())) .forEach(method -> { String exposedMethodName = exposeExistingJavaMethodToJs(method); String methodName = method.getSimpleName().toString(); optionsBuilder .addStatement("options.addHookMethod($S, p.$L)", methodName, exposedMethodName); }); }
java
private void processHooks(Set<ExecutableElement> hookMethodsFromInterfaces) { ElementFilter .methodsIn(component.getEnclosedElements()) .stream() .filter(method -> isHookMethod(component, method, hookMethodsFromInterfaces)) // Created hook is already added by createCreatedHook .filter(method -> !"created".equals(method.getSimpleName().toString())) .forEach(method -> { String exposedMethodName = exposeExistingJavaMethodToJs(method); String methodName = method.getSimpleName().toString(); optionsBuilder .addStatement("options.addHookMethod($S, p.$L)", methodName, exposedMethodName); }); }
[ "private", "void", "processHooks", "(", "Set", "<", "ExecutableElement", ">", "hookMethodsFromInterfaces", ")", "{", "ElementFilter", ".", "methodsIn", "(", "component", ".", "getEnclosedElements", "(", ")", ")", ".", "stream", "(", ")", ".", "filter", "(", "m...
Process hook methods from the Component Class. @param hookMethodsFromInterfaces Hook methods from the interface the {@link IsVueComponent} implements
[ "Process", "hook", "methods", "from", "the", "Component", "Class", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java#L538-L551
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java
ComponentExposedTypeGenerator.getHookMethodsFromInterfaces
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()) .stream()) .filter(method -> hasAnnotation(method, HookMethod.class)) .peek(this::validateHookMethod) .collect(Collectors.toSet()); }
java
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()) .stream()) .filter(method -> hasAnnotation(method, HookMethod.class)) .peek(this::validateHookMethod) .collect(Collectors.toSet()); }
[ "private", "Set", "<", "ExecutableElement", ">", "getHookMethodsFromInterfaces", "(", ")", "{", "return", "component", ".", "getInterfaces", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "DeclaredType", ".", "class", "::", "cast", ")", ".", "map", "(...
Return all hook methods from the implemented interfaces @return Hook methods that must be overridden in the Component
[ "Return", "all", "hook", "methods", "from", "the", "implemented", "interfaces" ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java#L558-L571
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java
ComponentExposedTypeGenerator.processRenderFunction
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.class) .addParameter(CreateElementFunction.class, "createElementFunction") .addStatement("return super.render(new $T(createElementFunction))", VNodeBuilder.class) .build()); addMethodToProto("vg$render"); // Register the render method optionsBuilder.addStatement("options.addHookMethod($S, p.$L)", "render", "vg$render"); }
java
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.class) .addParameter(CreateElementFunction.class, "createElementFunction") .addStatement("return super.render(new $T(createElementFunction))", VNodeBuilder.class) .build()); addMethodToProto("vg$render"); // Register the render method optionsBuilder.addStatement("options.addHookMethod($S, p.$L)", "render", "vg$render"); }
[ "private", "void", "processRenderFunction", "(", ")", "{", "if", "(", "!", "hasInterface", "(", "processingEnv", ",", "component", ".", "asType", "(", ")", ",", "HasRender", ".", "class", ")", ")", "{", "return", ";", "}", "componentExposedTypeBuilder", ".",...
Process the render function from the Component Class if it has one.
[ "Process", "the", "render", "function", "from", "the", "Component", "Class", "if", "it", "has", "one", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java#L584-L602
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java
ComponentExposedTypeGenerator.createCreatedHook
private void createCreatedHook(ComponentInjectedDependenciesBuilder dependenciesBuilder) { String hasRunCreatedFlagName = "vg$hrc_" + getSuperComponentCount(component); componentExposedTypeBuilder .addField( FieldSpec.builder(boolean.class, hasRunCreatedFlagName, Modifier.PUBLIC) .addAnnotation(JsProperty.class) .build() ); MethodSpec.Builder createdMethodBuilder = MethodSpec.methodBuilder("vg$created") .addModifiers(Modifier.PUBLIC) .addAnnotation(JsMethod.class); // Avoid infinite recursion in case calling the Java constructor calls Vue.js constructor // This can happen when extending an existing JS component createdMethodBuilder .addStatement("if ($L) return", hasRunCreatedFlagName) .addStatement("$L = true", hasRunCreatedFlagName); createdMethodBuilder .addStatement("vue().$L().proxyFields(this)", "$options"); injectDependencies(component, dependenciesBuilder, createdMethodBuilder); initFieldsValues(component, createdMethodBuilder); processWatchers(createdMethodBuilder); if (hasInterface(processingEnv, component.asType(), HasCreated.class)) { createdMethodBuilder.addStatement("super.created()"); } componentExposedTypeBuilder.addMethod(createdMethodBuilder.build()); // Register the hook addMethodToProto("vg$created"); optionsBuilder.addStatement("options.addHookMethod($S, p.$L)", "created", "vg$created"); }
java
private void createCreatedHook(ComponentInjectedDependenciesBuilder dependenciesBuilder) { String hasRunCreatedFlagName = "vg$hrc_" + getSuperComponentCount(component); componentExposedTypeBuilder .addField( FieldSpec.builder(boolean.class, hasRunCreatedFlagName, Modifier.PUBLIC) .addAnnotation(JsProperty.class) .build() ); MethodSpec.Builder createdMethodBuilder = MethodSpec.methodBuilder("vg$created") .addModifiers(Modifier.PUBLIC) .addAnnotation(JsMethod.class); // Avoid infinite recursion in case calling the Java constructor calls Vue.js constructor // This can happen when extending an existing JS component createdMethodBuilder .addStatement("if ($L) return", hasRunCreatedFlagName) .addStatement("$L = true", hasRunCreatedFlagName); createdMethodBuilder .addStatement("vue().$L().proxyFields(this)", "$options"); injectDependencies(component, dependenciesBuilder, createdMethodBuilder); initFieldsValues(component, createdMethodBuilder); processWatchers(createdMethodBuilder); if (hasInterface(processingEnv, component.asType(), HasCreated.class)) { createdMethodBuilder.addStatement("super.created()"); } componentExposedTypeBuilder.addMethod(createdMethodBuilder.build()); // Register the hook addMethodToProto("vg$created"); optionsBuilder.addStatement("options.addHookMethod($S, p.$L)", "created", "vg$created"); }
[ "private", "void", "createCreatedHook", "(", "ComponentInjectedDependenciesBuilder", "dependenciesBuilder", ")", "{", "String", "hasRunCreatedFlagName", "=", "\"vg$hrc_\"", "+", "getSuperComponentCount", "(", "component", ")", ";", "componentExposedTypeBuilder", ".", "addFiel...
Create the "created" hook method. This method will be called on each Component when it's created. It will inject dependencies if any. @param dependenciesBuilder Builder for our component dependencies, needed here to inject the dependencies in the instance
[ "Create", "the", "created", "hook", "method", ".", "This", "method", "will", "be", "called", "on", "each", "Component", "when", "it", "s", "created", ".", "It", "will", "inject", "dependencies", "if", "any", "." ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java#L631-L667
train
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java
ComponentExposedTypeGenerator.initFieldsValues
private void initFieldsValues(TypeElement component, MethodSpec.Builder createdMethodBuilder) { // Do not init instance fields for abstract components if (component.getModifiers().contains(Modifier.ABSTRACT)) { return; } createdMethodBuilder.addStatement( "$T.initComponentInstanceFields(this, new $T())", VueGWTTools.class, component); }
java
private void initFieldsValues(TypeElement component, MethodSpec.Builder createdMethodBuilder) { // Do not init instance fields for abstract components if (component.getModifiers().contains(Modifier.ABSTRACT)) { return; } createdMethodBuilder.addStatement( "$T.initComponentInstanceFields(this, new $T())", VueGWTTools.class, component); }
[ "private", "void", "initFieldsValues", "(", "TypeElement", "component", ",", "MethodSpec", ".", "Builder", "createdMethodBuilder", ")", "{", "// Do not init instance fields for abstract components", "if", "(", "component", ".", "getModifiers", "(", ")", ".", "contains", ...
Init fields at creation by using an instance of the Java class @param component {@link IsVueComponent} to process @param createdMethodBuilder Builder for our Create method
[ "Init", "fields", "at", "creation", "by", "using", "an", "instance", "of", "the", "Java", "class" ]
961cd83aed6fe8e2dd80c279847f1b3f62918a1f
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/ComponentExposedTypeGenerator.java#L736-L746
train