com.sun.javadoc.ConstructorDoc Java Examples

The following examples show how to use com.sun.javadoc.ConstructorDoc. 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: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Wrap a constructor doc.
 *
 * @param source the source
 * @return the wrapper.
 */
public ConstructorDoc wrap(ConstructorDoc source) {
	if (source == null || source instanceof Proxy<?> || !(source instanceof ConstructorDocImpl)) {
		return source;
	}
	return new ConstructorDocWrapper((ConstructorDocImpl) source);
}
 
Example #2
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Wrap a constructor doc.
 *
 * @param source the source
 * @return the wrapper.
 */
public ConstructorDoc[] wrap(ConstructorDoc[] source) {
	if (source == null) {
		return null;
	}
	final List<ConstructorDoc> list = new ArrayList<>();
	for (final ConstructorDoc element : source) {
		if (isIncluded(element)) {
			list.add(wrap(element));
		}
	}
	return Utils.toArray(source, list);
}
 
Example #3
Source File: SarlConstructorWriter.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Override
public Content getSignature(ConstructorDoc constructor) {
	final Content pre = new HtmlTree(HtmlTag.PRE);
	addAnnotations(constructor, pre);
	addModifiers(constructor, pre);
	pre.addContent(Utils.keyword(Utils.getKeywords().getNewKeyword()));
	final int indent = pre.charCount();
	addParameters(constructor, pre, indent);
	addTypeParameters(constructor, pre);
	addExceptions(constructor, pre, indent);
	return pre;
}
 
Example #4
Source File: Parser.java    From xml-doclet with Apache License 2.0 5 votes vote down vote up
protected Constructor parseConstructor(ConstructorDoc constructorDoc) {
	Constructor constructorNode = objectFactory.createConstructor();

	constructorNode.setName(constructorDoc.name());
	constructorNode.setQualified(constructorDoc.qualifiedName());
	String comment = constructorDoc.commentText();
	if (comment.length() > 0) {
		constructorNode.setComment(comment);
	}
	constructorNode.setScope(parseScope(constructorDoc));
	constructorNode.setIncluded(constructorDoc.isIncluded());
	constructorNode.setFinal(constructorDoc.isFinal());
	constructorNode.setNative(constructorDoc.isNative());
	constructorNode.setStatic(constructorDoc.isStatic());
	constructorNode.setSynchronized(constructorDoc.isSynchronized());
	constructorNode.setVarArgs(constructorDoc.isVarArgs());
	constructorNode.setSignature(constructorDoc.signature());

	for (Parameter parameter : constructorDoc.parameters()) {
		constructorNode.getParameter().add(parseMethodParameter(parameter));
	}

	for (Type exceptionType : constructorDoc.thrownExceptionTypes()) {
		constructorNode.getException().add(parseTypeInfo(exceptionType));
	}

	for (AnnotationDesc annotationDesc : constructorDoc.annotations()) {
		constructorNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, constructorDoc.qualifiedName()));
	}

	for (Tag tag : constructorDoc.tags()) {
		constructorNode.getTag().add(parseTag(tag));
	}

	return constructorNode;
}
 
Example #5
Source File: RootDocProcessor.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
   public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
     String methodName = method.getName();
     if (target instanceof Doc) {
if (methodName.equals("isIncluded")) {
  Doc doc = (Doc) target;
  return !exclude(doc) && doc.isIncluded();
}
if (target instanceof RootDoc) {
  if (methodName.equals("classes")) {
    return filter(((RootDoc) target).classes(), ClassDoc.class);
  } else if (methodName.equals("specifiedClasses")) {
    return filter(((RootDoc) target).specifiedClasses(), ClassDoc.class);
  } else if (methodName.equals("specifiedPackages")) {
    return filter(((RootDoc) target).specifiedPackages(), PackageDoc.class);
  }
} else if (target instanceof ClassDoc) {
  if (isFiltered(args)) {
    if (methodName.equals("methods")) {
      return filter(((ClassDoc) target).methods(true), MethodDoc.class);
    } else if (methodName.equals("fields")) {
      return filter(((ClassDoc) target).fields(true), FieldDoc.class);
    } else if (methodName.equals("innerClasses")) {
      return filter(((ClassDoc) target).innerClasses(true),
	  ClassDoc.class);
    } else if (methodName.equals("constructors")) {
      return filter(((ClassDoc) target).constructors(true),
	  ConstructorDoc.class);
    }
  }
} else if (target instanceof PackageDoc) {
  if (methodName.equals("allClasses")) {
    if (isFiltered(args)) {
      return filter(((PackageDoc) target).allClasses(true),
	ClassDoc.class);
    } else {
      return filter(((PackageDoc) target).allClasses(), ClassDoc.class);  
    }
  } else if (methodName.equals("annotationTypes")) {
    return filter(((PackageDoc) target).annotationTypes(),
	AnnotationTypeDoc.class);
  } else if (methodName.equals("enums")) {
    return filter(((PackageDoc) target).enums(),
	ClassDoc.class);
  } else if (methodName.equals("errors")) {
    return filter(((PackageDoc) target).errors(),
	ClassDoc.class);
  } else if (methodName.equals("exceptions")) {
    return filter(((PackageDoc) target).exceptions(),
	ClassDoc.class);
  } else if (methodName.equals("interfaces")) {
    return filter(((PackageDoc) target).interfaces(),
	ClassDoc.class);
  } else if (methodName.equals("ordinaryClasses")) {
    return filter(((PackageDoc) target).ordinaryClasses(),
	ClassDoc.class);
  }
}
     }

     if (args != null) {
if (methodName.equals("compareTo") || methodName.equals("equals")
    || methodName.equals("overrides")
    || methodName.equals("subclassOf")) {
  args[0] = unwrap(args[0]);
}
     }
     try {
return process(method.invoke(target, args), method.getReturnType());
     } catch (InvocationTargetException e) {
throw e.getTargetException();
     }
   }
 
