Package org.eclipse.xtext.xbase.lib
Class ObjectExtensions
- java.lang.Object
-
- org.eclipse.xtext.xbase.lib.ObjectExtensions
-
@GwtCompatible public class ObjectExtensions extends java.lang.ObjectThis is an extension library for allobjects.
-
-
Constructor Summary
Constructors Constructor Description ObjectExtensions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanidentityEquals(java.lang.Object a, java.lang.Object b)Returnstrueifaandbare identical (the same instance) or bothnull.static <T> Toperator_doubleArrow(T object, Procedures.Procedure1<? super T> block)ThedoubleArrowoperator is used as a 'with'- or 'let'-operation.static <T> Toperator_elvis(T first, T second)The elvis operator?:is a short hand notation for providing default value in case an expression evaluates tonull.static booleanoperator_equals(java.lang.Object a, java.lang.Object b)Theequalsoperator.static <A,B>
Pair<A,B>operator_mappedTo(A a, B b)static booleanoperator_notEquals(java.lang.Object a, java.lang.Object b)Theequals notoperator.static java.lang.Stringoperator_plus(java.lang.Object a, java.lang.String b)The binary+operator that concatenates two strings.static booleanoperator_tripleEquals(java.lang.Object a, java.lang.Object b)Theidentity equalsoperator.static booleanoperator_tripleNotEquals(java.lang.Object a, java.lang.Object b)Theidentity not equalsoperator.
-
-
-
Method Detail
-
operator_notEquals
@Pure public static boolean operator_notEquals(java.lang.Object a, java.lang.Object b)
Theequals notoperator. This is the equivalent to a negated, null-safeObject.equals(Object)method.- Parameters:
a- an object.b- another object.- Returns:
trueifaandbare not equal.
-
operator_equals
@Pure public static boolean operator_equals(java.lang.Object a, java.lang.Object b)
Theequalsoperator. This is the equivalent to a null-safe invocation ofObject.equals(Object).- Parameters:
a- an object.b- another object.- Returns:
trueifaandbare equal.
-
identityEquals
@Pure public static boolean identityEquals(java.lang.Object a, java.lang.Object b)
Returnstrueifaandbare identical (the same instance) or bothnull. This is the equivalent to Java's==operator.- Parameters:
a- an object.b- another object.- Returns:
- Java's
a == b
-
operator_tripleEquals
@Pure public static boolean operator_tripleEquals(java.lang.Object a, java.lang.Object b)
Theidentity equalsoperator. This is the equivalent to Java's==operator.- Parameters:
a- an object.b- another object.- Returns:
- Java's
a == b - Since:
- 2.4
-
operator_tripleNotEquals
@Pure public static boolean operator_tripleNotEquals(java.lang.Object a, java.lang.Object b)
Theidentity not equalsoperator. This is the equivalent to Java's!=operator.- Parameters:
a- an object.b- another object.- Returns:
- Java's
a != b - Since:
- 2.4
-
operator_mappedTo
@Pure public static <A,B> Pair<A,B> operator_mappedTo(A a, B b)
- Parameters:
a- an object.b- another object.- Returns:
- a
Pair. Nevernull.
-
operator_doubleArrow
public static <T> T operator_doubleArrow(T object, Procedures.Procedure1<? super T> block)ThedoubleArrowoperator is used as a 'with'- or 'let'-operation. It allows to bind an object to a local scope in order to do something on it. Example:new Person => [ firstName = 'Han' lastName = 'Solo' ]- Parameters:
object- an object. Can benull.block- the block to execute with the given object. Must not benull.- Returns:
- the reference to object.
- Since:
- 2.3
-
operator_plus
@Pure public static java.lang.String operator_plus(java.lang.Object a, java.lang.String b)
The binary+operator that concatenates two strings.- Parameters:
a- anObject.b- aString.- Returns:
a + b- Since:
- 2.3
-
operator_elvis
@Pure public static <T> T operator_elvis(T first, T second)
The elvis operator?:is a short hand notation for providing default value in case an expression evaluates tonull. Not that the Xtend compiler will inline calls to this not call this method with a short-circuit semantic. That is the second argument is only evaluated if the first one evaluates tonull. Example:person.name?:'Hans'- Parameters:
first- anObject. Might benull.second- anObject. Might benull.- Returns:
- a reference to
firstiffirst != null,secondotherwise, - Since:
- 2.3
-
-