java.lang.Object
org.eclipse.xtext.xbase.lib.ObjectExtensions
This is an extension library for all
objects.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanidentityEquals(Object a, 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(Object a, Object b) Theequalsoperator.static <A,B> Pair<A, B> operator_mappedTo(A a, B b) static booleanoperator_notEquals(Object a, Object b) Theequals notoperator.static Stringoperator_plus(Object a, String b) The binary+operator that concatenates two strings.static booleanTheidentity equalsoperator.static booleanTheidentity not equalsoperator.
-
Constructor Details
-
ObjectExtensions
public ObjectExtensions()
-
-
Method Details
-
operator_notEquals
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
Theequalsoperator. This is the equivalent to a null-safe invocation ofObject.equals(Object).- Parameters:
a- an object.b- another object.- Returns:
trueifaandbare equal.
-
identityEquals
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
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
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
- Parameters:
a- an object.b- another object.- Returns:
- a
Pair. Nevernull.
-
operator_doubleArrow
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
The binary+operator that concatenates two strings. -
operator_elvis
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'
-