| 1 | // ================================================================================================= |
| 2 | // ADOBE SYSTEMS INCORPORATED |
| 3 | // Copyright 2006 Adobe Systems Incorporated |
| 4 | // All Rights Reserved |
| 5 | // |
| 6 | // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms |
| 7 | // of the Adobe license agreement accompanying it. |
| 8 | // ================================================================================================= |
| 9 | |
| 10 | package com.adobe.internal.xmp.options; |
| 11 | |
| 12 | |
| 13 | /** |
| 14 | * Options for <code>XMPIterator</code> construction. |
| 15 | * |
| 16 | * @author Stefan Makswit |
| 17 | * @version $Revision$ |
| 18 | * @since 24.01.2006 |
| 19 | */ |
| 20 | public final class IteratorOptions extends Options |
| 21 | { |
| 22 | /** Just do the immediate children of the root, default is subtree. */ |
| 23 | public static final int JUST_CHILDREN = 0x0100; |
| 24 | /** Just do the leaf nodes, default is all nodes in the subtree. |
| 25 | * Bugfix #2658965: If this option is set the Iterator returns the namespace |
| 26 | * of the leaf instead of the namespace of the base property. */ |
| 27 | public static final int JUST_LEAFNODES = 0x0200; |
| 28 | /** Return just the leaf part of the path, default is the full path. */ |
| 29 | public static final int JUST_LEAFNAME = 0x0400; |
| 30 | // /** Include aliases, default is just actual properties. <em>Note:</em> Not supported. |
| 31 | // * @deprecated it is commonly preferred to work with the base properties */ |
| 32 | // public static final int INCLUDE_ALIASES = 0x0800; |
| 33 | /** Omit all qualifiers. */ |
| 34 | public static final int OMIT_QUALIFIERS = 0x1000; |
| 35 | |
| 36 | |
| 37 | /** |
| 38 | * @return Returns whether the option is set. |
| 39 | */ |
| 40 | public boolean isJustChildren() |
| 41 | { |
| 42 | return getOption(JUST_CHILDREN); |
| 43 | } |
| 44 | |
| 45 | |
| 46 | /** |
| 47 | * @return Returns whether the option is set. |
| 48 | */ |
| 49 | public boolean isJustLeafname() |
| 50 | { |
| 51 | return getOption(JUST_LEAFNAME); |
| 52 | } |
| 53 | |
| 54 | |
| 55 | /** |
| 56 | * @return Returns whether the option is set. |
| 57 | */ |
| 58 | public boolean isJustLeafnodes() |
| 59 | { |
| 60 | return getOption(JUST_LEAFNODES); |
| 61 | } |
| 62 | |
| 63 | |
| 64 | /** |
| 65 | * @return Returns whether the option is set. |
| 66 | */ |
| 67 | public boolean isOmitQualifiers() |
| 68 | { |
| 69 | return getOption(OMIT_QUALIFIERS); |
| 70 | } |
| 71 | |
| 72 | |
| 73 | /** |
| 74 | * Sets the option and returns the instance. |
| 75 | * |
| 76 | * @param value the value to set |
| 77 | * @return Returns the instance to call more set-methods. |
| 78 | */ |
| 79 | public IteratorOptions setJustChildren(boolean value) |
| 80 | { |
| 81 | setOption(JUST_CHILDREN, value); |
| 82 | return this; |
| 83 | } |
| 84 | |
| 85 | |
| 86 | /** |
| 87 | * Sets the option and returns the instance. |
| 88 | * |
| 89 | * @param value the value to set |
| 90 | * @return Returns the instance to call more set-methods. |
| 91 | */ |
| 92 | public IteratorOptions setJustLeafname(boolean value) |
| 93 | { |
| 94 | setOption(JUST_LEAFNAME, value); |
| 95 | return this; |
| 96 | } |
| 97 | |
| 98 | |
| 99 | /** |
| 100 | * Sets the option and returns the instance. |
| 101 | * |
| 102 | * @param value the value to set |
| 103 | * @return Returns the instance to call more set-methods. |
| 104 | */ |
| 105 | public IteratorOptions setJustLeafnodes(boolean value) |
| 106 | { |
| 107 | setOption(JUST_LEAFNODES, value); |
| 108 | return this; |
| 109 | } |
| 110 | |
| 111 | |
| 112 | /** |
| 113 | * Sets the option and returns the instance. |
| 114 | * |
| 115 | * @param value the value to set |
| 116 | * @return Returns the instance to call more set-methods. |
| 117 | */ |
| 118 | public IteratorOptions setOmitQualifiers(boolean value) |
| 119 | { |
| 120 | setOption(OMIT_QUALIFIERS, value); |
| 121 | return this; |
| 122 | } |
| 123 | |
| 124 | |
| 125 | /** |
| 126 | * @see Options#defineOptionName(int) |
| 127 | */ |
| 128 | protected String defineOptionName(int option) |
| 129 | { |
| 130 | switch (option) |
| 131 | { |
| 132 | case JUST_CHILDREN : return "JUST_CHILDREN"; |
| 133 | case JUST_LEAFNODES : return "JUST_LEAFNODES"; |
| 134 | case JUST_LEAFNAME : return "JUST_LEAFNAME"; |
| 135 | case OMIT_QUALIFIERS : return "OMIT_QUALIFIERS"; |
| 136 | default: return null; |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | |
| 141 | /** |
| 142 | * @see Options#getValidOptions() |
| 143 | */ |
| 144 | protected int getValidOptions() |
| 145 | { |
| 146 | return |
| 147 | JUST_CHILDREN | |
| 148 | JUST_LEAFNODES | |
| 149 | JUST_LEAFNAME | |
| 150 | OMIT_QUALIFIERS; |
| 151 | } |
| 152 | } |