本文整理匯總了Java中com.sun.javadoc.FieldDoc類的典型用法代碼示例。如果您正苦於以下問題:Java FieldDoc類的具體用法?Java FieldDoc怎麽用?Java FieldDoc使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FieldDoc類屬於com.sun.javadoc包,在下文中一共展示了FieldDoc類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: PSItemDoc
import com.sun.javadoc.FieldDoc; //導入依賴的package包/類
private PSItemDoc(ClassDoc classDoc) {
this.classDoc = classDoc;
this.name = classDoc.name();
this.description = classDoc.commentText();
this.itemFieldDocs = new ArrayList<>();
this.providerDocs = new ArrayList<>();
List<FieldDoc> allFields = new ArrayList<>();
this.getAllFieldDocs(classDoc, allFields);
for (FieldDoc fieldDoc : allFields) {
PSItemFieldDoc itemFieldDoc = PSItemFieldDoc.build(this, fieldDoc);
if (itemFieldDoc != null) this.itemFieldDocs.add(itemFieldDoc);
}
for (MethodDoc methodDoc : classDoc.methods()) {
PSOperatorDoc providerDoc = PSOperatorDoc.build(classDoc, methodDoc);
if (providerDoc != null) this.providerDocs.add(providerDoc);
}
}
示例2: writeFieldDetails
import com.sun.javadoc.FieldDoc; //導入依賴的package包/類
private void writeFieldDetails(PrintWriter writer, ClassDoc clazz,
FieldDoc field) {
if (skipField(clazz, field)) {
return;
}
String text = field.commentText();
if (text.startsWith("INTERNAL")) {
return;
}
String name = field.name();
String constant = field.constantValueExpression();
String link = getFieldLink(text, constant, clazz, name);
writer.println("<h4 id=\"" + link + "\"><span class=\"methodName\">" +
name);
if (constant == null) {
writer.println();
} else {
writer.println(" = " + constant);
}
writer.println("</span></h4>");
writer.println("<div class=\"item\">" + formatText(text) + "</div>");
writer.println("<hr />");
}
示例3: docForEnumArgument
import com.sun.javadoc.FieldDoc; //導入依賴的package包/類
/**
* Helper routine that provides a FreeMarker map for an enumClass, grabbing the
* values of the enum and their associated javadoc documentation.
*
* @param enumClass
* @return
*/
private List<Map<String, Object>> docForEnumArgument(final Class<?> enumClass) {
final ClassDoc doc = this.getDoclet().getClassDocForClass(enumClass);
if ( doc == null ) {
throw new RuntimeException("Tried to get docs for enum " + enumClass + " but got null instead");
}
final Set<String> enumConstantFieldNames = enumConstantsNames(enumClass);
final List<Map<String, Object>> bindings = new ArrayList<Map<String, Object>>();
for (final FieldDoc fieldDoc : doc.fields(false)) {
if (enumConstantFieldNames.contains(fieldDoc.name()) ) {
bindings.add(
new HashMap<String, Object>() {
static final long serialVersionUID = 0L;
{
put("name", fieldDoc.name());
put("summary", fieldDoc.commentText());
}
}
);
}
}
return bindings;
}
示例4: GroupDefDoc
import com.sun.javadoc.FieldDoc; //導入依賴的package包/類
public GroupDefDoc(ClassDoc doc) {
this.classDoc = doc;
this.name = DocAnnotationDoclet.getNameAnnotation(classDoc.annotations(), classDoc.simpleTypeName());
this.className = classDoc.qualifiedName();
// fields
fields = new ArrayList<>();
for (FieldDoc field : getFields(classDoc)) {
if (field.isStatic()) {
continue;
}
String fieldName = DocAnnotationDoclet.getNameAnnotation(field.annotations(), field.name());
fields.add(new FieldDefDoc(fieldName, field));
}
}
示例5: processExternalResources
import com.sun.javadoc.FieldDoc; //導入依賴的package包/類
protected static String processExternalResources(ClassDoc classDoc){
StringBuilder cpText = new StringBuilder("<dt><b>Configuration Parameters:</b></dt><dd><table><tr style=\"text-align: left\"><th>Parameter</th><th>Description</th><th>Default Value(s)</th></tr>");
Map<String, String> rows = new TreeMap<>();
for(FieldDoc field : getFields(classDoc)){
Entry<String, String> entry = createParameterRow(field);
if(entry != null){
rows.put(entry.getKey(), entry.getValue());
}
}
if(rows.isEmpty()){
cpText.setLength(0);
}else{
for(String s : rows.values()){
cpText.append(s);
}
}
cpText.append("</table></dd>");
return cpText.toString();
}
示例6: processConfigurationParameters
import com.sun.javadoc.FieldDoc; //導入依賴的package包/類
protected static String processConfigurationParameters(ClassDoc classDoc){
StringBuilder erText = new StringBuilder("<dt><b>External Resources:</b></dt><dd><ul>");
List<String> resources = new ArrayList<>();
for(FieldDoc field : getFields(classDoc)){
resources.addAll(createResourceItem(field));
}
if(resources.isEmpty()){
return null;
}else{
for(String s : resources){
erText.append(wrapWithTag("li", s, null));
}
}
erText.append("</ul></dd>");
return erText.toString();
}
示例7: createParameterRow
import com.sun.javadoc.FieldDoc; //導入依賴的package包/類
private static Entry<String, String> createParameterRow(FieldDoc field){
Tag[] tags = field.tags("@"+ConfigurationParameters.NAME);
if(tags.length == 0){
return null;
}
String name = wrapWithTag("td", field.constantValue(), "padding-right: 20px");
String desc = wrapWithTag("td", field.commentText(), "padding-right: 20px");
StringBuilder defaultValues = new StringBuilder("");
for(Tag tag : tags){
defaultValues.append(tag.text());
defaultValues.append("<br />");
}
String values = wrapWithTag("td", defaultValues.toString(), null);
String row = wrapWithTag("tr", name + desc + values, null);
return new AbstractMap.SimpleEntry<String, String>(field.constantValue().toString(), row);
}
示例8: createResourceItem
import com.sun.javadoc.FieldDoc; //導入依賴的package包/類
private static List<String> createResourceItem(FieldDoc field){
Tag[] tags = field.tags("@"+ExternalResources.NAME);
if(tags.length == 0){
return Collections.emptyList();
}
List<String> ret = new ArrayList<>();
String pkg = field.containingPackage().name();
int levels = pkg.length() - pkg.replaceAll("\\.", "").length() + 1;
StringBuilder linkLevels = new StringBuilder("");
for(int i = 0; i < levels; i++){
linkLevels.append("../");
}
for(Tag tag : tags){
ret.add("<a href=\""+linkLevels.toString()+tag.text().replaceAll("\\.", "/")+".html\">" + tag.text() + "</a> (key = " + field.constantValue() + ")");
}
return ret;
}
示例9: parseIdentifier
import com.sun.javadoc.FieldDoc; //導入依賴的package包/類
private String parseIdentifier(Doc doc) {
if (doc instanceof ClassDoc) {
ClassDoc classDoc = (ClassDoc) doc;
return parseIdentifier((Doc) classDoc.containingPackage()) + classDoc.name() + "/";
} else if (doc instanceof AnnotationTypeElementDoc) {
AnnotationTypeElementDoc annotationTypeElementDoc = (AnnotationTypeElementDoc) doc;
return parseIdentifier((Doc) annotationTypeElementDoc.containingClass()) + "#" + annotationTypeElementDoc.name();
} else if (doc instanceof FieldDoc) {
FieldDoc fieldDoc = (FieldDoc) doc;
return parseIdentifier((Doc) fieldDoc.containingClass()) + "#" + fieldDoc.name();
} else if (doc instanceof ConstructorDoc) {
ConstructorDoc constructorDoc = (ConstructorDoc) doc;
return parseIdentifier((Doc) constructorDoc.containingClass()) + "#" + constructorDoc.name() + URLEncoder.encode(constructorDoc.flatSignature());
} else if (doc instanceof MethodDoc) {
MethodDoc methodDoc = (MethodDoc) doc;
return parseIdentifier((Doc) methodDoc.containingClass()) + "#" + methodDoc.name() + URLEncoder.encode(methodDoc.flatSignature());
} else {
return "/" + doc.name() + "/";
}
}
示例10: fieldsSummary
import com.sun.javadoc.FieldDoc; //導入依賴的package包/類
/**
* Appends to the current document the
* field summary if any field is exposed.
*/
private void fieldsSummary() {
if (hasField()) {
header(4);
text(MarkletConstant.FIELDS);
newLine();
tableHeader(MarkletConstant.FIELDS_SUMMARY_HEADERS);
getOrderedElements(classDoc::fields)
.filter(FieldDoc::isStatic)
.forEach(this::rowSignature);
getOrderedElements(classDoc::fields)
.filter(field -> !field.isStatic())
.forEach(this::rowSignature);
newLine();
}
}
示例11: analyzeFields
import com.sun.javadoc.FieldDoc; //導入依賴的package包/類
/** Analyze fields. */
private void analyzeFields(ClassDoc classDoc, IJavaElement element)
throws ConQATException {
for (FieldDoc fieldDoc : classDoc.fields()) {
for (int i = 0; i < fieldAnalyzers.size(); i++) {
IFieldDocAnalyzer analyzer = fieldAnalyzers.getFirst(i);
Modifiers actualModifiers = new Modifiers(
fieldDoc.modifierSpecifier(), false);
Modifiers requiredModifiers = fieldAnalyzers.getSecond(i);
if (requiredModifiers.isSatisfied(actualModifiers)) {
analyzer.analyze(fieldDoc, element);
}
}
}
}
示例12: getTagletOutput
import com.sun.javadoc.FieldDoc; //導入依賴的package包/類
/**
* Checks the type of the program element and determines comment
* accordingly.
*/
@Override
public TagletOutput getTagletOutput(Tag tag, TagletWriter writer) {
Doc doc = tag.holder();
String text;
if (doc instanceof MethodDoc) {
text = methodDoc((MethodDoc) doc);
} else if (doc instanceof ClassDoc) {
text = classDoc((ClassDoc) doc);
} else if (doc instanceof FieldDoc) {
text = fieldDoc((FieldDoc) doc);
} else {
throw new IllegalStateException("Should not happen.");
}
if (isFirstSentence(writer)) {
text = getFirstSentence(text);
}
TagletOutput result = writer.getOutputInstance();
result.setOutput(text);
return result;
}
示例13: processFieldDoc
import com.sun.javadoc.FieldDoc; //導入依賴的package包/類
/**
* @return the full JSON for the given FieldDoc
*/
protected JSONObject processFieldDoc(FieldDoc fieldDoc) {
if (fieldDoc == null) {
return null;
}
JSONObject retMe = processMemberDoc(fieldDoc);
retMe.put("type", processType(fieldDoc.type()));
retMe.put("constantValueExpression", fieldDoc.constantValueExpression());
retMe.put("constantValue", ((fieldDoc.constantValue() != null) ? fieldDoc.constantValue().toString() : null));
retMe.put("serialFieldTags", processTags(fieldDoc.serialFieldTags()));
return retMe;
}
示例14: getEnumConstants
import com.sun.javadoc.FieldDoc; //導入依賴的package包/類
public Vector getEnumConstants()
{
Vector myDocs = new Vector();
ClassDoc mainDoc = (ClassDoc) getVariables().get("curitem");
FieldDoc[] docs = mainDoc.enumConstants();
ClassDoc doc = mainDoc.superclass();
for (int i = 0; i != docs.length; i++)
{
myDocs.add(docs[i]);
}
// go through all superclasses fields
while (doc != null && !doc.name().equalsIgnoreCase("object"))
{
//note: We don't add the "object" fields (clutter)
docs = doc.enumConstants();
for (int i = 0; i != docs.length; i++)
{
myDocs.add(docs[i]);
}
doc = doc.superclass();
}
FieldDoc[] docArray = (FieldDoc[]) myDocs.toArray(new FieldDoc[0]);
Arrays.sort(docArray);
return myDocs;
}
示例15: getReturnString
import com.sun.javadoc.FieldDoc; //導入依賴的package包/類
public String getReturnString(JOTDocletHolder holder)
{
Type type = null;
if (holder instanceof JOTDocletFieldHolder)
{
type = ((FieldDoc) holder.getDoc()).type();
} else
{
type = ((MethodDoc) holder.getDoc()).returnType();
}
String str = "";
if (type.asParameterizedType() != null)
{
str += handleGenerics(type, 0);
} else if (type.asTypeVariable() != null)
{
str += handleGenerics(type, 0);
} else if (type.asClassDoc() != null)
{
str += getTypeLink(type.asClassDoc());
} else
{
str += "<font class='type'>" + type.simpleTypeName() + "</font>";
}
return str;
}