Java Code Examples for com.github.javaparser.ast.body.ConstructorDeclaration#setName()

The following examples show how to use com.github.javaparser.ast.body.ConstructorDeclaration#setName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConstructorDeclarationMerger.java    From dolphin with Apache License 2.0 6 votes vote down vote up
@Override
public ConstructorDeclaration doMerge(ConstructorDeclaration first, ConstructorDeclaration second) {

  ConstructorDeclaration cd = new ConstructorDeclaration();

  cd.setName(first.getName());
  cd.setJavaDoc(mergeSingle(first.getJavaDoc(), second.getJavaDoc()));
  cd.setModifiers(mergeModifiers(first.getModifiers(), second.getModifiers()));
  cd.setAnnotations(mergeCollections(first.getAnnotations(), second.getAnnotations()));
  cd.setParameters(mergeCollectionsInOrder(first.getParameters(), second.getParameters()));
  cd.setTypeParameters(mergeCollectionsInOrder(first.getTypeParameters(), second.getTypeParameters()));

  cd.setThrows(mergeListNoDuplicate(first.getThrows(), second.getThrows(), false));
  cd.setBlock(mergeSingle(first.getBlock(), second.getBlock()));
  return cd;
}
 
Example 2
Source File: QueryEndpointGenerator.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
private void generateConstructors(ClassOrInterfaceDeclaration clazz) {
    for (ConstructorDeclaration c : clazz.getConstructors()) {
        c.setName(targetCanonicalName);
        if (!c.getParameters().isEmpty()) {
            setUnitGeneric(c.getParameter(0).getType());
        }
    }
}
 
Example 3
Source File: JavaParsingAtomicLinkedQueueGenerator.java    From JCTools with Apache License 2.0 5 votes vote down vote up
@Override
public void visit(ConstructorDeclaration n, Void arg) {
    super.visit(n, arg);
    // Update the ctor to match the class name
    n.setName(translateQueueName(n.getNameAsString()));
    if (MPSC_LINKED_ATOMIC_QUEUE_NAME.equals(n.getNameAsString())) {
        // Special case for MPSC because the Unsafe variant has a static factory method and a protected constructor.
        n.setModifier(Keyword.PROTECTED, false);
        n.setModifier(Keyword.PUBLIC, true);
    }
}
 
Example 4
Source File: RuleUnitGenerator.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
private void setClassName(ConstructorDeclaration constructorDeclaration) {
    constructorDeclaration.setName(targetTypeName);
}
 
Example 5
Source File: JavaParsingAtomicArrayQueueGenerator.java    From JCTools with Apache License 2.0 4 votes vote down vote up
@Override
public void visit(ConstructorDeclaration n, Void arg) {
    super.visit(n, arg);
    // Update the ctor to match the class name
    n.setName(translateQueueName(n.getNameAsString()));
}