Interface PropertyValued

  • All Known Subinterfaces:
    LogicalGraph, LogicalSubgraph
    All Known Implementing Classes:
    OpenComposite, OpenModelSink, OpenModelSource, OpenMultiModelSink, OpenMultiModelSource, OpenMultiRecordSink, OpenMultiRecordSource, OpenRecordSink, OpenRecordSource

    public interface PropertyValued
    Shared interface implemented by LogicalGraph and OpenComposite. Both graphs and OpenComposites support getting and setting of properties of the operators that are contained within. This is normally used in-conjunction with JSON parsing, where there is a graph defined via JSON and you needs to override properties defined in the JSON. For example:
         //create a json parser
         JSON jsonParser= new JSON();
         
         //parse json from a file into a LogicalGraph.
         //For this example, assume the json contains a ReadDelimitedText
         //operator named "reader"
         String json= FileUtil.readFileString(new File(file), charset);
         LogicalGraph graph= jsonParser.parse(json, LogicalGraph.class);
         
         //override the reader's source to use a different file
         graph.setProperty("reader.source","c:/myinput.txt");
         
         //run the graph
         graph.run();
     
    Clients should generally not need to implement this interface.
    • Method Detail

      • getProperty

        Object getProperty​(GraphPath path)
        Returns a property of the given path. Paths are of the form operatorPath.propertyName", where operatorPath is the name of an operator that was added to this graph and propertyName is the name of a property of the object.
        Parameters:
        path - the path to the property.
        Returns:
        the value of the property
      • getProperty

        Object getProperty​(String path)
        Returns a property of the given path. Paths are of the form operatorPath.propertyName", where operatorPath is the name of an operator that was added to this graph and propertyName is the name of a property of the object.
        Parameters:
        path - the path to the property.
        Returns:
        the value of the property
      • setProperty

        void setProperty​(GraphPath path,
                         Object value)
        Sets a property of the given path. Paths are of the form operatorPath.propertyName", where operatorPath is the name of an operator that was added to this graph and propertyName is the name of a property of the object.
        Parameters:
        path - the path to the property.
        value - the new value of the property
      • setProperty

        void setProperty​(String path,
                         Object value)
        Sets a property of the given path. Paths are of the form operatorPath.propertyName", where operatorPath is the name of an operator that was added to this graph and propertyName is the name of a property of the object.
        Parameters:
        path - the path to the property.
        value - the new value of the property