src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java

Print this page




 795     }
 796 
 797     /**
 798      * Low level property API (not using property descriptors)
 799      * <p>
 800      * Find a property in the prototype hierarchy. Note: this is not a good idea
 801      * to override except as it was done in {@link WithObject}.
 802      * If you have to, use
 803      * {jdk.nashorn.internal.objects.NativeArray{@link #getProperty(String)} or
 804      * {jdk.nashorn.internal.objects.NativeArray{@link #getPropertyDescriptor(String)} as the
 805      * overriding way to find array properties
 806      *
 807      * @see jdk.nashorn.internal.objects.NativeArray
 808      *
 809      * @param key  Property key.
 810      * @param deep Whether the search should look up proto chain.
 811      * @param start the object on which the lookup was originally initiated
 812      *
 813      * @return FindPropertyData or null if not found.
 814      */
 815     FindProperty findProperty(final String key, final boolean deep, final ScriptObject start) {
 816 
 817         final PropertyMap selfMap  = getMap();
 818         final Property    property = selfMap.findProperty(key);
 819 
 820         if (property != null) {
 821             return new FindProperty(start, this, property);
 822         }
 823 
 824         if (deep) {
 825             final ScriptObject myProto = getProto();
 826             if (myProto != null) {
 827                 return myProto.findProperty(key, deep, start);
 828             }
 829         }
 830 
 831         return null;
 832     }
 833 
 834     /**
 835      * Low level property API. This is similar to {@link #findProperty(String, boolean)} but returns a




 795     }
 796 
 797     /**
 798      * Low level property API (not using property descriptors)
 799      * <p>
 800      * Find a property in the prototype hierarchy. Note: this is not a good idea
 801      * to override except as it was done in {@link WithObject}.
 802      * If you have to, use
 803      * {jdk.nashorn.internal.objects.NativeArray{@link #getProperty(String)} or
 804      * {jdk.nashorn.internal.objects.NativeArray{@link #getPropertyDescriptor(String)} as the
 805      * overriding way to find array properties
 806      *
 807      * @see jdk.nashorn.internal.objects.NativeArray
 808      *
 809      * @param key  Property key.
 810      * @param deep Whether the search should look up proto chain.
 811      * @param start the object on which the lookup was originally initiated
 812      *
 813      * @return FindPropertyData or null if not found.
 814      */
 815     protected FindProperty findProperty(final String key, final boolean deep, final ScriptObject start) {
 816 
 817         final PropertyMap selfMap  = getMap();
 818         final Property    property = selfMap.findProperty(key);
 819 
 820         if (property != null) {
 821             return new FindProperty(start, this, property);
 822         }
 823 
 824         if (deep) {
 825             final ScriptObject myProto = getProto();
 826             if (myProto != null) {
 827                 return myProto.findProperty(key, deep, start);
 828             }
 829         }
 830 
 831         return null;
 832     }
 833 
 834     /**
 835      * Low level property API. This is similar to {@link #findProperty(String, boolean)} but returns a