Package cc.carm.lib.easyannotation
Class AnnotatedMetaHolder
- java.lang.Object
-
- cc.carm.lib.easyannotation.AnnotatedMetaHolder
-
public class AnnotatedMetaHolder extends java.lang.ObjectA data holder for annotation meta.- Version:
- 1.0.0
- Author:
- CarmJos
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<AnnotatedMetaType<?,?>,java.lang.Object>values
-
Constructor Summary
Constructors Constructor Description AnnotatedMetaHolder()AnnotatedMetaHolder(java.util.Map<AnnotatedMetaType<?,?>,java.lang.Object> values)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <V> Vget(@NotNull AnnotatedMetaType<?,V> type)Get the value of option.<V> Vget(@NotNull AnnotatedMetaType<?,V> type, V defaultValue)Get the value of option.java.util.Map<AnnotatedMetaType<?,?>,java.lang.Object>getValues()booleanhas(@NotNull AnnotatedMetaType<?,?> type)protected voidput(@NotNull AnnotatedMetaType<?,?> type, @Nullable java.lang.Object value)<V> Vset(@NotNull AnnotatedMetaType<?,V> type, V value)Set the value of meta, if the value is null, the meta will be removed.<V> voidsetIfAbsent(@NotNull AnnotatedMetaType<?,V> type, V value)Set the value of meta, if the value is null, the meta will not be changed.<V> VsetIfPresent(@NotNull AnnotatedMetaType<?,V> type, V value)Set the value of meta, if the value is null, the meta will not be changed.
-
-
-
Field Detail
-
values
protected final java.util.Map<AnnotatedMetaType<?,?>,java.lang.Object> values
-
-
Constructor Detail
-
AnnotatedMetaHolder
public AnnotatedMetaHolder()
-
AnnotatedMetaHolder
public AnnotatedMetaHolder(java.util.Map<AnnotatedMetaType<?,?>,java.lang.Object> values)
-
-
Method Detail
-
getValues
public java.util.Map<AnnotatedMetaType<?,?>,java.lang.Object> getValues()
-
get
@Contract("_, !null -> !null") @Nullable public <V> V get(@NotNull @NotNull AnnotatedMetaType<?,V> type, @Nullable V defaultValue)Get the value of option.- Type Parameters:
V- Value type- Parameters:
type-AnnotatedMetaTypedefaultValue- Default value if the value of option is not set.- Returns:
- Value of option
-
get
@Nullable public <V> V get(@NotNull @NotNull AnnotatedMetaType<?,V> type)Get the value of option.- Type Parameters:
V- Value type- Parameters:
type-AnnotatedMetaType- Returns:
- Value of option
-
has
public boolean has(@NotNull @NotNull AnnotatedMetaType<?,?> type)
-
set
@Nullable public <V> V set(@NotNull @NotNull AnnotatedMetaType<?,V> type, @Nullable V value)Set the value of meta, if the value is null, the meta will be removed.
Will only be changed in current holder.- Type Parameters:
V- Value type- Parameters:
type-AnnotatedMetaTypevalue- Value of meta- Returns:
- Previous value of meta
-
setIfAbsent
public <V> void setIfAbsent(@NotNull @NotNull AnnotatedMetaType<?,V> type, @Nullable V value)Set the value of meta, if the value is null, the meta will not be changed.
Will only be changed in current holder.- Type Parameters:
V- Value type- Parameters:
type-AnnotatedMetaTypevalue- Value of meta
-
setIfPresent
@Nullable public <V> V setIfPresent(@NotNull @NotNull AnnotatedMetaType<?,V> type, @Nullable V value)Set the value of meta, if the value is null, the meta will not be changed.
Will only be changed in current holder.- Type Parameters:
V- Value type- Parameters:
type-AnnotatedMetaTypevalue- Value of meta
-
put
protected void put(@NotNull @NotNull AnnotatedMetaType<?,?> type, @Nullable @Nullable java.lang.Object value)
-
-