public class PreferredConstructor<T,P extends PersistentProperty<P>> extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PreferredConstructor.Parameter<T,P extends PersistentProperty<P>>
Value object to represent constructor parameters.
|
Constructor and Description |
---|
PreferredConstructor(Constructor<T> constructor,
PreferredConstructor.Parameter<Object,P>... parameters)
|
Modifier and Type | Method and Description |
---|---|
Constructor<T> |
getConstructor()
Returns the underlying
Constructor . |
List<PreferredConstructor.Parameter<Object,P>> |
getParameters()
Returns the
PreferredConstructor.Parameter s of the constructor. |
boolean |
hasParameters()
Returns whether the constructor has
PreferredConstructor.Parameter s. |
boolean |
isConstructorParameter(PersistentProperty<?> property)
Returns whether the given
PersistentProperty is referenced in a constructor argument of the
PersistentEntity backing this PreferredConstructor . |
boolean |
isEnclosingClassParameter(PreferredConstructor.Parameter<?,P> parameter)
Returns whether the given
PreferredConstructor.Parameter is one referring to an enclosing class. |
boolean |
isExplicitlyAnnotated()
Returns whether the constructor was explicitly selected (by
PersistenceConstructor ). |
boolean |
isNoArgConstructor()
Returns whether the constructor does not have any arguments.
|
@SafeVarargs public PreferredConstructor(Constructor<T> constructor, PreferredConstructor.Parameter<Object,P>... parameters)
constructor
- must not be null.parameters
- must not be null.public Constructor<T> getConstructor()
Constructor
.public List<PreferredConstructor.Parameter<Object,P>> getParameters()
PreferredConstructor.Parameter
s of the constructor.public boolean hasParameters()
PreferredConstructor.Parameter
s.isNoArgConstructor()
public boolean isNoArgConstructor()
hasParameters()
public boolean isExplicitlyAnnotated()
PersistenceConstructor
).public boolean isConstructorParameter(PersistentProperty<?> property)
PersistentProperty
is referenced in a constructor argument of the
PersistentEntity
backing this PreferredConstructor
.
Results of this call are cached and reused on the next invocation. Calling this method for a
PersistentProperty
that was not yet added to its owning PersistentEntity
will capture that state
and return the same result after adding PersistentProperty
to its entity.
property
- must not be null.PersistentProperty
is used in the constructor.public boolean isEnclosingClassParameter(PreferredConstructor.Parameter<?,P> parameter)
PreferredConstructor.Parameter
is one referring to an enclosing class. That is in case the class this
PreferredConstructor
belongs to is a member class actually. If that's the case the compiler creates a first
constructor argument of the enclosing class type.parameter
- must not be null.PersistentProperty
maps to the enclosing class.Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.