@Test(expected=IllegalArgumentException.class) public void testCast4() { LastOfChannelExpression<VDouble> exp = new LastOfChannelExpression<VDouble>("test", VDouble.class); LastOfChannelExpression<?> exp2 = exp.cast(VString.class); }
public <N> LastOfChannelExpression<N> cast(Class<N> clazz) { if (clazz.isAssignableFrom(this.clazz)) { @SuppressWarnings("unchecked") LastOfChannelExpression<N> result = (LastOfChannelExpression<N>) this; return result; } if (this.clazz.isAssignableFrom(clazz)) { return new LastOfChannelExpression<N>(getName(), clazz); } throw new IllegalArgumentException("Cannot cast expression of type " + this.clazz + " to type " + clazz); }
LastOfChannelExpression implements DesiredRateExpression<T> { public <N> LastOfChannelExpression<N> cast(Class<N> clazz) { if (clazz.isAssignableFrom(this.clazz)) { @SuppressWarnings("unchecked") LastOfChannelExpression<N> result = (LastOfChannelExpression<N>) this; return result; } if (this.clazz.isAssignableFrom(clazz)) { return new LastOfChannelExpression<N>(getName(), clazz); } throw new IllegalArgumentException("Cannot cast expression of type " + this.clazz + " to type " + clazz); } }
LastOfChannelExpression implements DesiredRateExpression<T> { public <N> LastOfChannelExpression<N> cast(Class<N> clazz) { if (clazz.isAssignableFrom(this.clazz)) { @SuppressWarnings("unchecked") LastOfChannelExpression<N> result = (LastOfChannelExpression<N>) this; return result; } if (this.clazz.isAssignableFrom(clazz)) { return new LastOfChannelExpression<N>(getName(), clazz); } throw new IllegalArgumentException("Cannot cast expression of type " + this.clazz + " to type " + clazz); } LastOfChannelExpression(String name, Class<T> clazz); }
LastOfChannelExpression implements DesiredRateExpression<T> { public <N> LastOfChannelExpression<N> cast(Class<N> clazz) { if (clazz.isAssignableFrom(this.clazz)) { @SuppressWarnings("unchecked") LastOfChannelExpression<N> result = (LastOfChannelExpression<N>) this; return result; } if (this.clazz.isAssignableFrom(clazz)) { return new LastOfChannelExpression<N>(getName(), clazz); } throw new IllegalArgumentException("Cannot cast expression of type " + this.clazz + " to type " + clazz); } LastOfChannelExpression(String name, Class<T> clazz); @Override DesiredRateExpression<T> as(String name); @Override String getName(); @Override void fillReadRecipe(PVDirector director, ReadRecipeBuilder builder); @Override ReadFunction<T> getFunction(); @Override DesiredRateExpressionImpl<T> getDesiredRateExpressionImpl(); @Override DesiredRateExpressionList<T> and(DesiredRateExpressionList<? extends T> expressions); @Override List<DesiredRateExpression<T>> getDesiredRateExpressions(); LastOfChannelExpression<N> cast(Class<N> clazz); Class<T> getType(); }
LastOfChannelExpression implements DesiredRateExpression<T> { public <N> LastOfChannelExpression<N> cast(Class<N> clazz) { if (clazz.isAssignableFrom(this.clazz)) { @SuppressWarnings("unchecked") LastOfChannelExpression<N> result = (LastOfChannelExpression<N>) this; return result; } if (this.clazz.isAssignableFrom(clazz)) { return new LastOfChannelExpression<N>(getName(), clazz); } throw new IllegalArgumentException("Cannot cast expression of type " + this.clazz + " to type " + clazz); } LastOfChannelExpression(String name, Class<T> clazz); @Override DesiredRateExpression<T> as(String name); @Override String getName(); @Override void fillReadRecipe(PVDirector director, ReadRecipeBuilder builder); @Override ReadFunction<T> getFunction(); @Override DesiredRateExpressionImpl<T> getDesiredRateExpressionImpl(); @Override DesiredRateExpressionList<T> and(DesiredRateExpressionList<? extends T> expressions); @Override List<DesiredRateExpression<T>> getDesiredRateExpressions(); LastOfChannelExpression<N> cast(Class<N> clazz); Class<T> getType();  }