@Test public void newInstance() { byte from = 0; byte to = Byte.MAX_VALUE; byte step = 1; ByteFieldFactory factory = new ByteFieldFactory(from, to, step); for(int i = 0; i < 126; i++) { Byte value = factory.newInstance(i); assertEquals(value.byteValue(), new Integer(i).byteValue()); } for(int i = 127; i < 254; i++) { Byte value = factory.newInstance(i); assertEquals(value.byteValue(), new Integer(i - 127).byteValue()); } }
@Override public Byte newInstance(int uniqueId) { int amountToAdd = (uniqueId % modulo) * step; return (byte) (from + amountToAdd); }
ByteFieldFactory extends AbstractFieldFactory<Byte> { @Override public Byte newInstance(int uniqueId) { int amountToAdd = (uniqueId % modulo) * step; return (byte) (from + amountToAdd); } }
ByteFieldFactory extends AbstractFieldFactory<Byte> { @Override public Byte newInstance(int uniqueId) { int amountToAdd = (uniqueId % modulo) * step; return (byte) (from + amountToAdd); } ByteFieldFactory(Number from, Number to, Number step); }
ByteFieldFactory extends AbstractFieldFactory<Byte> { @Override public Byte newInstance(int uniqueId) { int amountToAdd = (uniqueId % modulo) * step; return (byte) (from + amountToAdd); } ByteFieldFactory(Number from, Number to, Number step); @Override Byte newInstance(int uniqueId); byte getFrom(); byte getStep(); byte getModulo(); }
ByteFieldFactory extends AbstractFieldFactory<Byte> { @Override public Byte newInstance(int uniqueId) { int amountToAdd = (uniqueId % modulo) * step; return (byte) (from + amountToAdd); } ByteFieldFactory(Number from, Number to, Number step); @Override Byte newInstance(int uniqueId); byte getFrom(); byte getStep(); byte getModulo();  }