private Representation GetRepresentation(object r) { if (r == null) { return(ValueRepresentation.String(null)); } if (r is Path) { return(new PathRepresentation <>(( Path )r)); } if (r is System.Collections.IEnumerable) { return(HandleIterable((System.Collections.IEnumerable)r)); } if (r is Node) { return(new NodeRepresentation(( Node )r)); } if (r is Relationship) { return(new RelationshipRepresentation(( Relationship )r)); } return(_representationDispatcher.dispatch(r, "")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void canProvideJsonOutputFormat() public virtual void CanProvideJsonOutputFormat() { OutputFormat format = _repository.outputFormat(new IList <MediaType> { MediaType.APPLICATION_JSON_TYPE }, null, null); assertNotNull(format); assertEquals("\"test\"", format.Assemble(ValueRepresentation.String("test"))); }
internal static Representation GetSingleRepresentation(object result) { if (result == null) { return(ValueRepresentation.OfNull()); } else if (result is GraphDatabaseService) { return(new DatabaseRepresentation()); } else if (result is Node) { return(new NodeRepresentation(( Node )result)); } else if (result is Relationship) { return(new RelationshipRepresentation(( Relationship )result)); } else if (result is double? || result is float?) { return(ValueRepresentation.number((( Number )result).doubleValue())); } else if (result is long?) { return(ValueRepresentation.number((( long? )result).Value)); } else if (result is int?) { return(ValueRepresentation.number((( int? )result).Value)); } else if (result is bool?) { return(ValueRepresentation.Bool((( bool? )result).Value)); } else { return(ValueRepresentation.String(result.ToString())); } }
protected internal override Representation underlyingObjectToObject(string directionString) { return(ValueRepresentation.String(directionString)); }
public virtual ValueRepresentation User() { return(ValueRepresentation.String(_user.name())); }
protected internal override void Serialize(MappingSerializer serializer) { if (_indexDefinition.NodeIndex) { serializer.PutList("labels", new ListRepresentation(RepresentationType.String, map(label => ValueRepresentation.String(label.name()), _indexDefinition.Labels))); if (!_indexDefinition.MultiTokenIndex) { serializer.PutString("label", single(_indexDefinition.Labels).name()); } } else { serializer.PutList("relationshipTypes", new ListRepresentation(RepresentationType.String, map(relType => ValueRepresentation.String(relType.name()), _indexDefinition.RelationshipTypes))); if (!_indexDefinition.MultiTokenIndex) { serializer.PutString("relationshipType", single(_indexDefinition.RelationshipTypes).name()); } } System.Func <string, Representation> converter = ValueRepresentation.@string; IEnumerable <Representation> propertyKeyRepresentations = map(converter, _indexDefinition.PropertyKeys); serializer.PutList("property_keys", new ListRepresentation(RepresentationType.String, propertyKeyRepresentations)); // Only print state and progress if progress is a valid value and not yet online if (_indexState == Org.Neo4j.Graphdb.schema.Schema_IndexState.Populating) { serializer.PutString("state", _indexState.name()); serializer.PutString("population_progress", string.Format("{0,1:F0}%", _indexPopulationProgress.CompletedPercentage)); } }
public ValueRepresentation ExtendedEntity() { return(ValueRepresentation.String(ExtendedEntity)); }
public ValueRepresentation Description() { return(ValueRepresentation.String(_description)); }
public ValueRepresentation MethodName() { return(ValueRepresentation.String(_name)); }