如何使用Javadoc显示方法的实现

时间:2016-12-28 17:29:35

标签: java javadoc

即使它听起来不像BP,我想知道是否有任何方法可以在JavaDoc上显示方法的实现。

我想知道是否有任何'@ code' - 像是自动显示而不是描述它的实现。

1 个答案:

答案 0 :(得分:1)

实际上没有办法自动生成代码,您可以做到以下几点。

您可以在文档中添加// app/auth.service.ts import { Injectable } from '@angular/core'; import { tokenNotExpired } from 'angular2-jwt'; import { AngularFire } from 'angularfire2'; // Avoid name not found warnings declare var Auth0Lock: any; declare var Auth0: any; @Injectable() export class Auth { // Configure Auth0 lock = new Auth0Lock('AUTH0_CLIENT_ID', 'AUTH0_DOMAIN', {}); constructor(private af: AngularFire) { // Add callback for lock `authenticated` event this.lock.on("authenticated", (authResult) => { this.lock.getProfile(authResult.idToken, function(error:any, profile:any){ if(error){ throw new Error(error); } localStorage.setItem('id_token', authResult.idToken); localStorage.setItem('profile', JSON.stringify(profile)); //options to be used with auth0 instance to get delegation token var options = { id_token : authResult.idToken, api : 'firebase', scope : 'openid name email displayName', target: 'AUTH0_CLIENT_ID' }; //----->ERROR HERE, can't read auth0 property this.auth0.getDelegationToken(options, function(err, result){ console.log(result); if(!err){ this.af.auth().signInWithCustomToken(result.id_token).catch(function(error) { console.log(error); }); } }); }); }); } public login() { // Call the show method to display the widget. this.lock.show(); } public authenticated() { // Check if there's an unexpired JWT // This searches for an item in localStorage with key == 'id_token' return tokenNotExpired(); } public logout() { // Remove token from localStorage localStorage.removeItem('id_token'); } } 注释并添加:

@apiNote

来自Java 8 JDK的示例

通过GrepCode:

  

JDK / jdk / openjdk / 8u40-b25 / java.util.Comparator

GrepCode java.util.Comparator.thenComparing

JDK 8 Update 112源代码

/**
 * @apiNote
 * Description of example implementation...
 *
 * <pre>{@code
 *     // Code implementation example.
 * }</pre>
 */