Interface CtSynchronized

All Superinterfaces:
Cloneable, CtCodeElement, CtElement, CtQueryable, CtStatement, CtVisitable, FactoryAccessor, Serializable, SourcePositionHolder
All Known Implementing Classes:
CtSynchronizedImpl

public interface CtSynchronized extends CtStatement
This code element defines a synchronized statement. Example:
    java.util.List l = new java.util.ArrayList();
    synchronized(l) {
        System.out.println("foo");
    }
 
  • Method Details

    • getExpression

      CtExpression<?> getExpression()
      Gets the expression that defines the monitored object if any.
      Returns:
      the monitored object if defined, null otherwise
    • setExpression

      <T extends CtSynchronized> T setExpression(CtExpression<?> expression)
      Sets the expression that defines the monitored.
    • getBlock

      CtBlock<?> getBlock()
      Gets the synchronized block.
    • setBlock

      <T extends CtSynchronized> T setBlock(CtBlock<?> block)
      Sets the synchronized block.
    • clone

      Description copied from interface: CtElement
      Clone the element which calls this method in a new object. Note that that references are kept as is, and thus, so if you clone whole classes or methods, some parts of the cloned element (eg executable references) may still point to the initial element. In this case, consider using methods Refactoring.copyType(CtType) and Refactoring.copyMethod(CtMethod) instead which does additional work beyond cloning.
      Specified by:
      clone in interface CtCodeElement
      Specified by:
      clone in interface CtElement
      Specified by:
      clone in interface CtStatement