@Override
 public boolean isCollection() {
   if (keyPredicates != null) {
     return false;
   }
   return function.getReturnType().isCollection();
 }
 @Override
 public String getSegmentValue() {
   if (functionImport != null) {
     return functionImport.getName();
   } else if (function != null) {
     return function.getName();
   }
   return "";
 }
 @Override
 public String toString() {
   if (functionImport != null) {
     return functionImport.getName();
   } else if (function != null) {
     return function.getName();
   }
   return "";
 }
  private void appendFunctions(final XMLStreamWriter writer, final List<EdmFunction> functions)
      throws XMLStreamException {
    for (EdmFunction function : functions) {
      writer.writeStartElement(XML_FUNCTION);
      writer.writeAttribute(XML_NAME, function.getName());
      if (function.getEntitySetPath() != null) {
        writer.writeAttribute(XML_ENTITY_SET_PATH, function.getEntitySetPath());
      }
      if (function.isBound()) {
        writer.writeAttribute(XML_IS_BOUND, "" + function.isBound());
      }

      if (function.isComposable()) {
        writer.writeAttribute(XML_IS_COMPOSABLE, "" + function.isComposable());
      }

      appendOperationParameters(writer, function);

      appendOperationReturnType(writer, function);

      writer.writeEndElement();
    }
  }
 @Override
 public EdmType getType() {
   return function.getReturnType().getType();
 }