Tabnine Logo
DomainDeclaredType
Code IndexAdd Tabnine to your IDE (free)

How to use
DomainDeclaredType
in
sk.seges.sesam.pap.model.model.api.domain

Best Java code snippets using sk.seges.sesam.pap.model.model.api.domain.DomainDeclaredType (Showing top 20 results out of 315)

origin: sk.seges.sesam/sesam-service-converter-processor

  @Override
  public void print(ConverterProviderPrinterContext context) {

    if (types.size() == 0) {
      initializeDomainConverterMethod();
    }

    if (!types.contains(context.getRawDomain().getCanonicalName())) {
      types.add(context.getRawDomain().getCanonicalName());		
    }
  }
}
origin: sk.seges.corpis/corpis-application-scaffold-model-support

List<MutableTypeVariable> typeParams = new LinkedList<MutableTypeVariable>();
for (MutableTypeVariable typeVariable: domainType.getTypeVariables()) {
DomainDeclaredType superClass = domainType.getSuperClass();
List<? extends MutableTypeMirror> interfaces = domainDeclared.getInterfaces();
domainType.setTypeVariables(typeParams.toArray(new MutableTypeVariable[typeParams.size()]));
domainType.setSuperClass(superClass);
domainDeclared.setInterfaces(interfaces);
origin: sk.seges.sesam/sesam-model-domain-processor

  methods = ElementFilter.methodsIn(processingElement.asConfigurationElement().getEnclosedElements());
} else {
  methods = ElementFilter.methodsIn(configurationTypeElement.asConfigurationElement().getEnclosedElements());
PojoElement pojoElement = new PojoElement(domainTypeElement.asConfigurationElement(), processingEnv);
      method = processingElement.getGetterMethod(fieldName);
      result.add(method);
    } else if (!isProcessed && isGetter && !hasSetter && isPublic) {
      processingEnv.getMessager().printMessage(Kind.WARNING, "Method " + method.getSimpleName() + " does not have setter, type = " + processingElement.asConfigurationElement());
if (processingElement.getSuperClass() == null && processingElement.asConfigurationElement() != null) {
  TypeMirror superclass = processingElement.asConfigurationElement().getSuperclass();
  if (superclass.getKind().equals(TypeKind.DECLARED)) {
    result.addAll(getMethodsForProcessings(configurationTypeElement, mappingType, (DomainDeclaredType) processingEnv.getTransferObjectUtils().getDomainType(superclass), domainTypeElement, ignored));
} else if (processingElement.getSuperClass() != null) {
      processingElement.getSuperClass(), domainTypeElement, ignored);
  result.addAll(superClassMethods);
      getConfigurationsForDomain(processingElement.getSuperClass());
  if (configurationsForDomain != null && configurationsForDomain.size() > 0) {
        processingElement.getSuperClass(), processingElement.getSuperClass(), ignored);
origin: sk.seges.corpis/corpis-application-scaffold-model-support

  private DomainDeclaredType replaceTypeParamsByWildcard(DomainDeclaredType domainDeclared) {
    if (domainDeclared.getTypeVariables().size() > 0) {
      MutableTypeVariable[] typeVariables = new MutableTypeVariable[domainDeclared.getTypeVariables().size()];
      for (int i = 0; i < domainDeclared.getTypeVariables().size(); i++) {
        typeVariables[i] = envContext.getProcessingEnv().getTypeUtils().getTypeVariable(MutableWildcardType.WILDCARD_NAME);
      }
      domainDeclared.setTypeVariables(typeVariables);
    }
    return domainDeclared;
  }
}
origin: sk.seges.sesam/sesam-model-domain-processor

  protected void printDomainInstancer(FormattedPrintWriter pw, DomainDeclaredType domainTypeElement) {
    if (!entityResolver.shouldHaveIdMethod(domainTypeElement)) {
      pw.println(" return new ", domainTypeElement, "();");
    } else {
      pw.println(domainTypeElement, " " + RESULT_NAME, " = new ", domainTypeElement, "();");
      
      String setterMethod = MethodHelper.toSetter(domainTypeElement.getIdMethod(entityResolver));
      
      if (ProcessorUtils.hasMethod(setterMethod, domainTypeElement.asElement())) {
        pw.println(RESULT_NAME + "." + MethodHelper.toSetter(domainTypeElement.getIdMethod(entityResolver)) + "((", domainTypeElement.getId(entityResolver), ")" + "id);");
      } else {
        pw.println("if (id != null) {");
        pw.println("throw new ", RuntimeException.class, "(\"Unable to define ID for imutable entity. Please define " + setterMethod + " method for ", domainTypeElement, "!\");");
        pw.println("}");
      }
      pw.println("return " + RESULT_NAME + ";");
    }
  }
}
origin: sk.seges.sesam/sesam-model-domain-processor

