Class GetImpl<I,​O,​E extends java.lang.Exception>

  • All Implemented Interfaces:
    Get<I,​O,​E>

    public final class GetImpl<I,​O,​E extends java.lang.Exception>
    extends java.lang.Object
    implements Get<I,​O,​E>
    • Constructor Summary

      Constructors 
      Constructor Description
      GetImpl​(java.lang.Class<I> startType, PropertyPath<O,​I,​E> selector)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <X> GetAndApply<I,​O,​X,​E> andApply​(java.util.function.Function<O,​X> mapping)
      Specifies a mapping function that is applied if the getter returned a non-null value.
      protected static <I,​X,​E extends java.lang.Exception>
      com.remondis.propertypath.impl.TypedTransitiveProperty<I,​X,​E>
      buildTransitiveProperty​(java.lang.Class<I> startType, PropertyPath<X,​I,​E> selector)  
      boolean equals​(java.lang.Object obj)  
      java.util.Optional<O> from​(I object)
      Evaluates the property path on the specified object.
      O fromOrDefault​(I object, O defaultValue)
      Evaluates the property path on the specified object.
      protected java.lang.Class<I> getStartType()  
      protected com.remondis.propertypath.impl.TypedTransitiveProperty<I,​O,​E> getTransitiveProperty()  
      int hashCode()  
      java.lang.String toPath()  
      java.lang.String toString()  
      java.lang.String toString​(boolean detailed)  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • GetImpl

        public GetImpl​(java.lang.Class<I> startType,
                       PropertyPath<O,​I,​E> selector)
    • Method Detail

      • andApply

        public <X> GetAndApply<I,​O,​X,​E> andApply​(java.util.function.Function<O,​X> mapping)
        Description copied from interface: Get
        Specifies a mapping function that is applied if the getter returned a non-null value. The mapping function can be used for calculations or type conversions.
        Specified by:
        andApply in interface Get<I,​O,​E extends java.lang.Exception>
        Type Parameters:
        X - The new return type of the getter after applying the mapping function.
        Parameters:
        mapping - The mapping function - only applied if the getter has a non-null return value.
        Returns:
        Returns a new object for further configuration.
      • from

        public java.util.Optional<O> from​(I object)
                                   throws E extends java.lang.Exception
        Description copied from interface: Get
        Evaluates the property path on the specified object.
        Specified by:
        from in interface Get<I,​O,​E extends java.lang.Exception>
        Parameters:
        object - The object to evaluate the property path on.
        Returns:
        Returns the value of the property wrapped in an Optional.
        Throws:
        E - May be thrown by the property path.
        E extends java.lang.Exception
      • getTransitiveProperty

        protected com.remondis.propertypath.impl.TypedTransitiveProperty<I,​O,​E> getTransitiveProperty()
        Returns:
        Returns the TypedTransitiveProperty used to evaluate asserts.
      • getStartType

        protected java.lang.Class<I> getStartType()
      • buildTransitiveProperty

        protected static <I,​X,​E extends java.lang.Exception> com.remondis.propertypath.impl.TypedTransitiveProperty<I,​X,​E> buildTransitiveProperty​(java.lang.Class<I> startType,
                                                                                                                                                                           PropertyPath<X,​I,​E> selector)
      • fromOrDefault

        public O fromOrDefault​(I object,
                               O defaultValue)
                        throws E extends java.lang.Exception
        Description copied from interface: Get
        Evaluates the property path on the specified object. If a value is present it will be returned, otherwise the specified default value is returned.
        Specified by:
        fromOrDefault in interface Get<I,​O,​E extends java.lang.Exception>
        Parameters:
        object - The object to evaluate the property path on.
        defaultValue - The default value to return in case the property path does not have a value.
        Returns:
        If a value is present it will be returned, otherwise the specified default value is returned.
        Throws:
        E - May be thrown by the property path.
        E extends java.lang.Exception
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toString

        public java.lang.String toString​(boolean detailed)
        Specified by:
        toString in interface Get<I,​O,​E extends java.lang.Exception>
        Returns:
        Returns a detailed string if specified, otherwise a shorter string is returned.
      • toPath

        public java.lang.String toPath()
        Specified by:
        toPath in interface Get<I,​O,​E extends java.lang.Exception>
        Returns:
        Returns a JSON-like property path. Example: a.b.cs[0].d