public static OnOffHolderType.OnOffHolder transform(ActivationState.State activationState) throws TypeNotSupportedException, CouldNotTransformException { switch (activationState) { case DEACTIVE: return OnOffHolderType.OnOffHolder.newBuilder().setState(OnOffHolderType.OnOffHolder.OnOff.OFF).build(); case ACTIVE: return OnOffHolderType.OnOffHolder.newBuilder().setState(OnOffHolderType.OnOffHolder.OnOff.ON).build(); case UNKNOWN: throw new TypeNotSupportedException(activationState, OnOffHolderType.OnOffHolder.OnOff.class); default: throw new CouldNotTransformException("Could not transform " + ActivationState.State.class.getName() + "! " + ActivationState.State.class.getSimpleName() + "[" + activationState.name() + "] is unknown!"); } } }
public static OnOffHolderType.OnOffHolder transform(PowerState.State powerState) throws TypeNotSupportedException, CouldNotTransformException { switch (powerState) { case OFF: return OnOffHolderType.OnOffHolder.newBuilder().setState(OnOffHolderType.OnOffHolder.OnOff.OFF).build(); case ON: return OnOffHolderType.OnOffHolder.newBuilder().setState(OnOffHolderType.OnOffHolder.OnOff.ON).build(); case UNKNOWN: throw new TypeNotSupportedException(powerState, OnOffHolderType.OnOffHolder.OnOff.class); default: throw new CouldNotTransformException("Could not transform " + PowerState.State.class.getName() + "! " + PowerState.State.class.getSimpleName() + "[" + powerState.name() + "] is unknown!"); } } }
public static OnOffHolder transform(final ActivationState.State activationState) throws TypeNotSupportedException, CouldNotTransformException { switch (activationState) { case DEACTIVE: return OnOffHolder.newBuilder().setState(OnOffHolder.OnOff.OFF).build(); case ACTIVE: return OnOffHolder.newBuilder().setState(OnOffHolder.OnOff.ON).build(); case UNKNOWN: throw new TypeNotSupportedException(activationState, OnOffHolder.OnOff.class); default: throw new CouldNotTransformException("Could not transform " + ActivationState.State.class.getName() + "! " + ActivationState.State.class.getSimpleName() + "[" + activationState.name() + "] is unknown!"); } } }
public static OnOffHolderType.OnOffHolder transform(ActivationState.State activationState) throws TypeNotSupportedException, CouldNotTransformException { switch (activationState) { case DEACTIVE: return OnOffHolderType.OnOffHolder.newBuilder().setState(OnOffHolderType.OnOffHolder.OnOff.OFF).build(); case ACTIVE: return OnOffHolderType.OnOffHolder.newBuilder().setState(OnOffHolderType.OnOffHolder.OnOff.ON).build(); case UNKNOWN: throw new TypeNotSupportedException(activationState, OnOffHolderType.OnOffHolder.OnOff.class); default: throw new CouldNotTransformException("Could not transform " + ActivationState.State.class.getName() + "! " + ActivationState.State.class.getSimpleName() + "[" + activationState.name() + "] is unknown!"); } } }
public static OnOffHolder transform(final ButtonState buttonState) throws TypeNotSupportedException, CouldNotTransformException { switch (buttonState.getValue()) { case RELEASED: return OnOffHolder.newBuilder().setState(OnOffHolder.OnOff.OFF).build(); case PRESSED: return OnOffHolder.newBuilder().setState(OnOffHolder.OnOff.ON).build(); case UNKNOWN: throw new TypeNotSupportedException(buttonState, OnOffHolder.OnOff.class); default: throw new CouldNotTransformException("Could not transform " + ButtonState.State.class.getName() + "! " + ButtonState.State.class.getSimpleName() + "[" + buttonState.getValue().name() + "] is unknown!"); } } }