Package org.hcjf.layers.query
Class JoinableMap
- java.lang.Object
-
- org.hcjf.layers.query.JoinableMap
-
- All Implemented Interfaces:
java.util.Map<java.lang.String,java.lang.Object>,Enlarged,Groupable,Joinable,BsonParcelable
public class JoinableMap extends java.lang.Object implements Joinable, Groupable, Enlarged, BsonParcelable, java.util.Map<java.lang.String,java.lang.Object>
This is a wrapper of map implementation wit the joinable implementation.- Author:
- javaito
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJoinableMap.GroupableSetThis private class is only to knows if the set implementation into the groupable object is because the groupable object was grouped whit other instance or the set is domains information.static classJoinableMap.JoinableEntry<K,V>-
Nested classes/interfaces inherited from interface org.hcjf.utils.bson.BsonParcelable
BsonParcelable.Builder
-
-
Field Summary
-
Fields inherited from interface org.hcjf.utils.bson.BsonParcelable
MAP_KEYS_FIELD_NAME, MAP_VALUES_FIELD_NAME, PARCELABLE_CLASS_NAME
-
-
Constructor Summary
Constructors Constructor Description JoinableMap()JoinableMap(java.lang.String resourceName)JoinableMap(java.util.Map<java.lang.String,java.lang.Object> mapInstance, java.lang.String... fields)
-
Method Summary
Modifier and Type Method Description voidclear()Remove all the elements of the groupable object.Enlargedclone(java.lang.String... fields)Clone the joinable map instance.EnlargedcloneEmpty()Clone the joinable map without domain information.java.lang.Objectcompute(java.lang.String key, java.util.function.BiFunction<? super java.lang.String,? super java.lang.Object,?> remappingFunction)java.lang.ObjectcomputeIfAbsent(java.lang.String key, java.util.function.Function<? super java.lang.String,?> mappingFunction)java.lang.ObjectcomputeIfPresent(java.lang.String key, java.util.function.BiFunction<? super java.lang.String,? super java.lang.Object,?> remappingFunction)booleancontainsKey(java.lang.Object key)booleancontainsResource(java.lang.String resourceName)Verify if the joinable map instance contains a specific resource.booleancontainsValue(java.lang.Object value)java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>>entrySet()booleanequals(java.lang.Object o)voidforEach(java.util.function.BiConsumer<? super java.lang.String,? super java.lang.Object> action)java.lang.Objectget(java.lang.Object key)java.lang.Objectget(java.lang.String fieldName)Return the value of the field name.java.lang.ObjectgetOrDefault(java.lang.Object key, java.lang.Object defaultValue)java.util.Map<java.lang.String,java.lang.Object>getResourceModel(java.lang.String resourceName)Returns a part of the model that represents a specific resource.java.util.Set<java.lang.String>getResources()Returns the set of resources.Groupablegroup(Groupable groupable)Group this instance with the parameter instance.inthashCode()booleanisEmpty()Joinablejoin(java.lang.String leftResource, java.lang.String rightResource, Joinable joinable)Join the information stored into this instance of the joinable with the informacion stored into the joinable parameter.java.util.Set<java.lang.String>keySet()Returns all the labels into the groupable instance.java.lang.Objectmerge(java.lang.String key, java.lang.Object value, java.util.function.BiFunction<? super java.lang.Object,? super java.lang.Object,?> remappingFunction)<P extends BsonParcelable>
Ppopulate(org.hcjf.bson.BsonDocument document)This method populate the joinable map with the information into the bson document.voidpurge()This method remove all the fields that it's not staticjava.lang.Objectput(java.lang.String key, java.lang.Object value)Add a new value to the instance.voidputAll(java.util.Map<? extends java.lang.String,?> m)java.lang.ObjectputIfAbsent(java.lang.String key, java.lang.Object value)java.lang.Objectremove(java.lang.Object key)booleanremove(java.lang.Object key, java.lang.Object value)java.lang.Objectreplace(java.lang.String key, java.lang.Object value)booleanreplace(java.lang.String key, java.lang.Object oldValue, java.lang.Object newValue)voidreplaceAll(java.util.function.BiFunction<? super java.lang.String,? super java.lang.Object,?> function)voidsetResource(java.lang.String resourceName)intsize()org.hcjf.bson.BsonDocumenttoBson()Creates a bson document from the JoinableMap instance.java.lang.StringtoString()Write all the elements of the map.java.util.Collection<java.lang.Object>values()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hcjf.utils.bson.BsonParcelable
fromBson, fromBson, fromBson, toBson, toBson, toBson, typeFromBson
-
-
-
-
Method Detail
-
toBson
public org.hcjf.bson.BsonDocument toBson()
Creates a bson document from the JoinableMap instance.- Specified by:
toBsonin interfaceBsonParcelable- Returns:
- Bson document instance.
-
populate
public <P extends BsonParcelable> P populate(org.hcjf.bson.BsonDocument document)
This method populate the joinable map with the information into the bson document.- Specified by:
populatein interfaceBsonParcelable- Type Parameters:
P- Expected BsonParcelable data type.- Parameters:
document- Bson document to populate the parcelable.- Returns:
- Returns the bson parcelable instance.
-
purge
public void purge()
This method remove all the fields that it's not static
-
clone
public Enlarged clone(java.lang.String... fields)
Clone the joinable map instance.
-
cloneEmpty
public Enlarged cloneEmpty()
Clone the joinable map without domain information.- Specified by:
cloneEmptyin interfaceEnlarged- Returns:
- Joinable map clone.
-
get
public java.lang.Object get(java.lang.String fieldName)
Return the value of the field name.
-
setResource
public void setResource(java.lang.String resourceName)
-
join
public Joinable join(java.lang.String leftResource, java.lang.String rightResource, Joinable joinable)
Join the information stored into this instance of the joinable with the informacion stored into the joinable parameter.- Specified by:
joinin interfaceJoinable- Parameters:
leftResource- Name of the left resource of the join.rightResource- Name of the right resource of the join.joinable- Joinable parameter.- Returns:
- Return this instance of the joinable.
- Throws:
java.lang.IllegalArgumentException- if the joinable parameter is not a JoinableMap instance.java.lang.NullPointerException- if the joinable parameter is null.
-
containsResource
public boolean containsResource(java.lang.String resourceName)
Verify if the joinable map instance contains a specific resource.- Parameters:
resourceName- Resource name- Returns:
- Return true of the resource is present into the instance nad false in the otherwise.
-
getResourceModel
public java.util.Map<java.lang.String,java.lang.Object> getResourceModel(java.lang.String resourceName)
Returns a part of the model that represents a specific resource.- Parameters:
resourceName- Resource name.- Returns:
- Part of the model.
-
getResources
public java.util.Set<java.lang.String> getResources()
Returns the set of resources.- Returns:
- Set of resources.
-
group
public Groupable group(Groupable groupable)
Description copied from interface:GroupableGroup this instance with the parameter instance.
-
toString
public final java.lang.String toString()
Write all the elements of the map.- Overrides:
toStringin classjava.lang.Object- Returns:
- Map print.
-
size
public int size()
- Specified by:
sizein interfacejava.util.Map<java.lang.String,java.lang.Object>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfacejava.util.Map<java.lang.String,java.lang.Object>
-
containsKey
public boolean containsKey(java.lang.Object key)
- Specified by:
containsKeyin interfacejava.util.Map<java.lang.String,java.lang.Object>
-
containsValue
public boolean containsValue(java.lang.Object value)
- Specified by:
containsValuein interfacejava.util.Map<java.lang.String,java.lang.Object>
-
get
public java.lang.Object get(java.lang.Object key)
- Specified by:
getin interfacejava.util.Map<java.lang.String,java.lang.Object>
-
put
public java.lang.Object put(java.lang.String key, java.lang.Object value)Description copied from interface:EnlargedAdd a new value to the instance.
-
remove
public java.lang.Object remove(java.lang.Object key)
- Specified by:
removein interfacejava.util.Map<java.lang.String,java.lang.Object>
-
putAll
public void putAll(java.util.Map<? extends java.lang.String,?> m)
- Specified by:
putAllin interfacejava.util.Map<java.lang.String,java.lang.Object>
-
clear
public void clear()
Description copied from interface:GroupableRemove all the elements of the groupable object.
-
keySet
public java.util.Set<java.lang.String> keySet()
Description copied from interface:GroupableReturns all the labels into the groupable instance.
-
values
public java.util.Collection<java.lang.Object> values()
- Specified by:
valuesin interfacejava.util.Map<java.lang.String,java.lang.Object>
-
entrySet
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
- Specified by:
entrySetin interfacejava.util.Map<java.lang.String,java.lang.Object>
-
equals
public boolean equals(java.lang.Object o)
- Specified by:
equalsin interfacejava.util.Map<java.lang.String,java.lang.Object>- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfacejava.util.Map<java.lang.String,java.lang.Object>- Overrides:
hashCodein classjava.lang.Object
-
getOrDefault
public java.lang.Object getOrDefault(java.lang.Object key, java.lang.Object defaultValue)- Specified by:
getOrDefaultin interfacejava.util.Map<java.lang.String,java.lang.Object>
-
forEach
public void forEach(java.util.function.BiConsumer<? super java.lang.String,? super java.lang.Object> action)
- Specified by:
forEachin interfacejava.util.Map<java.lang.String,java.lang.Object>
-
replaceAll
public void replaceAll(java.util.function.BiFunction<? super java.lang.String,? super java.lang.Object,?> function)
- Specified by:
replaceAllin interfacejava.util.Map<java.lang.String,java.lang.Object>
-
putIfAbsent
public java.lang.Object putIfAbsent(java.lang.String key, java.lang.Object value)- Specified by:
putIfAbsentin interfacejava.util.Map<java.lang.String,java.lang.Object>
-
remove
public boolean remove(java.lang.Object key, java.lang.Object value)- Specified by:
removein interfacejava.util.Map<java.lang.String,java.lang.Object>
-
replace
public boolean replace(java.lang.String key, java.lang.Object oldValue, java.lang.Object newValue)- Specified by:
replacein interfacejava.util.Map<java.lang.String,java.lang.Object>
-
replace
public java.lang.Object replace(java.lang.String key, java.lang.Object value)- Specified by:
replacein interfacejava.util.Map<java.lang.String,java.lang.Object>
-
computeIfAbsent
public java.lang.Object computeIfAbsent(java.lang.String key, java.util.function.Function<? super java.lang.String,?> mappingFunction)- Specified by:
computeIfAbsentin interfacejava.util.Map<java.lang.String,java.lang.Object>
-
computeIfPresent
public java.lang.Object computeIfPresent(java.lang.String key, java.util.function.BiFunction<? super java.lang.String,? super java.lang.Object,?> remappingFunction)- Specified by:
computeIfPresentin interfacejava.util.Map<java.lang.String,java.lang.Object>
-
compute
public java.lang.Object compute(java.lang.String key, java.util.function.BiFunction<? super java.lang.String,? super java.lang.Object,?> remappingFunction)- Specified by:
computein interfacejava.util.Map<java.lang.String,java.lang.Object>
-
merge
public java.lang.Object merge(java.lang.String key, java.lang.Object value, java.util.function.BiFunction<? super java.lang.Object,? super java.lang.Object,?> remappingFunction)- Specified by:
mergein interfacejava.util.Map<java.lang.String,java.lang.Object>
-
-