DomainDeclaredType superClass = context.getConfigurationTypeElement().getInstantiableDomain().getSuperClass();
 if (superClass == null || ConverterProcessingHelper.isConverterGenerated(superClass.getDomainDefinitionConfiguration().asConfigurationElement(), processingEnv)) {
  return;
  DomainType instantiableDomainReference = referenceDomainType.getDomainReference(entityResolver, currentPath);
    if (referenceDomainType.getKind().isDeclared()) {
      MutableDeclaredType fieldType = processingEnv.getTypeUtils().getDeclaredType(processingEnv.getTypeUtils().toMutableType(Class.class),
          new MutableDeclaredType[] { referenceDomainType.getDto() });
      Field field = new Field("" + referenceDomainType.getDto().getSimpleName() + ".class", fieldType);
if (domainTypeElement != null && domainTypeElement.getSetterMethod(context.getDomainFieldPath()) != null) {
  printCopy(pathResolver, context, pw);
} else if (!entityResolver.isImmutable(instantiableDomainTypeElement.asElement())) {
  ExecutableElement domainGetterMethod = instantiableDomainTypeElement.getGetterMethod(currentPath);
  VariableElement field = MethodHelper.getField(instantiableDomainTypeElement.asConfigurationElement(), currentPath);
origin: sk.seges.sesam/sesam-model-domain-processor

@Override
public void initialize(ConfigurationTypeElement configurationTypeElement, MutableDeclaredType outputName) {
  MutableDeclaredType domainType = configurationTypeElement.getDomain().stripTypeParametersTypes().clone().stripTypeParameters();
  MutableDeclaredType dtoType = configurationTypeElement.getDto().stripTypeParametersTypes().clone().stripTypeParameters();
    DomainType domainId = configurationTypeElement.getDomain().getId(entityResolver);
    DomainType instantiableDomainId = configurationTypeElement.getInstantiableDomain().getId(entityResolver);
    ExecutableElement domainIdMethod = configurationTypeElement.getInstantiableDomain().getIdMethod(entityResolver);
      processingEnv.getMessager().printMessage(Kind.ERROR, configurationTypeElement.getInstantiableDomain().getCanonicalName() + " does not have an ID method implemented. Please implement ID method so equals method should be implemented.");
      return;
    ExecutableElement getterMethod = configurationTypeElement.getDomain().getGetterMethod(MethodHelper.toField(domainIdMethod));
          ProcessorUtils.erasure(processingEnv.getElementUtils().getTypeElement(configurationTypeElement.getDomain().getCanonicalName()), 
              (TypeVariable)returnIdType);
          processingEnv.getElementUtils().getTypeElement(Serializable.class.getCanonicalName()).asType())) {
        processingEnv.getMessager().printMessage(Kind.ERROR, configurationTypeElement.getDomain().getCanonicalName() + 
            " has ID that does not implement serializable! ID method should implement serializable interface.");
      converterProviderPrinter.printDomainGetConverterMethodName(domainId, field, configurationTypeElement.getInstantiableDomain().getIdMethod(entityResolver), pw, false);
      pw.print(".toDto(");
    } else {
origin: sk.seges.sesam/sesam-model-domain-processor

DomainDeclaredType superClass = context.getConfigurationTypeElement().getInstantiableDomain().getSuperClass();
if (superClass == null || ConverterProcessingHelper.isConverterGenerated(superClass.getDomainDefinitionConfiguration().asConfigurationElement(), processingEnv)) {
  return;
      pw.print(" && ");
    TypeElement typeElement = processingEnv.getElementUtils().getTypeElement(context.getConfigurationTypeElement().getDomain().getCanonicalName());
    methodPath += "." + MethodHelper.toGetterMethod(typeElement, path);
TypeElement typeElement = processingEnv.getElementUtils().getTypeElement(context.getConfigurationTypeElement().getInstantiableDomain().getCanonicalName());
if (context.getConfigurationTypeElement().getInstantiableDomain().getGetterMethod(pathResolver.getPath()) != null) {
  castToInstance = context.getConfigurationTypeElement().getDomain().getGetterMethod(pathResolver.getPath()) == null;
origin: sk.seges.sesam/sesam-model-domain-processor

    ExecutableElement domainMethod = processingElement.getGetterMethod(fieldName);
    ExecutableElement domainMethod = domainTypeElement.getGetterMethod(fieldName);
          " in the domain class " + domainTypeElement.getCanonicalName(), configurationTypeElement.asConfigurationElement());
      continue;
        DomainType domainReference = currentElement.getDomainReference(getEntityResolver(), currentPath);
            ExecutableElement nestedIdMethod = currentElement.getIdMethod(getEntityResolver());
              processingEnv.getMessager().printMessage(Kind.ERROR, "[ERROR] Unable to find id method in the class " + currentElement.getCanonicalName() +
                  ". If the class/interface does not have strictly specified ID, please specify the id in the configuration using " + 
                  Id.class.getCanonicalName() + " annotation.", configurationTypeElement.asConfigurationElement());
ExecutableElement idMethod = domainTypeElement.getIdMethod(getEntityResolver());
origin: sk.seges.sesam/sesam-model-domain-processor

if (domainTypeElement.asElement() != null
    && ProcessorUtils.hasMethod(MethodHelper.toMethod(MethodHelper.GETTER_IS_PREFIX, domainPathResolver.getCurrent()),
        domainTypeElement.asElement())) {
  isMethod = true;
  domainGetterMethod = domainTypeElement.getGetterMethod(domainPathResolver.getCurrent());
} else {
  domainGetterMethod = domainTypeElement.getGetterMethod(domainPathResolver.getCurrent());
if (configurationTypeElement.getInstantiableDomain().getSetterMethod(domainPathResolver.getPath()) != null) {
  boolean castToInstance = configurationTypeElement.getDomain().getSetterMethod(domainPathResolver.getPath()) == null;
} else if (!entityResolver.isImmutable(domainTypeElement.asElement())) {
  VariableElement field = MethodHelper.getField(domainTypeElement.asConfigurationElement(), domainPathResolver.getCurrent());
origin: sk.seges.sesam/sesam-model-domain-processor

/**
 * Prints the definition of the hashCode method with the initial prechecks
 */
@Override
public void initialize(ConfigurationTypeElement configurationTypeElement, MutableDeclaredType outputType) {
  this.outputType = outputType;
  GenerateHashcodeAccessor generateHashcodeAccessor = new GenerateHashcodeAccessor(configurationTypeElement.asConfigurationElement(), processingEnv);
  active = generateHashcodeAccessor.generate();
  equalsType = generateHashcodeAccessor.getType();
  hasKey = configurationTypeElement.hasKey();
  if (!active) {
    return;
  }
  if (equalsType.equals(TraversalType.CYCLIC_SAFE)) {
    pw.println("private boolean processingHashCode = false;");
  }
  pw.println("");
  pw.println("@Override");
  pw.println("public int hashCode() {");
  pw.println("final int prime = 31;");
  //TODO we should call also super.hashcode - but only when there is any superclass with implemented hashcode method
  DomainDeclaredType superClass = configurationTypeElement.getInstantiableDomain().getSuperClass();
  if (superClass != null && superClass.getDomainDefinitionConfiguration() != null &&
      new GenerateEqualsAccessor(superClass.getDomainDefinitionConfiguration().asConfigurationElement(), processingEnv).generate()) {
    pw.println("int result = super.hashCode();");
  } else {
    pw.println("int result = 1;");
  }
}
origin: sk.seges.sesam/sesam-model-domain-processor

protected void printCopyNested(PathResolver domainPathResolver, String fullPath, DomainDeclaredType referenceDomainType, ExecutableElement method,
    FormattedPrintWriter pw, Field field, String dtoName) {
  DomainDeclaredType instantiableDomain = (DomainDeclaredType)referenceDomainType.getConverter().getInstantiableDomain();
  pw.print(referenceDomainType, " " + domainPathResolver.getCurrent() + " = ");
  if (instantiableDomain.getId(entityResolver) != null) {
    if (referenceDomainType.getConverter() == null) {
      processingEnv.getMessager().printMessage(Kind.ERROR, "[ERROR] No converter/configuration for " + referenceDomainType + " was found. Please, define configuration for "
          + referenceDomainType);
    }
    converterProviderPrinter.printObtainConverterFromCache(pw, ConverterTargetType.DTO, referenceDomainType, field, method, true);
    pw.println(".createDomainInstance(" + dtoName + "."
        + MethodHelper.toGetter(fullPath + MethodHelper.toMethod(MethodHelper.toField(instantiableDomain.getIdMethod(entityResolver)))) + ");");
  } else {
    pw.println(TransferObjectElementPrinter.RESULT_NAME + "." + MethodHelper.toGetter(domainPathResolver.getCurrent()) + ";");
    pw.println("if (" + domainPathResolver.getCurrent() + " == null) {");
    pw.print(domainPathResolver.getCurrent() + " = ");
    // TODO add NPE check
    converterProviderPrinter.printObtainConverterFromCache(pw, ConverterTargetType.DTO, referenceDomainType, field, method, true);
    pw.println(".createDomainInstance(null);");
    pw.println("}");
  }
}
origin: sk.seges.sesam/sesam-model-domain-processor

TypeElement typeElement = processingEnv.getElementUtils().getTypeElement(configurationTypeElement.getInstantiableDomain().getCanonicalName());
        configurationTypeElement.getInstantiableDomain().getCanonicalName() + ". Please add source class on the classpath also.");
} else {
  MethodOwner domainMethodOwner = configurationTypeElement.getInstantiableDomain().getMethodOwnerByName(overridenMethod.getSimpleName().toString());
          configurationTypeElement.getInstantiableDomain().getCanonicalName() + ". Please check your configuration " +
          configurationTypeElement.toString(ClassSerializer.SIMPLE) + ".");
    return;
          configurationTypeElement.getInstantiableDomain().getCanonicalName() + ". Please add source class on the classpath also.");
  } else {
          configurationTypeElement.getInstantiableDomain().getCanonicalName() + ". Please check your configuration " +
          configurationTypeElement.toString(ClassSerializer.SIMPLE) + ".");
      return;
origin: sk.seges.sesam/sesam-model-domain-processor

private boolean isInSuperclassConfiguration(ExecutableElement method, DomainDeclaredType processingElement) {
  if (processingElement.getSuperClass() != null) {
        getConfigurationsForDomain(processingElement.getSuperClass());
    if (configurationsForDomain != null && configurationsForDomain.size() > 0) {
          processingElement.getSuperClass(), processingElement.getSuperClass(), new ArrayList<String>());
    if (isInSuperclassConfiguration(method, processingElement.getSuperClass())) {
      return true;
origin: sk.seges.sesam/sesam-service-converter-processor

nestedPrinter.print(new ServiceConverterProviderPrinterContext(rawDto, localMethod, returnDtoType.getConverter().getConfiguration()));
if (rawDomain.getTypeVariables().size() > 0) {
  for (MutableTypeVariable typeVariable: rawDomain.getTypeVariables()) {
    printDtoTypeVariables(typeVariable.getLowerBounds(), localMethod, nestedPrinter);
    printDtoTypeVariables(typeVariable.getUpperBounds(), localMethod, nestedPrinter);
nestedPrinter.print(new ServiceConverterProviderPrinterContext(rawDomain, localMethod));
if (rawDomain.getTypeVariables().size() > 0) {
  for (MutableTypeVariable typeVariable: rawDomain.getTypeVariables()) {
    printDomainTypeVariables(typeVariable.getLowerBounds(), localMethod, nestedPrinter);
    printDomainTypeVariables(typeVariable.getUpperBounds(), localMethod, nestedPrinter);
origin: sk.seges.sesam/sesam-model-domain-processor

DomainDeclaredType replacementType = delegateConfigurationTypeElement.getDomain();
if ((domainNamedType instanceof MutableDeclaredType) && ((MutableDeclaredType)domainNamedType).hasTypeParameters() && replacementType.hasTypeParameters()) {
  domainNamedType = replacementType.clone().setTypeVariables(((MutableDeclaredType)domainNamedType).getTypeVariables().toArray(new MutableTypeVariable[] {}));
} else {
  domainNamedType = replacementType;
origin: sk.seges.sesam/sesam-model-domain-processor

pw.println("	return false;");
DomainDeclaredType superClass = configurationTypeElement.getInstantiableDomain().getSuperClass();
if (superClass != null && superClass.getDomainDefinitionConfiguration() != null &&
    new GenerateEqualsAccessor(superClass.getDomainDefinitionConfiguration().asConfigurationElement(), processingEnv).generate()) {
  pw.println("if (!super.equals(obj))");
  pw.println("	return false;");
origin: sk.seges.sesam/sesam-model-domain-processor

protected boolean isId(TransferObjectContext context) {
  return (processingEnv.getTypeUtils().isAssignable(processingEnv.getElementUtils().getTypeElement(context.getConfigurationTypeElement().getInstantiableDomain().getCanonicalName()).asType(),
      context.getDomainMethod().getEnclosingElement().asType()) && isIdField(context.getConfigurationTypeElement().getInstantiableDomain(), context.getDomainMethod().getSimpleName().toString()));
}
origin: sk.seges.sesam/sesam-model-domain-processor

protected ExecutableElement getSetterMethod(TransferObjectContext context, PathResolver domainPathResolver) {
  TypeElement typeElement = processingEnv.getElementUtils().getTypeElement(context.getConfigurationTypeElement().getDomain().getCanonicalName());
  return getSetterMethod(typeElement, domainPathResolver);
  //return ProcessorUtils.getMethod(MethodHelper.toSetter(domainPathResolver.getPath()), typeElement));
}
 
origin: sk.seges.sesam/sesam-model-domain-processor

private TransferObjectContext createTOContext(ExecutableElement method, DomainDeclaredType domainTypeElement, boolean superClassMethod, ConfigurationTypeElement configurationTypeElement, List<String> generated) {
  String fieldName = TransferObjectHelper.getFieldPath(method);
  if (contains(generated, fieldName)) {
    return null;
  }
  TypeElement domainElement = environmentContext.getProcessingEnv().getElementUtils().getTypeElement(domainTypeElement.getCanonicalName());
  ExecutableElement overrider = ProcessorUtils.getOverrider(domainElement, method, processingEnv);
  if (overrider != null) {
    method = overrider;
  }
  TransferObjectContext context = transferObjectContextProvider.get(configurationTypeElement, Modifier.PUBLIC, method, method, superClassMethod);
  if (context == null) {
    return null;
  }
  generated.add(fieldName);
  return context;
}
sk.seges.sesam.pap.model.model.api.domainDomainDeclaredType

Most used methods

  • getCanonicalName
  • getSuperClass
  • getTypeVariables
  • asConfigurationElement
  • asElement
  • clone
  • getConverter
  • getDomainDefinitionConfiguration
  • getDomainReference
  • getDto
  • getGetterMethod
  • getId
  • getGetterMethod,
  • getId,
  • getIdMethod,
  • getInterfaces,
  • getKind,
  • getMethodOwnerByName,
  • getSetterMethod,
  • getSimpleName,
  • hasTypeParameters,
  • setInterfaces

Popular in Java

  • Finding current android device location
  • getSupportFragmentManager (FragmentActivity)
  • setScale (BigDecimal)
  • setRequestProperty (URLConnection)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Menu (java.awt)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • JCheckBox (javax.swing)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now