Class Mode


  • public class Mode
    extends java.lang.Object
    A Mode object controls whether persistent objects can be created or reused by an assembler. Their methods are expected to be called when an assembler is about to create a new object (because no object with the given name exists) or reuse an existing one (because one does).

    The default behaviour of the methods is dictated by booleans bound into the mode object. Subclasses of mode may exploit the ability to inspect the name of the object or its other RDF properties.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Mode ANY
      Mode that permits existing objects to be reused and new objects to be created.
      static Mode CREATE
      Mode that demands a new object be created and no existing object should exist.
      static Mode DEFAULT
      Default mode; existing objects are reused, new objects are not created
      static Mode REUSE
      Mode that requires that objects should already exist; new objects cannot be created.
    • Constructor Summary

      Constructors 
      Constructor Description
      Mode​(boolean mayCreate, boolean mayReuse)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean permitCreateNew​(Resource root, java.lang.String name)
      Answer true if the object root with the given name can be created if it does not already exist.
      boolean permitUseExisting​(Resource root, java.lang.String name)
      Answer true if the existing object root with the given name can be reused.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • CREATE

        public static final Mode CREATE
        Mode that demands a new object be created and no existing object should exist.
      • DEFAULT

        public static final Mode DEFAULT
        Default mode; existing objects are reused, new objects are not created
      • REUSE

        public static final Mode REUSE
        Mode that requires that objects should already exist; new objects cannot be created.
      • ANY

        public static final Mode ANY
        Mode that permits existing objects to be reused and new objects to be created.
    • Constructor Detail

      • Mode

        public Mode​(boolean mayCreate,
                    boolean mayReuse)
    • Method Detail

      • permitCreateNew

        public boolean permitCreateNew​(Resource root,
                                       java.lang.String name)
        Answer true if the object root with the given name can be created if it does not already exist.
      • permitUseExisting

        public boolean permitUseExisting​(Resource root,
                                         java.lang.String name)
        Answer true if the existing object root with the given name can be reused.