2
0

Documentation and interface tweaks.

This commit is contained in:
Maarten Billemont 2018-09-22 19:41:48 -04:00
parent 3070967d34
commit 2a0cfd3a32
4 changed files with 21 additions and 10 deletions

View File

@ -147,6 +147,7 @@ public class MPMasterKey {
* @return {@code null} if the result type is missing a required parameter. * @return {@code null} if the result type is missing a required parameter.
* *
* @throws MPKeyUnavailableException {@link #invalidate()} has been called on this object. * @throws MPKeyUnavailableException {@link #invalidate()} has been called on this object.
* @throws MPAlgorithmException An internal system or algorithm error has occurred.
*/ */
@Nullable @Nullable
public String siteResult(final String siteName, final MPAlgorithm algorithm, final UnsignedInteger siteCounter, public String siteResult(final String siteName, final MPAlgorithm algorithm, final UnsignedInteger siteCounter,
@ -184,6 +185,7 @@ public class MPMasterKey {
* {@link #siteResult(String, MPAlgorithm, UnsignedInteger, MPKeyPurpose, String, MPResultType, String)}. * {@link #siteResult(String, MPAlgorithm, UnsignedInteger, MPKeyPurpose, String, MPResultType, String)}.
* *
* @throws MPKeyUnavailableException {@link #invalidate()} has been called on this object. * @throws MPKeyUnavailableException {@link #invalidate()} has been called on this object.
* @throws MPAlgorithmException An internal system or algorithm error has occurred.
*/ */
@Nonnull @Nonnull
public String siteState(final String siteName, final MPAlgorithm algorithm, final UnsignedInteger siteCounter, public String siteState(final String siteName, final MPAlgorithm algorithm, final UnsignedInteger siteCounter,

View File

@ -80,6 +80,9 @@ public interface MPSite<Q extends MPQuestion> extends Comparable<MPSite<?>> {
String getResult(MPKeyPurpose keyPurpose, @Nullable String keyContext, @Nullable String state) String getResult(MPKeyPurpose keyPurpose, @Nullable String keyContext, @Nullable String state)
throws MPKeyUnavailableException, MPAlgorithmException; throws MPKeyUnavailableException, MPAlgorithmException;
/**
* @see MPMasterKey#siteResult(String, MPAlgorithm, UnsignedInteger, MPKeyPurpose, String, MPResultType, String)
*/
@Nullable @Nullable
String getResult(MPKeyPurpose keyPurpose, @Nullable String keyContext, String getResult(MPKeyPurpose keyPurpose, @Nullable String keyContext,
@Nullable UnsignedInteger counter, MPResultType type, @Nullable String state) @Nullable UnsignedInteger counter, MPResultType type, @Nullable String state)
@ -90,13 +93,13 @@ public interface MPSite<Q extends MPQuestion> extends Comparable<MPSite<?>> {
@Nullable UnsignedInteger counter, MPResultType type, String state) @Nullable UnsignedInteger counter, MPResultType type, String state)
throws MPKeyUnavailableException, MPAlgorithmException; throws MPKeyUnavailableException, MPAlgorithmException;
@Nonnull @Nullable
default String getLogin() default String getLogin()
throws MPKeyUnavailableException, MPAlgorithmException { throws MPKeyUnavailableException, MPAlgorithmException {
return getLogin( null ); return getLogin( null );
} }
@Nonnull @Nullable
String getLogin(@Nullable String state) String getLogin(@Nullable String state)
throws MPKeyUnavailableException, MPAlgorithmException; throws MPKeyUnavailableException, MPAlgorithmException;

View File

@ -62,12 +62,16 @@ public abstract class MPBasicSite<U extends MPUser<?>, Q extends MPQuestion> ext
this.loginType = (loginType != null)? loginType: this.algorithm.mpw_default_login_type(); this.loginType = (loginType != null)? loginType: this.algorithm.mpw_default_login_type();
} }
// - Meta
@Nonnull @Nonnull
@Override @Override
public String getSiteName() { public String getSiteName() {
return siteName; return siteName;
} }
// - Algorithm
@Nonnull @Nonnull
@Override @Override
public MPAlgorithm getAlgorithm() { public MPAlgorithm getAlgorithm() {
@ -158,7 +162,7 @@ public abstract class MPBasicSite<U extends MPUser<?>, Q extends MPQuestion> ext
keyPurpose, keyContext, type, state ); keyPurpose, keyContext, type, state );
} }
@Nonnull @Nullable
@Override @Override
public String getLogin(@Nullable final String state) public String getLogin(@Nullable final String state)
throws MPKeyUnavailableException, MPAlgorithmException { throws MPKeyUnavailableException, MPAlgorithmException {
@ -166,6 +170,14 @@ public abstract class MPBasicSite<U extends MPUser<?>, Q extends MPQuestion> ext
return getResult( MPKeyPurpose.Identification, null, null, getLoginType(), state ); return getResult( MPKeyPurpose.Identification, null, null, getLoginType(), state );
} }
// - Relations
@Nonnull
@Override
public U getUser() {
return user;
}
@Nonnull @Nonnull
@Override @Override
public Q addQuestion(final Q question) { public Q addQuestion(final Q question) {
@ -200,12 +212,6 @@ public abstract class MPBasicSite<U extends MPUser<?>, Q extends MPQuestion> ext
return results.build(); return results.build();
} }
@Nonnull
@Override
public U getUser() {
return user;
}
@Override @Override
protected void onChanged() { protected void onChanged() {
super.onChanged(); super.onChanged();

View File

@ -101,7 +101,7 @@ public class MPFileSite extends MPBasicSite<MPFileUser, MPFileQuestion> {
return getResult( keyPurpose, keyContext, getResultState() ); return getResult( keyPurpose, keyContext, getResultState() );
} }
@Nonnull @Nullable
@Override @Override
public String getLogin() public String getLogin()
throws MPKeyUnavailableException, MPAlgorithmException { throws MPKeyUnavailableException, MPAlgorithmException {