Class AbstractJExpr

java.lang.Object
org.jboss.jdeparser.AbstractJExpr
All Implemented Interfaces:
JExpr, Writable
Direct Known Subclasses:
AbstractJAssignableExpr, AbstractJCall, BinaryJExpr, BooleanJExpr, CastJExpr, CharJExpr, CondJExpr, DecimalDoubleJExpr, DecimalFloatJExpr, HexDoubleJExpr, HexFloatJExpr, InstanceOfJExpr, IntegerJExpr, JLambdaImpl, KeywordJExpr, LongJExpr, MethodRefJExpr, NewDimJArrayExpr, ParenJExpr, PlainJArrayExpr, StringJExpr, UnaryJExpr

abstract class AbstractJExpr extends Object implements JExpr, Writable
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    private JExpr
     
    private final int
     

    Fields inherited from interface org.jboss.jdeparser.JExpr

    FALSE, NULL, ONE, THIS, TRUE, ZERO
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractJExpr(int prec)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    _instanceof(Class<?> type)
    Get a type-testing expression using the instanceof operator.
    Get a type-testing expression using the instanceof operator.
    Get a type-testing expression using the instanceof operator.
    _new(Class<?> type)
    Get an expression to construct a new inner class instance of this instance expression.
    _new(String type)
    Get an expression to construct a new inner class instance of this instance expression.
    _new(JType type)
    Get an expression to construct a new inner class instance of this instance expression.
    _newAnon(Class<?> type)
    Construct a new anonymous subclass of the given type, which must be an inner class of the type of this expression.
    Construct a new anonymous subclass of the given type, which must be an inner class of the type of this expression.
    Construct a new anonymous subclass of the given type, which must be an inner class of the type of this expression.
    $v(String name)
    Get a field of this object instance (shorthand for JExpr.field(String).
    and(JExpr e1)
    Combine this expression with another using the binary && operator.
    band(JExpr e1)
    Combine this expression with another using the binary & operator.
    bor(JExpr e1)
    Combine this expression with another using the binary | operator.
    bxor(JExpr e1)
    Combine this expression with another using the binary ^ operator.
    call(String name)
    Call the given method on this expression.
    cast(Class<?> type)
    Get an expression which is a cast of this expression to the given type.
    cast(String type)
    Get an expression which is a cast of this expression to the given type.
    cast(JType type)
    Get an expression which is a cast of this expression to the given type.
    Invert this expression using the unary ~ operator.
    cond(JExpr ifTrue, JExpr ifFalse)
    Combine this expression with two others using the ternary ? : operator.
    div(JExpr e1)
    Combine this expression with another using the binary / operator.
    eq(JExpr e1)
    Combine this expression with another using the binary == operator.
    field(String name)
    Get a field of this object instance.
    ge(JExpr e1)
    Combine this expression with another using the binary >= operator.
    gt(JExpr e1)
    Combine this expression with another using the binary > operator.
    idx(int idx)
    Get an element of this array expression.
    idx(JExpr idx)
    Get an element of this array expression.
    le(JExpr e1)
    Combine this expression with another using the binary <= operator.
    Get the length expression of this array expression.
    lshr(JExpr e1)
    Combine this expression with another using the binary >>> operator.
    lt(JExpr e1)
    Combine this expression with another using the binary < operator.
    Combine this expression with another using the binary - operator.
    mod(JExpr e1)
    Combine this expression with another using the binary % operator.
    ne(JExpr e1)
    Combine this expression with another using the binary != operator.
    neg()
    Negate this expression using the unary - operator.
    not()
    Invert this expression using the unary ! operator.
    (package private) static AbstractJExpr
    of(JExpr expr)
     
    or(JExpr e1)
    Combine this expression with another using the binary || operator.
    Explicitly wrap this expression in parentheses.
    plus(JExpr e1)
    Combine this expression with another using the binary + operator.
    int
     
    shl(JExpr e1)
    Combine this expression with another using the binary << operator.
    shr(JExpr e1)
    Combine this expression with another using the binary >> operator.
    Combine this expression with another using the binary * operator.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.jboss.jdeparser.Writable

    write
  • Field Details

  • Constructor Details

    • AbstractJExpr

      protected AbstractJExpr(int prec)
  • Method Details

    • of

      static AbstractJExpr of(JExpr expr)
    • plus

      public JExpr plus(JExpr e1)
      Description copied from interface: JExpr
      Combine this expression with another using the binary + operator.
      Specified by:
      plus in interface JExpr
      Parameters:
      e1 - the other expression
      Returns:
      the combined expression
    • minus

      public JExpr minus(JExpr e1)
      Description copied from interface: JExpr
      Combine this expression with another using the binary - operator.
      Specified by:
      minus in interface JExpr
      Parameters:
      e1 - the other expression
      Returns:
      the combined expression
    • times

      public JExpr times(JExpr e1)
      Description copied from interface: JExpr
      Combine this expression with another using the binary * operator.
      Specified by:
      times in interface JExpr
      Parameters:
      e1 - the other expression
      Returns:
      the combined expression
    • div

      public JExpr div(JExpr e1)
      Description copied from interface: JExpr
      Combine this expression with another using the binary / operator.
      Specified by:
      div in interface JExpr
      Parameters:
      e1 - the other expression
      Returns:
      the combined expression
    • mod

      public JExpr mod(JExpr e1)
      Description copied from interface: JExpr
      Combine this expression with another using the binary % operator.
      Specified by:
      mod in interface JExpr
      Parameters:
      e1 - the other expression
      Returns:
      the combined expression
    • neg

      public JExpr neg()
      Description copied from interface: JExpr
      Negate this expression using the unary - operator.
      Specified by:
      neg in interface JExpr
      Returns:
      the new expression
    • band

      public JExpr band(JExpr e1)
      Description copied from interface: JExpr
      Combine this expression with another using the binary & operator.
      Specified by:
      band in interface JExpr
      Parameters:
      e1 - the other expression
      Returns:
      the combined expression
    • bor

      public JExpr bor(JExpr e1)
      Description copied from interface: JExpr
      Combine this expression with another using the binary | operator.
      Specified by:
      bor in interface JExpr
      Parameters:
      e1 - the other expression
      Returns:
      the combined expression
    • bxor

      public JExpr bxor(JExpr e1)
      Description copied from interface: JExpr
      Combine this expression with another using the binary ^ operator.
      Specified by:
      bxor in interface JExpr
      Parameters:
      e1 - the other expression
      Returns:
      the combined expression
    • shr

      public JExpr shr(JExpr e1)
      Description copied from interface: JExpr
      Combine this expression with another using the binary >> operator.
      Specified by:
      shr in interface JExpr
      Parameters:
      e1 - the other expression
      Returns:
      the combined expression
    • lshr

      public JExpr lshr(JExpr e1)
      Description copied from interface: JExpr
      Combine this expression with another using the binary >>> operator.
      Specified by:
      lshr in interface JExpr
      Parameters:
      e1 - the other expression
      Returns:
      the combined expression
    • shl

      public JExpr shl(JExpr e1)
      Description copied from interface: JExpr
      Combine this expression with another using the binary << operator.
      Specified by:
      shl in interface JExpr
      Parameters:
      e1 - the other expression
      Returns:
      the combined expression
    • comp

      public JExpr comp()
      Description copied from interface: JExpr
      Invert this expression using the unary ~ operator.
      Specified by:
      comp in interface JExpr
      Returns:
      the new expression
    • and

      public JExpr and(JExpr e1)
      Description copied from interface: JExpr
      Combine this expression with another using the binary && operator.
      Specified by:
      and in interface JExpr
      Parameters:
      e1 - the other expression
      Returns:
      the combined expression
    • or

      public JExpr or(JExpr e1)
      Description copied from interface: JExpr
      Combine this expression with another using the binary || operator.
      Specified by:
      or in interface JExpr
      Parameters:
      e1 - the other expression
      Returns:
      the combined expression
    • not

      public JExpr not()
      Description copied from interface: JExpr
      Invert this expression using the unary ! operator.
      Specified by:
      not in interface JExpr
      Returns:
      the new expression
    • eq

      public JExpr eq(JExpr e1)
      Description copied from interface: JExpr
      Combine this expression with another using the binary == operator.
      Specified by:
      eq in interface JExpr
      Parameters:
      e1 - the other expression
      Returns:
      the combined expression
    • ne

      public JExpr ne(JExpr e1)
      Description copied from interface: JExpr
      Combine this expression with another using the binary != operator.
      Specified by:
      ne in interface JExpr
      Parameters:
      e1 - the other expression
      Returns:
      the combined expression
    • lt

      public JExpr lt(JExpr e1)
      Description copied from interface: JExpr
      Combine this expression with another using the binary < operator.
      Specified by:
      lt in interface JExpr
      Parameters:
      e1 - the other expression
      Returns:
      the combined expression
    • gt

      public JExpr gt(JExpr e1)
      Description copied from interface: JExpr
      Combine this expression with another using the binary > operator.
      Specified by:
      gt in interface JExpr
      Parameters:
      e1 - the other expression
      Returns:
      the combined expression
    • le

      public JExpr le(JExpr e1)
      Description copied from interface: JExpr
      Combine this expression with another using the binary <= operator.
      Specified by:
      le in interface JExpr
      Parameters:
      e1 - the other expression
      Returns:
      the combined expression
    • ge

      public JExpr ge(JExpr e1)
      Description copied from interface: JExpr
      Combine this expression with another using the binary >= operator.
      Specified by:
      ge in interface JExpr
      Parameters:
      e1 - the other expression
      Returns:
      the combined expression
    • cond

      public JExpr cond(JExpr ifTrue, JExpr ifFalse)
      Description copied from interface: JExpr
      Combine this expression with two others using the ternary ? : operator.
      Specified by:
      cond in interface JExpr
      Parameters:
      ifTrue - the true expression branch
      ifFalse - the false expression branch
      Returns:
      the combined expression
    • paren

      public JExpr paren()
      Description copied from interface: JExpr
      Explicitly wrap this expression in parentheses.
      Specified by:
      paren in interface JExpr
      Returns:
      the wrapped expression
    • _instanceof

      public JExpr _instanceof(String type)
      Description copied from interface: JExpr
      Get a type-testing expression using the instanceof operator.
      Specified by:
      _instanceof in interface JExpr
      Parameters:
      type - the type to test
      Returns:
      the expression
    • _instanceof

      public JExpr _instanceof(JType type)
      Description copied from interface: JExpr
      Get a type-testing expression using the instanceof operator.
      Specified by:
      _instanceof in interface JExpr
      Parameters:
      type - the type to test
      Returns:
      the expression
    • _instanceof

      public JExpr _instanceof(Class<?> type)
      Description copied from interface: JExpr
      Get a type-testing expression using the instanceof operator.
      Specified by:
      _instanceof in interface JExpr
      Parameters:
      type - the type to test
      Returns:
      the expression
    • cast

      public JExpr cast(String type)
      Description copied from interface: JExpr
      Get an expression which is a cast of this expression to the given type.
      Specified by:
      cast in interface JExpr
      Parameters:
      type - the type to cast to
      Returns:
      the expression
    • cast

      public JExpr cast(JType type)
      Description copied from interface: JExpr
      Get an expression which is a cast of this expression to the given type.
      Specified by:
      cast in interface JExpr
      Parameters:
      type - the type to cast to
      Returns:
      the expression
    • cast

      public JExpr cast(Class<?> type)
      Description copied from interface: JExpr
      Get an expression which is a cast of this expression to the given type.
      Specified by:
      cast in interface JExpr
      Parameters:
      type - the type to cast to
      Returns:
      the expression
    • call

      public JCall call(String name)
      Description copied from interface: JExpr
      Call the given method on this expression.
      Specified by:
      call in interface JExpr
      Parameters:
      name - the method name
      Returns:
      the method call
    • _new

      public JCall _new(String type)
      Description copied from interface: JExpr
      Get an expression to construct a new inner class instance of this instance expression.
      Specified by:
      _new in interface JExpr
      Parameters:
      type - the inner class type to construct
      Returns:
      the new constructor call
    • _new

      public JCall _new(JType type)
      Description copied from interface: JExpr
      Get an expression to construct a new inner class instance of this instance expression.
      Specified by:
      _new in interface JExpr
      Parameters:
      type - the inner class type to construct
      Returns:
      the new constructor call
    • _new

      public JCall _new(Class<?> type)
      Description copied from interface: JExpr
      Get an expression to construct a new inner class instance of this instance expression.
      Specified by:
      _new in interface JExpr
      Parameters:
      type - the inner class type to construct
      Returns:
      the new constructor call
    • _newAnon

      public JAnonymousClassDef _newAnon(String type)
      Description copied from interface: JExpr
      Construct a new anonymous subclass of the given type, which must be an inner class of the type of this expression.
      Specified by:
      _newAnon in interface JExpr
      Parameters:
      type - the type of object to construct
      Returns:
      the anonymous subclass definition
    • _newAnon

      public JAnonymousClassDef _newAnon(JType type)
      Description copied from interface: JExpr
      Construct a new anonymous subclass of the given type, which must be an inner class of the type of this expression.
      Specified by:
      _newAnon in interface JExpr
      Parameters:
      type - the type of object to construct
      Returns:
      the anonymous subclass definition
    • _newAnon

      public JAnonymousClassDef _newAnon(Class<?> type)
      Description copied from interface: JExpr
      Construct a new anonymous subclass of the given type, which must be an inner class of the type of this expression.
      Specified by:
      _newAnon in interface JExpr
      Parameters:
      type - the type of object to construct
      Returns:
      the anonymous subclass definition
    • field

      public JAssignableExpr field(String name)
      Description copied from interface: JExpr
      Get a field of this object instance.
      Specified by:
      field in interface JExpr
      Parameters:
      name - the field name
      Returns:
      the expression
    • $v

      public JAssignableExpr $v(String name)
      Description copied from interface: JExpr
      Get a field of this object instance (shorthand for JExpr.field(String).
      Specified by:
      $v in interface JExpr
      Parameters:
      name - the field name
      Returns:
      the expression
    • idx

      public JAssignableExpr idx(JExpr idx)
      Description copied from interface: JExpr
      Get an element of this array expression.
      Specified by:
      idx in interface JExpr
      Parameters:
      idx - the array index expression
      Returns:
      the array dereference expression
    • idx

      public JExpr idx(int idx)
      Description copied from interface: JExpr
      Get an element of this array expression.
      Specified by:
      idx in interface JExpr
      Parameters:
      idx - the array index
      Returns:
      the array dereference expression
    • length

      public JExpr length()
      Description copied from interface: JExpr
      Get the length expression of this array expression.
      Specified by:
      length in interface JExpr
      Returns:
      the length expression
    • prec

      public int prec()