Beispiel #1
0
    public Decorator build() {
      String implementationName =
          implName.replace(Mapper.CLASS_NAME_PLACEHOLDER, mapperElement.getSimpleName());

      Type decoratorType = typeFactory.getType(decoratorPrism.value());
      DecoratorConstructor decoratorConstructor =
          new DecoratorConstructor(
              implementationName, implementationName + "_", hasDelegateConstructor);

      String elementPackage =
          elementUtils.getPackageOf(mapperElement).getQualifiedName().toString();
      String packageName = implPackage.replace(Mapper.PACKAGE_NAME_PLACEHOLDER, elementPackage);

      return new Decorator(
          typeFactory,
          packageName,
          implementationName,
          decoratorType,
          elementPackage,
          mapperElement.getKind() == ElementKind.INTERFACE
              ? mapperElement.getSimpleName().toString()
              : null,
          methods,
          Arrays.asList(new Field(typeFactory.getType(mapperElement), "delegate", true)),
          options,
          versionInformation,
          Accessibility.fromModifiers(mapperElement.getModifiers()),
          extraImportedTypes,
          decoratorConstructor);
    }
Beispiel #2
0
    public Mapper build() {
      String implementationName =
          implName.replace(CLASS_NAME_PLACEHOLDER, element.getSimpleName())
              + (decorator == null ? "" : "_");

      String elementPackage = elementUtils.getPackageOf(element).getQualifiedName().toString();
      String packageName = implPackage.replace(PACKAGE_NAME_PLACEHOLDER, elementPackage);

      return new Mapper(
          typeFactory,
          packageName,
          implementationName,
          element.getKind() != ElementKind.INTERFACE ? element.getSimpleName().toString() : null,
          elementPackage,
          element.getKind() == ElementKind.INTERFACE ? element.getSimpleName().toString() : null,
          customPackage,
          customName,
          mappingMethods,
          options,
          versionInformation,
          Accessibility.fromModifiers(element.getModifiers()),
          mapperReferences,
          decorator,
          extraImportedTypes);
    }
Beispiel #3
0
  @SuppressWarnings("checkstyle:parameternumber")
  private SourceMethod(
      Type declaringMapper,
      ExecutableElement executable,
      List<Parameter> parameters,
      Type returnType,
      List<Type> exceptionTypes,
      MappingOptions mappingOptions,
      Types typeUtils,
      TypeFactory typeFactory,
      MapperConfiguration config,
      List<SourceMethod> prototypeMethods,
      Type mapperToImplement) {
    this.declaringMapper = declaringMapper;
    this.executable = executable;
    this.parameters = parameters;
    this.returnType = returnType;
    this.exceptionTypes = exceptionTypes;
    this.accessibility = Accessibility.fromModifiers(executable.getModifiers());

    this.mappingOptions = mappingOptions;

    this.mappingTargetParameter = determineMappingTargetParameter(parameters);
    this.targetTypeParameter = determineTargetTypeParameter(parameters);

    this.typeUtils = typeUtils;
    this.typeFactory = typeFactory;
    this.config = config;
    this.prototypeMethods = prototypeMethods;
    this.mapperToImplement = mapperToImplement;
  }