com.sun.codemodel.internal.JClassContainer Java Examples
The following examples show how to use
com.sun.codemodel.internal.JClassContainer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BeanGenerator.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Returns all <i>used</i> JPackages. * * A JPackage is considered as "used" if a ClassItem or * a InterfaceItem resides in that package. * * This value is dynamically calculated every time because * one can freely remove ClassItem/InterfaceItem. * * @return * Given the same input, the order of packages in the array * is always the same regardless of the environment. */ public final JPackage[] getUsedPackages(Aspect aspect) { Set<JPackage> s = new TreeSet<JPackage>(); for (CClassInfo bean : model.beans().values()) { JClassContainer cont = getContainer(bean.parent(), aspect); if (cont.isPackage()) { s.add((JPackage) cont); } } for (CElementInfo e : model.getElementMappings(null).values()) { // at the first glance you might think we should be iterating all elements, // not just global ones, but if you think about it, local ones live inside // another class, so those packages are already enumerated when we were // walking over CClassInfos. s.add(e._package()); } return s.toArray(new JPackage[s.size()]); }
Example #2
Source File: BeanGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Returns all <i>used</i> JPackages. * * A JPackage is considered as "used" if a ClassItem or * a InterfaceItem resides in that package. * * This value is dynamically calculated every time because * one can freely remove ClassItem/InterfaceItem. * * @return * Given the same input, the order of packages in the array * is always the same regardless of the environment. */ public final JPackage[] getUsedPackages(Aspect aspect) { Set<JPackage> s = new TreeSet<JPackage>(); for (CClassInfo bean : model.beans().values()) { JClassContainer cont = getContainer(bean.parent(), aspect); if (cont.isPackage()) { s.add((JPackage) cont); } } for (CElementInfo e : model.getElementMappings(null).values()) { // at the first glance you might think we should be iterating all elements, // not just global ones, but if you think about it, local ones live inside // another class, so those packages are already enumerated when we were // walking over CClassInfos. s.add(e._package()); } return s.toArray(new JPackage[s.size()]); }
Example #3
Source File: BeanGenerator.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Returns all <i>used</i> JPackages. * * A JPackage is considered as "used" if a ClassItem or * a InterfaceItem resides in that package. * * This value is dynamically calculated every time because * one can freely remove ClassItem/InterfaceItem. * * @return * Given the same input, the order of packages in the array * is always the same regardless of the environment. */ public final JPackage[] getUsedPackages(Aspect aspect) { Set<JPackage> s = new TreeSet<JPackage>(); for (CClassInfo bean : model.beans().values()) { JClassContainer cont = getContainer(bean.parent(), aspect); if (cont.isPackage()) { s.add((JPackage) cont); } } for (CElementInfo e : model.getElementMappings(null).values()) { // at the first glance you might think we should be iterating all elements, // not just global ones, but if you think about it, local ones live inside // another class, so those packages are already enumerated when we were // walking over CClassInfos. s.add(e._package()); } return s.toArray(new JPackage[s.size()]); }
Example #4
Source File: SignatureWriter.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private void dumpChildren( JClassContainer cont ) throws IOException { Iterator itr = cont.classes(); while(itr.hasNext()) { JDefinedClass cls = (JDefinedClass)itr.next(); ClassOutline ci = classSet.get(cls); if(ci!=null) dump(ci); } }
Example #5
Source File: CodeModelClassFactory.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Create a dummy class to recover from an error. * * We won't generate the code, so the client will never see this class * getting generated. */ private JDefinedClass createDummyClass(JClassContainer parent) { try { return parent._class("$$$garbage$$$"+(ticketMaster++)); } catch( JClassAlreadyExistsException ee ) { return ee.getExistingClass(); } }
Example #6
Source File: BeanGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public JClassContainer getContainer(CClassInfoParent parent, Aspect aspect) { CClassInfoParent.Visitor<JClassContainer> v; switch (aspect) { case EXPOSED: v = exposedContainerBuilder; break; case IMPLEMENTATION: v = implContainerBuilder; break; default: assert false; throw new IllegalStateException(); } return parent.accept(v); }
Example #7
Source File: BeanGenerator.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public JClassContainer getContainer(CClassInfoParent parent, Aspect aspect) { CClassInfoParent.Visitor<JClassContainer> v; switch (aspect) { case EXPOSED: v = exposedContainerBuilder; break; case IMPLEMENTATION: v = implContainerBuilder; break; default: assert false; throw new IllegalStateException(); } return parent.accept(v); }
Example #8
Source File: BeanGenerator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public JClassContainer getContainer(CClassInfoParent parent, Aspect aspect) { CClassInfoParent.Visitor<JClassContainer> v; switch (aspect) { case EXPOSED: v = exposedContainerBuilder; break; case IMPLEMENTATION: v = implContainerBuilder; break; default: assert false; throw new IllegalStateException(); } return parent.accept(v); }
Example #9
Source File: BeanGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public JClassContainer getContainer(CClassInfoParent parent, Aspect aspect) { CClassInfoParent.Visitor<JClassContainer> v; switch (aspect) { case EXPOSED: v = exposedContainerBuilder; break; case IMPLEMENTATION: v = implContainerBuilder; break; default: assert false; throw new IllegalStateException(); } return parent.accept(v); }
Example #10
Source File: BeanGenerator.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public JClassContainer getContainer(CClassInfoParent parent, Aspect aspect) { CClassInfoParent.Visitor<JClassContainer> v; switch (aspect) { case EXPOSED: v = exposedContainerBuilder; break; case IMPLEMENTATION: v = implContainerBuilder; break; default: assert false; throw new IllegalStateException(); } return parent.accept(v); }
Example #11
Source File: SignatureWriter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private void dumpChildren( JClassContainer cont ) throws IOException { Iterator itr = cont.classes(); while(itr.hasNext()) { JDefinedClass cls = (JDefinedClass)itr.next(); ClassOutline ci = classSet.get(cls); if(ci!=null) dump(ci); } }
Example #12
Source File: CodeModelClassFactory.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Create a dummy class to recover from an error. * * We won't generate the code, so the client will never see this class * getting generated. */ private JDefinedClass createDummyClass(JClassContainer parent) { try { return parent._class("$$$garbage$$$"+(ticketMaster++)); } catch( JClassAlreadyExistsException ee ) { return ee.getExistingClass(); } }
Example #13
Source File: SignatureWriter.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private void dumpChildren( JClassContainer cont ) throws IOException { Iterator itr = cont.classes(); while(itr.hasNext()) { JDefinedClass cls = (JDefinedClass)itr.next(); ClassOutline ci = classSet.get(cls); if(ci!=null) dump(ci); } }
Example #14
Source File: SignatureWriter.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private void dumpChildren( JClassContainer cont ) throws IOException { Iterator itr = cont.classes(); while(itr.hasNext()) { JDefinedClass cls = (JDefinedClass)itr.next(); ClassOutline ci = classSet.get(cls); if(ci!=null) dump(ci); } }
Example #15
Source File: BeanGenerator.java From hottub with GNU General Public License v2.0 | 4 votes |
public JClassContainer onPackage(JPackage pkg) { return model.strategy.getPackage(pkg, Aspect.IMPLEMENTATION); }
Example #16
Source File: BeanGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public JClassContainer onBean(CClassInfo bean) { return getClazz(bean).implClass; }
Example #17
Source File: BeanGenerator.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public JClassContainer onPackage(JPackage pkg) { return model.strategy.getPackage(pkg, EXPOSED); }
Example #18
Source File: BeanGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public JClassContainer onElement(CElementInfo element) { return getElement(element).implClass; }
Example #19
Source File: BeanGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public JClassContainer onPackage(JPackage pkg) { return model.strategy.getPackage(pkg, Aspect.IMPLEMENTATION); }
Example #20
Source File: CodeModelClassFactory.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public JDefinedClass createInterface( JClassContainer parent, String name, Locator source ) { return createInterface( parent, JMod.PUBLIC, name, source ); }
Example #21
Source File: BeanGenerator.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public JClassContainer onElement(CElementInfo element) { return getElement(element).implClass; }
Example #22
Source File: CodeModelClassFactory.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public JDefinedClass createInterface( JClassContainer parent, String name, Locator source ) { return createInterface( parent, JMod.PUBLIC, name, source ); }
Example #23
Source File: BeanGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public JClassContainer onElement(CElementInfo element) { // hmm... return getElement(element).implClass; }
Example #24
Source File: CodeModelClassFactory.java From hottub with GNU General Public License v2.0 | 4 votes |
public JDefinedClass createClass( JClassContainer parent, int mod, String name, Locator source, ClassType kind ) { if(!JJavaName.isJavaIdentifier(name)) { // report the error errorReceiver.error( new SAXParseException( Messages.format( Messages.ERR_INVALID_CLASSNAME, name ), source )); return createDummyClass(parent); } try { if(parent.isClass() && kind==ClassType.CLASS) mod |= JMod.STATIC; JDefinedClass r = parent._class(mod,name,kind); // use the metadata field to store the source location, // so that we can report class name collision errors. r.metadata = source; return r; } catch( JClassAlreadyExistsException e ) { // class collision. JDefinedClass cls = e.getExistingClass(); // report the error errorReceiver.error( new SAXParseException( Messages.format( Messages.ERR_CLASSNAME_COLLISION, cls.fullName() ), (Locator)cls.metadata )); errorReceiver.error( new SAXParseException( Messages.format( Messages.ERR_CLASSNAME_COLLISION_SOURCE, name ), source )); if( !name.equals(cls.name()) ) { // on Windows, FooBar and Foobar causes name collision errorReceiver.error( new SAXParseException( Messages.format( Messages.ERR_CASE_SENSITIVITY_COLLISION, name, cls.name() ), null ) ); } if(Util.equals((Locator)cls.metadata,source)) { errorReceiver.error( new SAXParseException( Messages.format( Messages.ERR_CHAMELEON_SCHEMA_GONE_WILD ), source )); } return createDummyClass(parent); } }
Example #25
Source File: CodeModelClassFactory.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public JDefinedClass createClass( JClassContainer parent, String name, Locator source ) { return createClass( parent, JMod.PUBLIC, name, source ); }
Example #26
Source File: CodeModelClassFactory.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public JDefinedClass createClass( JClassContainer parent, int mod, String name, Locator source, ClassType kind ) { if(!JJavaName.isJavaIdentifier(name)) { // report the error errorReceiver.error( new SAXParseException( Messages.format( Messages.ERR_INVALID_CLASSNAME, name ), source )); return createDummyClass(parent); } try { if(parent.isClass() && kind==ClassType.CLASS) mod |= JMod.STATIC; JDefinedClass r = parent._class(mod,name,kind); // use the metadata field to store the source location, // so that we can report class name collision errors. r.metadata = source; return r; } catch( JClassAlreadyExistsException e ) { // class collision. JDefinedClass cls = e.getExistingClass(); // report the error errorReceiver.error( new SAXParseException( Messages.format( Messages.ERR_CLASSNAME_COLLISION, cls.fullName() ), (Locator)cls.metadata )); errorReceiver.error( new SAXParseException( Messages.format( Messages.ERR_CLASSNAME_COLLISION_SOURCE, name ), source )); if( !name.equals(cls.name()) ) { // on Windows, FooBar and Foobar causes name collision errorReceiver.error( new SAXParseException( Messages.format( Messages.ERR_CASE_SENSITIVITY_COLLISION, name, cls.name() ), null ) ); } if(Util.equals((Locator)cls.metadata,source)) { errorReceiver.error( new SAXParseException( Messages.format( Messages.ERR_CHAMELEON_SCHEMA_GONE_WILD ), source )); } return createDummyClass(parent); } }
Example #27
Source File: CodeModelClassFactory.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public JDefinedClass createInterface( JClassContainer parent, int mod, String name, Locator source ) { return createClass(parent,mod,name,source,ClassType.INTERFACE); }
Example #28
Source File: CodeModelClassFactory.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public JDefinedClass createInterface( JClassContainer parent, int mod, String name, Locator source ) { return createClass(parent,mod,name,source,ClassType.INTERFACE); }
Example #29
Source File: CodeModelClassFactory.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public JDefinedClass createClass( JClassContainer parent, String name, Locator source, ClassType kind ) { return createClass(parent,JMod.PUBLIC,name,source,kind); }
Example #30
Source File: CodeModelClassFactory.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public JDefinedClass createClass( JClassContainer parent, int mod, String name, Locator source ) { return createClass(parent,mod,name,source,ClassType.CLASS); }