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