Tutorials, extensions, and source files for ActionScript, Flash, and other Adobe products.

 

senocular.com ActionScript Library

XMLDefinitionFilter.as

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package com.senocular.xml {

	/**
	 * XMLDefinitionFilter instances are used with the create method
	 * of the XMLDefinition class.  Instances of XMLDefinitionFilter
	 * define for an object type used in XMLDefinition.create() what 
	 * properties are included or excluded from the resulting XML or
	 * what properties should be marked as a definition property. These
	 * properties are defined in an object passed to the constructor
	 * of a new XMLDefinitionFilter instance.  Using the defaultType
	 * parameter, you can also dictate what the default property
	 * behavior is.  Property types include INCLUDE, EXCLUDE, and
	 * PROPERTY and are saved as static constants within this class.
	 */
	public class XMLDefinitionFilter {
		
		/**
		 * Value for indicating that an object's property
		 * should be included in generated definition XML.
		 */
		public static const INCLUDE:String = "include";
		/**
		 * Value for indicating that an object's property
		 * should be excluded from generated definition XML.
		 */
		public static const EXCLUDE:String = "exclude";
		/**
		 * Value for indicating that an object's property
		 * should be defined as definition property in XML.
		 */
		public static const PROPERTY:String = "property";
		
		// class properties are only accessible
		// from definitions within this package
		internal var qualifiedClassName:String;
		internal var properties:Object;
		internal var defaultType:Object;
		
		/**
		 * Constructor; creates a new XMLDefinitionFilter.
		 * @param qualifiedClassName The fully qualifiedClassName class name
		 * 		of the object type being filtered.  This is in the form of
		 * 		PackagePath::ClassName or the string returned by 
		 * 		getQualifiedClassName().
		 * @param properties A generic object of the type Object with 
		 * 		properties relating to the target type's properties.  The
		 * 		value of those properties within this object determine if the
		 * 		property is included, excluded, or defined as a property in
		 * 		the XML generated by XMLDefinition.create().
		 * @param defaultType The default filter type for properties not
		 * 		referenced in the properties object.  By default this is
		 * 		XMLDefinitionFilter.INCLUDE.
		 */
		public function XMLDefinitionFilter(qualifiedClassName:String, properties:Object, defaultType:String = INCLUDE) {
			this.qualifiedClassName = qualifiedClassName;
			this.properties = properties;
			this.defaultType = defaultType;
		}
	}
}