extra constructors for algorithm wrappers

pull/306/merge
Justin Richer 2013-02-19 17:07:01 -05:00
parent e5732da857
commit 87fc92f97d
2 changed files with 41 additions and 2 deletions

View File

@ -22,12 +22,24 @@ public class JWEAlgorithmEntity {
private JWEAlgorithm algorithm;
public JWEAlgorithmEntity() {
}
public JWEAlgorithmEntity(JWEAlgorithm algorithm) {
this.algorithm = algorithm;
}
public JWEAlgorithmEntity(String algorithmName) {
setAlgorithmName(algorithmName);
}
/**
* Get the name of this algorithm, return null if no algorithm set.
* @return
*/
@Basic
public String getAlgorithm() {
public String getAlgorithmName() {
if (algorithm != null) {
return algorithm.getName();
} else {
@ -40,7 +52,7 @@ public class JWEAlgorithmEntity {
* Calls JWEAlgorithm.parse()
* @param algorithmName
*/
public void setAlgorithm(String algorithmName) {
public void setAlgorithmName(String algorithmName) {
if (algorithmName != null) {
algorithm = JWEAlgorithm.parse(algorithmName);
} else {
@ -56,4 +68,18 @@ public class JWEAlgorithmEntity {
return "JWEAlgorithmEntity [algorithm=" + algorithm + "]";
}
/**
* @return the algorithm
*/
public JWEAlgorithm getAlgorithm() {
return algorithm;
}
/**
* @param algorithm the algorithm to set
*/
public void setAlgorithm(JWEAlgorithm algorithm) {
this.algorithm = algorithm;
}
}

View File

@ -23,6 +23,19 @@ public class JWSAlgorithmEntity {
private JWSAlgorithm algorithm;
public JWSAlgorithmEntity() {
}
public JWSAlgorithmEntity(JWSAlgorithm algorithm) {
super();
this.algorithm = algorithm;
}
public JWSAlgorithmEntity(String algorithmName) {
setAlgorithmName(algorithmName);
}
/**
* Get the name of this algorithm, return null if no algorithm set.
* @return