Search in sources :

Example 1 with ComputedKind

use of com.axellience.vuegwt.core.client.component.options.computed.ComputedKind in project vue-gwt by Axellience.

the class ComponentJsTypeGenerator method processComputed.

/**
 * Process computed properties from the Component Class.
 * @param component {@link VueComponent} to process
 * @param optionsBuilder A {@link MethodSpec.Builder} for the method that creates the
 * {@link VueComponentOptions}
 * @param componentJsTypeBuilder Builder for the JsType class
 */
private void processComputed(TypeElement component, MethodSpec.Builder optionsBuilder, Builder componentJsTypeBuilder) {
    getMethodsWithAnnotation(component, Computed.class).forEach(method -> {
        String methodName = method.getSimpleName().toString();
        ComputedKind kind = ComputedKind.GETTER;
        if ("void".equals(method.getReturnType().toString()))
            kind = ComputedKind.SETTER;
        String propertyName = GeneratorsUtil.getComputedPropertyName(method);
        optionsBuilder.addStatement("options.addJavaComputed($S, $S, $T.$L)", methodName, propertyName, ComputedKind.class, kind);
        addProxyJsTypeMethodIfNecessary(componentJsTypeBuilder, method);
    });
    addFieldsForComputedMethod(component, componentJsTypeBuilder, new HashSet<>());
}
Also used : ComputedKind(com.axellience.vuegwt.core.client.component.options.computed.ComputedKind) Computed(com.axellience.vuegwt.core.annotations.component.Computed)

Aggregations

Computed (com.axellience.vuegwt.core.annotations.component.Computed)1 ComputedKind (com.axellience.vuegwt.core.client.component.options.computed.ComputedKind)1