Example #6
Source File: RootDocProcessor.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
   public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
     String methodName = method.getName();
     if (target instanceof Doc) {
if (methodName.equals("isIncluded")) {
  Doc doc = (Doc) target;
  return !exclude(doc) && doc.isIncluded();
}
if (target instanceof RootDoc) {
  if (methodName.equals("classes")) {
    return filter(((RootDoc) target).classes(), ClassDoc.class);
  } else if (methodName.equals("specifiedClasses")) {
    return filter(((RootDoc) target).specifiedClasses(), ClassDoc.class);
  } else if (methodName.equals("specifiedPackages")) {
    return filter(((RootDoc) target).specifiedPackages(), PackageDoc.class);
  }
} else if (target instanceof ClassDoc) {
  if (isFiltered(args)) {
    if (methodName.equals("methods")) {
      return filter(((ClassDoc) target).methods(true), MethodDoc.class);
    } else if (methodName.equals("fields")) {
      return filter(((ClassDoc) target).fields(true), FieldDoc.class);
    } else if (methodName.equals("innerClasses")) {
      return filter(((ClassDoc) target).innerClasses(true),
	  ClassDoc.class);
    } else if (methodName.equals("constructors")) {
      return filter(((ClassDoc) target).constructors(true),
	  ConstructorDoc.class);
    }
  }
} else if (target instanceof PackageDoc) {
  if (methodName.equals("allClasses")) {
    if (isFiltered(args)) {
      return filter(((PackageDoc) target).allClasses(true),
	ClassDoc.class);
    } else {
      return filter(((PackageDoc) target).allClasses(), ClassDoc.class);  
    }
  } else if (methodName.equals("annotationTypes")) {
    return filter(((PackageDoc) target).annotationTypes(),
	AnnotationTypeDoc.class);
  } else if (methodName.equals("enums")) {
    return filter(((PackageDoc) target).enums(),
	ClassDoc.class);
  } else if (methodName.equals("errors")) {
    return filter(((PackageDoc) target).errors(),
	ClassDoc.class);
  } else if (methodName.equals("exceptions")) {
    return filter(((PackageDoc) target).exceptions(),
	ClassDoc.class);
  } else if (methodName.equals("interfaces")) {
    return filter(((PackageDoc) target).interfaces(),
	ClassDoc.class);
  } else if (methodName.equals("ordinaryClasses")) {
    return filter(((PackageDoc) target).ordinaryClasses(),
	ClassDoc.class);
  }
}
     }

     if (args != null) {
if (methodName.equals("compareTo") || methodName.equals("equals")
    || methodName.equals("overrides")
    || methodName.equals("subclassOf")) {
  args[0] = unwrap(args[0]);
}
     }
     try {
return process(method.invoke(target, args), method.getReturnType());
     } catch (InvocationTargetException e) {
throw e.getTargetException();
     }
   }
 
Example #7
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public ConstructorDoc[] constructors() {
	return wrap(this.delegate.constructors());
}
 
Example #8
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public ConstructorDoc[] constructors(boolean arg0) {
	return wrap(this.delegate.constructors(arg0));
}
 
Example #9
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public ConstructorDoc findConstructor(String constrName, String[] paramTypes) {
	return wrap(this.delegate.findConstructor(constrName, paramTypes));
}
 
Example #10
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public ConstructorDoc[] constructors() {
	return wrap(this.delegate.constructors());
}
 
Example #11
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public ConstructorDoc[] constructors(boolean arg0) {
	return wrap(this.delegate.constructors(arg0));
}
 
Example #12
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public ConstructorDoc findConstructor(String constrName, String[] paramTypes) {
	return wrap(this.delegate.findConstructor(constrName, paramTypes));
}
 
Example #13
Source File: Parser.java    From xml-doclet with Apache License 2.0 4 votes vote down vote up
protected Class parseClass(ClassDoc classDoc) {

		Class classNode = objectFactory.createClass();
		classNode.setName(classDoc.name());
		classNode.setQualified(classDoc.qualifiedName());
		String comment = classDoc.commentText();
		if (comment.length() > 0) {
			classNode.setComment(comment);
		}
		classNode.setAbstract(classDoc.isAbstract());
		classNode.setError(classDoc.isError());
		classNode.setException(classDoc.isException());
		classNode.setExternalizable(classDoc.isExternalizable());
		classNode.setIncluded(classDoc.isIncluded());
		classNode.setSerializable(classDoc.isSerializable());
		classNode.setScope(parseScope(classDoc));

		for (TypeVariable typeVariable : classDoc.typeParameters()) {
			classNode.getGeneric().add(parseTypeParameter(typeVariable));
		}

		Type superClassType = classDoc.superclassType();
		if (superClassType != null) {
			classNode.setClazz(parseTypeInfo(superClassType));
		}

		for (Type interfaceType : classDoc.interfaceTypes()) {
			classNode.getInterface().add(parseTypeInfo(interfaceType));
		}

		for (MethodDoc method : classDoc.methods()) {
			classNode.getMethod().add(parseMethod(method));
		}

		for (AnnotationDesc annotationDesc : classDoc.annotations()) {
			classNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, classDoc.qualifiedName()));
		}

		for (ConstructorDoc constructor : classDoc.constructors()) {
			classNode.getConstructor().add(parseConstructor(constructor));
		}

		for (FieldDoc field : classDoc.fields()) {
			classNode.getField().add(parseField(field));
		}

		for (Tag tag : classDoc.tags()) {
			classNode.getTag().add(parseTag(tag));
		}

		return classNode;
	}