本文整理汇总了Java中org.fusesource.restygwt.client.MethodCallback类的典型用法代码示例。如果您正苦于以下问题:Java MethodCallback类的具体用法?Java MethodCallback怎么用?Java MethodCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MethodCallback类属于org.fusesource.restygwt.client包,在下文中一共展示了MethodCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeCallService
import org.fusesource.restygwt.client.MethodCallback; //导入依赖的package包/类
@Ignore
@Test
public void executeCallService() {
doAnswer(invocationOnMock -> {
logger.info(invocationOnMock.getMock().toString());
((MethodCallback) invocationOnMock.getArguments()[0]).
onSuccess(any(Method.class), anyObject());
return null;
}).when(abstractMethodCallback)
.executeCallService(any(MethodCallback.class));
abstractMethodCallback.executeCallService(any(MethodCallback.class));
verify(abstractMethodCallback, times(1)).
onSuccess(any(Method.class), anyObject());
}
示例2: getEndereco
import org.fusesource.restygwt.client.MethodCallback; //导入依赖的package包/类
/**
* Executa a consulta de endereço a partir de um CEP.
*
* @param cep CEP da localidade onde se quer consultar o endereço. Precisa ter 8 dígitos - a formatação é feita pelo cliente.
* CEPs válidos (que contém 8 dígitos): "20930-040", "abc0 1311000xy z", "20930 040". CEPs inválidos (que não contém 8 dígitos): "00000", "abc", "123456789"
*
* @param callback O retorno da chamada ao webservice. Erros de validação de campos e de conexão são tratados no callback.
*/
public void getEndereco(String cep, MethodCallback<ViaCEPEndereco> callback){
char[] chars = cep.toCharArray();
StringBuilder builder = new StringBuilder();
for (int i = 0; i< chars.length; i++){
if (Character.isDigit(chars[i])){
builder.append(chars[i]);
}
}
cep = builder.toString();
if (cep.length() != 8){
callback.onFailure(null, new IllegalArgumentException("CEP inválido - deve conter 8 dígitos: " + cep));
return;
}
ViaCEPGWTService service = getService();
service.getEndereco(cep, callback);
}
示例3: getEnderecos
import org.fusesource.restygwt.client.MethodCallback; //导入依赖的package包/类
/**
* Executa a consulta de endereços a partir da UF, localidade e logradouro
*
* @param uf Unidade Federativa. Precisa ter 2 caracteres.
* @param localidade Localidade (p.e. município). Precisa ter ao menos 3 caracteres.
* @param logradouro Logradouro (p.e. rua, avenida, estrada). Precisa ter ao menos 3 caracteres.
*
* @param callback O retorno da chamada ao webservice. Erros de validação de campos e de conexão são tratados no callback.
*/
public void getEnderecos(String uf, String localidade, String logradouro, final MethodCallback<List<ViaCEPEndereco>> callback){
if (uf == null || uf.length() != 2){
callback.onFailure(null, new IllegalArgumentException("UF inválida - deve conter 2 caracteres: " + uf));
return;
}
if (localidade == null || localidade.length() < 3){
callback.onFailure(null, new IllegalArgumentException("Localidade inválida - deve conter pelo menos 3 caracteres: " + localidade));
return;
}
if (logradouro == null || logradouro.length() < 3){
callback.onFailure(null, new IllegalArgumentException("Logradouro inválido - deve conter pelo menos 3 caracteres: " + logradouro));
return;
}
ViaCEPGWTService service = getService();
service.getEnderecos(uf, localidade, logradouro, callback);
}
示例4: onFailure
import org.fusesource.restygwt.client.MethodCallback; //导入依赖的package包/类
@Override
public void onFailure(Method method, Throwable exception) {
fireResponseEvent(method);
boolean caught = false;
for (MethodCallback<T> methodCallback : callbackList) {
try {
methodCallback.onFailure(method, exception);
caught = true;
} catch (RuntimeException e) {
// Exception not handled.
continue;
}
}
if (!caught) {
GWT.reportUncaughtException(exception);
}
}
示例5: list
import org.fusesource.restygwt.client.MethodCallback; //导入依赖的package包/类
@GET
public Request list(
@QueryParam("type") Unit.Type type,
@QueryParam("title") String title,
@QueryParam("author") UUID authorId,
@QueryParam("lecture") UUID lectureId,
@QueryParam("count") Integer count,
@QueryParam("offset") Integer offset,
MethodCallback<List<Unit>> callback);
示例6: list
import org.fusesource.restygwt.client.MethodCallback; //导入依赖的package包/类
@GET
public Request list(
@QueryParam("title") String title,
@QueryParam("author") UUID authorId,
@QueryParam("course") UUID courseId,
@QueryParam("count") Integer count,
@QueryParam("offset") Integer offset,
MethodCallback<List<Lecture>> callback);
示例7: list
import org.fusesource.restygwt.client.MethodCallback; //导入依赖的package包/类
@GET
public Request list(
@QueryParam("title") String title,
@QueryParam("author") UUID authorId,
@QueryParam("count") Integer count,
@QueryParam("offset") Integer offset,
MethodCallback<List<Course>> callback);
示例8: list
import org.fusesource.restygwt.client.MethodCallback; //导入依赖的package包/类
@GET
public Request list(
@QueryParam("name") String name,
@QueryParam("email") String email,
@QueryParam("count") Integer count,
@QueryParam("offset") Integer offset,
MethodCallback<List<User>> callback);
示例9: getPersons
import org.fusesource.restygwt.client.MethodCallback; //导入依赖的package包/类
@Override
public void getPersons(Integer start, Integer length, MethodCallback<List<PersonDto>> callback) {
logger.info("Mock getPersons...");
List<PersonDto> personDtos = getPersonDtos();
callback.onSuccess(null, personDtos);
}
示例10: filterPerson
import org.fusesource.restygwt.client.MethodCallback; //导入依赖的package包/类
@Override
public void filterPerson(String personName, Date fromDate, Date toDate, MethodCallback<List<PersonDto>> callback) {
logger.info("Mock filterPerson...");
List<PersonDto> personDtos = getPersonDtos();
callback.onSuccess(null, personDtos);
}
示例11: filterPerson
import org.fusesource.restygwt.client.MethodCallback; //导入依赖的package包/类
@Override
@GET
@Path(DemoGwtServiceEndpoint.PERSON_FILTER)
void filterPerson(@QueryParam("nameSuggestBox") String personName,
@QueryParam("fromDateTimePicker") Date fromDate,
@QueryParam("untilDateTimePicker") Date toDate,
MethodCallback<List<PersonDto>> callback);
示例12: onSuccess
import org.fusesource.restygwt.client.MethodCallback; //导入依赖的package包/类
@Override
public void onSuccess(Method method, T response) {
fireResponseEvent(method);
for (MethodCallback<T> methodCallback : callbackList) {
methodCallback.onSuccess(method, response);
}
}
示例13: load
import org.fusesource.restygwt.client.MethodCallback; //导入依赖的package包/类
/**
* Get drawing
*
* @param dealId deal id
* @param drawingId drawing id
* @param callback callback
*/
@GET
@Path("/{userId}/{dealId}/{drawingId}")
@RequestId(LOAD_DRAWING) void load(
@PathParam("userId") Long userId,
@PathParam("dealId") Long dealId,
@PathParam("drawingId") Long drawingId,
MethodCallback<Drawing> callback);
示例14: send
import org.fusesource.restygwt.client.MethodCallback; //导入依赖的package包/类
@POST
@Path("somePath")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
void send(SomeRequest request,
MethodCallback<SomeResponse> callback);
示例15: send
import org.fusesource.restygwt.client.MethodCallback; //导入依赖的package包/类
@GET
@Path(PATH)
@Produces(MediaType.APPLICATION_JSON)
void send(@PathParam("id") @Attribute("id") SomeRequest id, @PathParam("code") @Attribute("code") SomeRequest code,
MethodCallback<SomeResponse> callback);