[LANG-1510] Add org.apache.commons.lang3.arch.Processor.Arch.getLabel().
This commit is contained in:
parent
e15a2db167
commit
931101dd65
|
@ -91,6 +91,7 @@ The <action> type attribute can be add,update,fix,remove.
|
|||
<action issue="LANG-1506" type="add" dev="ggregory" due-to="Gary Gregory">Allow a StopWatch to carry an optional message.</action>
|
||||
<action issue="LANG-1507" type="add" dev="ggregory" due-to="Sam Kruglov, Mark Dacek, Marc Magon, Pascal Schumacher, Rob Tompkins, Bruno P. Kinoshita, Amey Jadiye, Gary Gregory">Add ComparableUtils #398.</action>
|
||||
<action issue="LANG-1508" type="add" dev="ggregory" due-to="Gary Gregory">Add org.apache.commons.lang3.SystemUtils.getUserName().</action>
|
||||
<action issue="LANG-1510" type="add" dev="ggregory" due-to="Gary Gregory">Add org.apache.commons.lang3.arch.Processor.Arch.getLabel().</action>
|
||||
</release>
|
||||
|
||||
<release version="3.9" date="2019-04-09" description="New features and bug fixes. Requires Java 8, supports Java 9, 10, 11.">
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.commons.lang3.arch;
|
|||
/**
|
||||
* The {@link Processor} represents a microprocessor and defines
|
||||
* some properties like architecture and type of the microprocessor.
|
||||
*
|
||||
* @since 3.6
|
||||
*/
|
||||
public class Processor {
|
||||
|
@ -29,9 +30,9 @@ public class Processor {
|
|||
* of the microprocessor.
|
||||
* The following architectures are defined:
|
||||
* <ul>
|
||||
* <li>32 bit</li>
|
||||
* <li>64 bit</li>
|
||||
* <li>unknown</li>
|
||||
* <li>32-bit</li>
|
||||
* <li>64-bit</li>
|
||||
* <li>Unknown</li>
|
||||
* </ul>
|
||||
*/
|
||||
public enum Arch {
|
||||
|
@ -39,17 +40,37 @@ public class Processor {
|
|||
/**
|
||||
* A 32-bit processor architecture.
|
||||
*/
|
||||
BIT_32,
|
||||
BIT_32("32-bit"),
|
||||
|
||||
/**
|
||||
* A 64-bit processor architecture.
|
||||
*/
|
||||
BIT_64,
|
||||
BIT_64("64-bit"),
|
||||
|
||||
/**
|
||||
* An unknown-bit processor architecture.
|
||||
*/
|
||||
UNKNOWN
|
||||
UNKNOWN("Unknown");
|
||||
|
||||
/**
|
||||
* A label suitable for display.
|
||||
*
|
||||
* @since 3.10
|
||||
*/
|
||||
private final String label;
|
||||
|
||||
private Arch(final String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the label suitable for display.
|
||||
*
|
||||
* @return the label.
|
||||
*/
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,8 +79,8 @@ public class Processor {
|
|||
* <ul>
|
||||
* <li>x86</li>
|
||||
* <li>ia64</li>
|
||||
* <li>ppc</li>
|
||||
* <li>unknown</li>
|
||||
* <li>PPC</li>
|
||||
* <li>Unknown</li>
|
||||
* </ul>
|
||||
*/
|
||||
public enum Type {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.commons.lang3;
|
||||
|
||||
import org.apache.commons.lang3.arch.Processor;
|
||||
import org.apache.commons.lang3.arch.Processor.Arch;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
@ -95,6 +96,14 @@ public class ArchUtilsTest {
|
|||
assertTrue(processor.isPPC());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testArchLabels() {
|
||||
for (Arch arch : Arch.values()) {
|
||||
// Only test label presence.
|
||||
assertFalse(arch.getLabel().isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetProcessor() {
|
||||
assertNotNull(ArchUtils.getProcessor(X86));
|
||||
|
|
Loading…
Reference in New Issue