Interface BsonParcelable

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  BsonParcelable.Builder
      Internal class to create and populate the instance serialized into the bson document.
    • Method Summary

      Modifier and Type Method Description
      default java.lang.Object fromBson​(java.lang.Class expectedDataType, java.lang.Class keyType, java.lang.Class collectionDataType, org.hcjf.bson.BsonElement element)
      Creates a instance using the expected data type and bson element.
      default java.util.Map fromBson​(java.lang.Class expectedKeyType, java.lang.Class expectedValueType, org.hcjf.bson.BsonDocument document)
      Returns a map instance from a bson document.
      default java.util.Collection fromBson​(java.lang.Class expectedCollectionType, org.hcjf.bson.BsonArray array)
      Returns a collection instance from a bson array.
      default <P extends BsonParcelable>
      P
      populate​(org.hcjf.bson.BsonDocument document)
      Populate the current instance of parcelable with all the information into the bson document.
      default org.hcjf.bson.BsonDocument toBson()
      Returns the bson representation of the instance.
      default org.hcjf.bson.BsonElement toBson​(java.lang.String name, java.lang.Object value)
      Returns a bson representation of a object.
      default org.hcjf.bson.BsonArray toBson​(java.lang.String name, java.util.Collection collection)
      Returns a bson representation of a collection.
      default org.hcjf.bson.BsonDocument toBson​(java.lang.String name, java.util.Map map)
      Returns a bson representation of a map.
      default java.lang.Class typeFromBson​(java.lang.Class expectedType, org.hcjf.bson.BsonElement element)
      This method verify if the expected data type is valid, if it is not valid then trying to deduct the data type from information into the bson element.
    • Method Detail

      • toBson

        default org.hcjf.bson.BsonDocument toBson()
        Returns the bson representation of the instance.
        Returns:
        Bson representation.
      • toBson

        default org.hcjf.bson.BsonDocument toBson​(java.lang.String name,
                                                  java.util.Map map)
        Returns a bson representation of a map.
        Parameters:
        name - Name of the map.
        map - Map instance.
        Returns:
        Bson representation.
      • toBson

        default org.hcjf.bson.BsonArray toBson​(java.lang.String name,
                                               java.util.Collection collection)
        Returns a bson representation of a collection.
        Parameters:
        name - Name of the collection.
        collection - Collection instance.
        Returns:
        Bson representation.
      • toBson

        default org.hcjf.bson.BsonElement toBson​(java.lang.String name,
                                                 java.lang.Object value)
        Returns a bson representation of a object.
        Parameters:
        name - Name of the object.
        value - Object instance.
        Returns:
        Bson representation.
      • populate

        default <P extends BsonParcelable> P populate​(org.hcjf.bson.BsonDocument document)
        Populate the current instance of parcelable with all the information into the bson document.
        Type Parameters:
        P - Expected parcelable type.
        Parameters:
        document - Bson document to populate the parcelable.
        Returns:
        Return the same instance that was populated.
      • fromBson

        default java.util.Map fromBson​(java.lang.Class expectedKeyType,
                                       java.lang.Class expectedValueType,
                                       org.hcjf.bson.BsonDocument document)
        Returns a map instance from a bson document.
        Parameters:
        document - Bson document to create the map instance.
        expectedKeyType - Expected key type.
        expectedValueType - Expected value type.
        Returns:
        Map instance.
      • fromBson

        default java.util.Collection fromBson​(java.lang.Class expectedCollectionType,
                                              org.hcjf.bson.BsonArray array)
        Returns a collection instance from a bson array.
        Parameters:
        array - Bson array to create the collection instance.
        expectedCollectionType - Expected data type for map's or collection's values.
        Returns:
        Collection instance.
      • fromBson

        default java.lang.Object fromBson​(java.lang.Class expectedDataType,
                                          java.lang.Class keyType,
                                          java.lang.Class collectionDataType,
                                          org.hcjf.bson.BsonElement element)
        Creates a instance using the expected data type and bson element.
        Parameters:
        expectedDataType - Expected result data type.
        element - Bson element.
        keyType - Expected data type for map's key.
        collectionDataType - Expected data type for map's or collection's values.
        Returns:
        Object instance.
      • typeFromBson

        default java.lang.Class typeFromBson​(java.lang.Class expectedType,
                                             org.hcjf.bson.BsonElement element)
        This method verify if the expected data type is valid, if it is not valid then trying to deduct the data type from information into the bson element.
        Parameters:
        expectedType - Expected data type.
        element - Bson element.
        Returns:
        Valid data type.