-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.stellar.sdk; | ||
|
||
import org.stellar.sdk.xdr.AccountFlags; | ||
|
||
/** | ||
* AccountFlag is the <code>enum</code> that can be used in {@link SetOptionsOperation}. | ||
* @see <a href="https://www.stellar.org/developers/guides/concepts/accounts.html#flags" target="_blank">Account Flags</a> | ||
*/ | ||
public enum AccountFlag { | ||
/** | ||
* Authorization required (0x1): Requires the issuing account to give other accounts permission before they can hold the issuing account’s credit. | ||
*/ | ||
AUTH_REQUIRED_FLAG(AccountFlags.AUTH_REQUIRED_FLAG.getValue()), | ||
/** | ||
* Authorization revocable (0x2): Allows the issuing account to revoke its credit held by other accounts. | ||
*/ | ||
AUTH_REVOCABLE_FLAG(AccountFlags.AUTH_REVOCABLE_FLAG.getValue()), | ||
/** | ||
* Authorization immutable (0x4): If this is set then none of the authorization flags can be set and the account can never be deleted. | ||
*/ | ||
AUTH_IMMUTABLE_FLAG(AccountFlags.AUTH_IMMUTABLE_FLAG.getValue()), | ||
; | ||
|
||
private final int value; | ||
AccountFlag(int value) { | ||
this.value = value; | ||
} | ||
|
||
public int getValue() { | ||
return value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.stellar.sdk; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class AccountFlagTest { | ||
@Test | ||
public void testValues() { | ||
assertEquals(1, AccountFlag.AUTH_REQUIRED_FLAG.getValue()); | ||
assertEquals(2, AccountFlag.AUTH_REVOCABLE_FLAG.getValue()); | ||
assertEquals(4, AccountFlag.AUTH_IMMUTABLE_FLAG.getValue()); | ||
} | ||
} |