@Override public boolean equals(Object obj) { if (obj == this) { return true; } else if (obj instanceof ConstructorExpression<?>) { ConstructorExpression<?> c = (ConstructorExpression<?>) obj; return Arrays.equals(parameterTypes, c.parameterTypes) && args.equals(c.args) && getType().equals(c.getType()); } else { return false; } }
/** * Create an alias for the expression * * @return alias expression */ @SuppressWarnings("unchecked") public Expression<T> as(Path<T> alias) { return ExpressionUtils.operation(getType(), Ops.ALIAS, this, alias); }
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { ois.readObject(); try { Field constructor = ConstructorExpression.class.getDeclaredField("constructor"); constructor.setAccessible(true); constructor.set(this, getConstructor(getType(), parameterTypes)); Field transformers = ConstructorExpression.class.getDeclaredField("transformers"); transformers.setAccessible(true); transformers.set(this, getTransformers(this.constructor)); } catch (Exception e) { throw new RuntimeException(e); } }
/** * Create an alias for the expression * * @return alias expression */ public Expression<T> as(String alias) { return as(ExpressionUtils.path(getType(), alias)); }
protected ConstructorExpression(Class<? extends T> type, Class<?>[] paramTypes, ImmutableList<Expression<?>> args) { super(type); try { this.parameterTypes = getConstructorParameters(type, paramTypes).clone(); this.args = args; this.constructor = getConstructor(getType(), parameterTypes); this.transformers = getTransformers(constructor); } catch (NoSuchMethodException e) { throw new IllegalArgumentException(e); } }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } else if (obj instanceof ConstructorExpression<?>) { ConstructorExpression<?> c = (ConstructorExpression<?>) obj; return Arrays.equals(parameterTypes, c.parameterTypes) && args.equals(c.args) && getType().equals(c.getType()); } else { return false; } }
/** * Create an alias for the expression * * @return alias expression */ @SuppressWarnings("unchecked") public Expression<T> as(Path<T> alias) { return ExpressionUtils.operation(getType(), Ops.ALIAS, this, alias); }
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { ois.readObject(); try { Field constructor = ConstructorExpression.class.getDeclaredField("constructor"); constructor.setAccessible(true); constructor.set(this, getConstructor(getType(), parameterTypes)); Field transformers = ConstructorExpression.class.getDeclaredField("transformers"); transformers.setAccessible(true); transformers.set(this, getTransformers(this.constructor)); } catch (Exception e) { throw new RuntimeException(e); } }
/** * Create an alias for the expression * * @return alias expression */ public Expression<T> as(String alias) { return as(ExpressionUtils.path(getType(), alias)); }
protected ConstructorExpression(Class<? extends T> type, Class<?>[] paramTypes, ImmutableList<Expression<?>> args) { super(type); try { this.parameterTypes = getConstructorParameters(type, paramTypes).clone(); this.args = args; this.constructor = getConstructor(getType(), parameterTypes); this.transformers = getTransformers(constructor); } catch (NoSuchMethodException e) { throw new IllegalArgumentException(e); } }