/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Container for customization declarations.
*
* We use JAXB ourselves and parse this object from "xs:annotation".
*
* @author
* Kohsuke Kawaguchi (kohsuke,kawaguchi@sun.com)
*/
/**
* Documentation taken from <xs:documentation>s.
*/
/**
* Returns true if this {@link BindInfo} doesn't contain any useful
* information.
*
* This flag is used to discard unused {@link BindInfo}s early to save memory footprint.
*/
public boolean isPointless() {
if(size()>0) return false;
return false;
return true;
}
private static final class Documentation {
}
}
/** list of individual declarations. */
private static final class AppInfo {
/**
* Receives {@link BIDeclaration}s and other DOMs.
*/
if(o instanceof BIDeclaration)
// this is really PITA! I can't get the source location
if(o instanceof DomHandlerEx.DomAndLocation) {
continue; // this is definitely not a customization
}
}
}
}
// only used by JAXB
}
/**
* Gets the location of this annotation in the source file.
*
* @return
* If the declarations are in fact specified in the source
* code, a non-null valid object will be returned.
* If this BindInfo is generated internally by XJC, then
* null will be returned.
*/
/**
* Sets the owner schema component and a reference to BGMBuilder.
* This method is called from the BGMBuilder before
* any BIDeclaration inside it is used.
*/
for (BIDeclaration d : decls)
d.onSetOwner();
}
/**
* Back pointer to the BGMBuilder which is building
* a BGM from schema components including this customization.
*/
/** Adds a new declaration. */
}
/**
* Gets the first declaration with a given name, or null
* if none is found.
*/
public <T extends BIDeclaration>
}
return null; // not found
}
/**
* Gets all the declarations
*/
}
/**
* Gets the documentation parsed from <xs:documentation>s.
* The returned collection is to be added to {@link JDocComment#append(Object)}.
* @return maybe null.
*/
// TODO: FIXME: correctly turn individual items to String including DOM
if(c instanceof String) {
}
if(c instanceof Element) {
StringWriter w = new StringWriter();
try {
char[] buf = new char[1];
public void write(int c) throws IOException {
buf[0] = (char)c;
}
}
}
};
} catch (TransformerException e) {
throw new Error(e); // impossible
}
}
}
}
/**
* Merges all the declarations inside the given BindInfo
* to this BindInfo.
*/
for( BIDeclaration d : bi )
d.setParent(this);
if(this.documentation==null)
else
}
/** Gets the number of declarations. */
}
/**
* Gets the list of {@link CPluginCustomization}s from this.
*
* <p>
* Note that calling this method marks all those plug-in customizations
* as 'used'. So call it only when it's really necessary.
*/
for( BIDeclaration d : this ) {
if(d instanceof BIXPluginCustomization) {
continue; // this isn't a plugin customization
if(r==null)
r = new CCustomizations();
}
}
return new CCustomizations(r);
}
/** An instance with the empty contents. */
/**
* Lazily prepared {@link JAXBContext}.
*/
synchronized(AnnotationParserFactoryImpl.class) {
try {
if(customizationContext==null)
new Class[] {
BindInfo.class, // for xs:annotation
BIClass.class,
BIConversion.User.class,
BIConversion.UserAdapter.class,
BIDom.class,
BIFactoryMethod.class,
BIInlineBinaryData.class,
BIXDom.class,
BIXSubstitutable.class,
BIEnum.class,
BIEnumMember.class,
BIGlobalBinding.class,
BIProperty.class,
BISchemaBinding.class
}).build();
return customizationContext;
} catch (JAXBException e) {
throw new AssertionError(e);
}
}
}
/**
* Lazily parsed schema for the binding file.
*/
public static final SchemaCache bindingFileSchema = new SchemaCache(BindInfo.class.getResource("binding.xsd"));
}