forked from OpenLiberty/open-liberty
-
Notifications
You must be signed in to change notification settings - Fork 0
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
2 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
..._32_fat/test-applications/jakartadata/src/io/openliberty/jpa/data/tests/models/Prime.java
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,50 @@ | ||
/** | ||
* | ||
*/ | ||
package io.openliberty.jpa.data.tests.models; | ||
|
||
import java.util.ArrayList; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Id; | ||
|
||
/** | ||
* Recreate from io.openliberty.data.internal_fat | ||
*/ | ||
@Entity | ||
public class Prime { | ||
public String binaryDigits; | ||
|
||
public boolean even; | ||
|
||
public String hex; | ||
|
||
public String name; | ||
|
||
@Id | ||
public long numberId; | ||
|
||
public String romanNumeral; | ||
|
||
public ArrayList<String> romanNumeralSymbols; | ||
|
||
public int sumOfBits; | ||
|
||
public static Prime of(long number, String romanNumeral, String name) { | ||
Prime inst = new Prime(); | ||
inst.binaryDigits = Long.toBinaryString(number); | ||
inst.even = number % 2 == 0; | ||
inst.hex = Long.toHexString(number); | ||
inst.name = name; | ||
inst.romanNumeral = romanNumeral; | ||
inst.numberId = number; | ||
inst.sumOfBits = Long.bitCount(number); | ||
if (romanNumeral != null) { | ||
inst.romanNumeralSymbols = new ArrayList<>(romanNumeral.length()); | ||
for (int i = 0; i < romanNumeral.length(); i++) | ||
inst.romanNumeralSymbols.add(romanNumeral.substring(i, i + 1)); | ||
} | ||
|
||
return inst; | ||
} | ||
} |
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