当前位置: 首页>>代码示例>>Java>>正文


Java Remoter类代码示例

本文整理汇总了Java中remoter.annotations.Remoter的典型用法代码示例。如果您正苦于以下问题:Java Remoter类的具体用法?Java Remoter怎么用?Java Remoter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Remoter类属于remoter.annotations包,在下文中一共展示了Remoter类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: process

import remoter.annotations.Remoter; //导入依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment env) {
    for (Element element : env.getElementsAnnotatedWith(Remoter.class)) {
        if (element.getKind() == ElementKind.INTERFACE) {
            bindingManager.generateProxy(element);
            bindingManager.generateStub(element);
        } else {
            messager.printMessage(Diagnostic.Kind.WARNING, "@Remoter is expected only for interface. Ignoring " + element.getSimpleName());
        }
    }
    return false;
}
 
开发者ID:josesamuel,项目名称:remoter,代码行数:13,代码来源:RemoterProcessor.java

示例2: getSupportedAnnotations

import remoter.annotations.Remoter; //导入依赖的package包/类
/**
 * Only one annotation is supported at class level - @{@link Remoter}
 */
private Set<Class<? extends Annotation>> getSupportedAnnotations() {
    Set<Class<? extends Annotation>> annotations = new LinkedHashSet<>();
    annotations.add(Remoter.class);
    return annotations;
}
 
开发者ID:josesamuel,项目名称:remoter,代码行数:9,代码来源:RemoterProcessor.java

示例3: getBuilderForParam

import remoter.annotations.Remoter; //导入依赖的package包/类
/**
 * Returns the {@link ParamBuilder} that knows how to generate code for the given type of parameter
 */
ParamBuilder getBuilderForParam(TypeMirror typeMirror) {
    ParamBuilder paramBuilder = typeBuilderMap.get(typeMirror);
    if (paramBuilder == null) {
        switch (typeMirror.getKind()) {
            case BOOLEAN:
                paramBuilder = new BooleanParamBuilder(messager, null);
                break;
            case BYTE:
                paramBuilder = new ByteParamBuilder(messager, null);
                break;
            case CHAR:
                paramBuilder = new CharParamBuilder(messager, null);
                break;
            case DOUBLE:
                paramBuilder = new DoubleParamBuilder(messager, null);
                break;
            case FLOAT:
                paramBuilder = new FloatParamBuilder(messager, null);
                break;
            case INT:
                paramBuilder = new IntParamBuilder(messager, null);
                break;
            case LONG:
                paramBuilder = new LongParamBuilder(messager, null);
                break;
            case SHORT:
                paramBuilder = new ShortParamBuilder(messager, null);
                break;
            case ARRAY:
                paramBuilder = getBuilderForParam(((ArrayType) typeMirror).getComponentType());
                break;
            case DECLARED:
                TypeElement genericList = getGenericType(typeMirror);
                if (genericList != null) {
                    paramBuilder = new ListOfParcelerParamBuilder(messager, null, genericList);
                } else if (typeUtils.isAssignable(typeMirror, stringTypeMirror)) {
                    paramBuilder = new StringParamBuilder(messager, null);
                } else if (typeUtils.isAssignable(typeMirror, charSequenceTypeMirror)) {
                    paramBuilder = new CharSequenceParamBuilder(messager, null);
                } else if (typeUtils.isAssignable(typeMirror, listTypeMirror) || typeMirror.toString().equals("java.util.List<java.lang.String>")) {
                    paramBuilder = new ListParamBuilder(messager, null);
                } else if (typeUtils.isAssignable(typeMirror, mapTypeMirror)) {
                    paramBuilder = new MapParamBuilder(messager, null);
                } else if (typeUtils.isAssignable(typeMirror, parcellableTypeMirror)) {
                    paramBuilder = new ParcellableParamBuilder(messager, null);
                } else {
                    String typeName = typeMirror.toString();
                    int templateStart = typeName.indexOf('<');
                    if (templateStart != -1) {
                        typeName = typeName.substring(0, templateStart).trim();
                    }
                    TypeElement typeElement = elementUtils.getTypeElement(typeName);
                    if (typeElement != null) {
                        if (typeElement.getKind() == ElementKind.INTERFACE && typeElement.getAnnotation(Remoter.class) != null) {
                            paramBuilder = new BinderParamBuilder(messager, null);
                        } else if (parcelClass != null && typeElement.getAnnotation(parcelClass) != null) {
                            paramBuilder = new ParcelerParamBuilder(messager, null);
                        }
                    }
                }
                break;
        }
        if (paramBuilder != null) {
            paramBuilder.setBindingManager(this);
            typeBuilderMap.put(typeMirror, paramBuilder);
        } else {
            paramBuilder = new GenericParamBuilder(messager, null);
            paramBuilder.setBindingManager(this);
            typeBuilderMap.put(typeMirror, paramBuilder);
        }
    }
    return paramBuilder;
}
 
开发者ID:josesamuel,项目名称:remoter,代码行数:77,代码来源:BindingManager.java


注:本文中的remoter.annotations.Remoter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。