@Override public boolean equals (Object obj) { if (obj == null) { return false; } if (!(obj instanceof CsdlApply)) { return false; } CsdlApply annotApply = (CsdlApply) obj; return (this.getFunction() == null ? annotApply.getFunction() == null : this.getFunction().equals(annotApply.getFunction())) && (this.getParameters() == null ? annotApply.getParameters() == null : checkParamaters(annotApply.getParameters())) && (this.getAnnotations() == null ? annotApply.getAnnotations() == null : checkAnnotations(annotApply.getAnnotations())); }
private boolean checkParamaters(List<CsdlExpression> annotApplyParams) { if (annotApplyParams == null) { return false; } if (this.getParameters().size() == annotApplyParams.size()) { for (int i = 0; i < this.getParameters().size(); i++) { if (!this.getParameters().get(i).equals(annotApplyParams.get(i))) { return false; } } } else { return false; } return true; }
@Override public String getFunction() { if (function == null) { if (csdlExp.getFunction() == null) { throw new EdmException("An Apply expression must specify a function."); } function = csdlExp.getFunction(); } return function; }
write(target, expr); } else if ("Apply".equals(name)) { CsdlApply expr = new CsdlApply(); expr.setFunction(attr(element, "Function")); readExpressions(reader, element, expr); write(target, expr);
private boolean checkAnnotations(List<CsdlAnnotation> annotApplyannotations) { if (annotApplyannotations == null) { return false; } if (this.getAnnotations().size() == annotApplyannotations.size()) { for (int i = 0; i < this.getAnnotations().size(); i++) { if (!this.getAnnotations().get(i).equals(annotApplyannotations.get(i))) { return false; } } } else { return false; } return true; }
@Override public List<EdmExpression> getParameters() { if (parameters == null) { List<EdmExpression> localParameters = new ArrayList<EdmExpression>(); if (csdlExp.getParameters() != null) { for (CsdlExpression param : csdlExp.getParameters()) { localParameters.add(getExpression(edm, param)); } } parameters = Collections.unmodifiableList(localParameters); } return parameters; }
@Override public String getFunction() { if (function == null) { if (csdlExp.getFunction() == null) { throw new EdmException("An Apply expression must specify a function."); } function = csdlExp.getFunction(); } return function; }
write(target, expr); } else if ("Apply".equals(name)) { CsdlApply expr = new CsdlApply(); expr.setFunction(attr(element, "Function")); readExpressions(reader, element, expr); write(target, expr);
@Override public List<EdmExpression> getParameters() { if (parameters == null) { List<EdmExpression> localParameters = new ArrayList<EdmExpression>(); if (csdlExp.getParameters() != null) { for (CsdlExpression param : csdlExp.getParameters()) { localParameters.add(getExpression(edm, param)); } } parameters = Collections.unmodifiableList(localParameters); } return parameters; }
private <T> void write(T t, CsdlExpression expr) throws XMLStreamException { if(t instanceof CsdlAnnotation) { ((CsdlAnnotation)t).setExpression(expr); } else if (t instanceof CsdlUrlRef) { ((CsdlUrlRef)t).setValue(expr); } else if (t instanceof CsdlCast) { ((CsdlCast)t).setValue(expr); } else if (t instanceof CsdlLabeledElement) { ((CsdlLabeledElement)t).setValue(expr); } else if (t instanceof CsdlIsOf) { ((CsdlIsOf)t).setValue(expr); } else if (t instanceof CsdlCollection) { ((CsdlCollection)t).getItems().add(((CsdlCollection)t).getItems().size(), expr); } else if (t instanceof CsdlApply) { ((CsdlApply)t).getParameters().add(expr); } else if (t instanceof CsdlIf) { if (((CsdlIf)t).getGuard() == null) { ((CsdlIf)t).setGuard(expr); } else if (((CsdlIf)t).getThen() == null) { ((CsdlIf)t).setThen(expr); } else { ((CsdlIf)t).setElse(expr); } } else if (t instanceof CsdlPropertyValue) { ((CsdlPropertyValue)t).setValue(expr); } else { throw new XMLStreamException("Unknown expression parent in Annoatation"); } }
private <T> void write(T t, CsdlExpression expr) throws XMLStreamException { if(t instanceof CsdlAnnotation) { ((CsdlAnnotation)t).setExpression(expr); } else if (t instanceof CsdlUrlRef) { ((CsdlUrlRef)t).setValue(expr); } else if (t instanceof CsdlCast) { ((CsdlCast)t).setValue(expr); } else if (t instanceof CsdlLabeledElement) { ((CsdlLabeledElement)t).setValue(expr); } else if (t instanceof CsdlIsOf) { ((CsdlIsOf)t).setValue(expr); } else if (t instanceof CsdlCollection) { ((CsdlCollection)t).getItems().add(((CsdlCollection)t).getItems().size(), expr); } else if (t instanceof CsdlApply) { ((CsdlApply)t).getParameters().add(expr); } else if (t instanceof CsdlIf) { if (((CsdlIf)t).getGuard() == null) { ((CsdlIf)t).setGuard(expr); } else if (((CsdlIf)t).getThen() == null) { ((CsdlIf)t).setThen(expr); } else { ((CsdlIf)t).setElse(expr); } } else if (t instanceof CsdlPropertyValue) { ((CsdlPropertyValue)t).setValue(expr); } else { throw new XMLStreamException("Unknown expression parent in Annoatation"); } }