Examples of ClassDescriptor


Examples of org.codehaus.metaclass.model.ClassDescriptor

    public ClassDescriptor getClassDescriptor( final String classname,
                                               final ClassLoader classLoader,
                                               final MetaClassAccessor accessor )
        throws MetaClassException
    {
        final ClassDescriptor descriptor = (ClassDescriptor)m_descriptors.get( classname );
        if( null == descriptor )
        {
            final String message = "Missing descriptor for " + classname;
            throw new MetaClassException( message );
        }
View Full Code Here

Examples of org.codehaus.metaclass.model.ClassDescriptor

    {
        final Attribute[] attributes = new Attribute[]
        {
            new Attribute( "dna.component" ),
        };
        return new ClassDescriptor( classname,
                                    attributes,
                                    attributes,
                                    FieldDescriptor.EMPTY_SET,
                                    MethodDescriptor.EMPTY_SET );
    }
View Full Code Here

Examples of org.eclipse.persistence.descriptors.ClassDescriptor

                    getUnmarshaller().getUnmarshalListener().afterUnmarshal(currentObject, null);
                }
            }

            // HANDLE POST BUILD EVENTS
            ClassDescriptor xmlDescriptor = treeObjectBuilder.getDescriptor();
            if(xmlDescriptor.hasEventManager()) {
                DescriptorEventManager eventManager = xmlDescriptor.getEventManager();
                if (null != eventManager && eventManager.hasAnyEventListeners()) {
                    DescriptorEvent event = new DescriptorEvent(currentObject);
                    event.setSession(session);
                    event.setRecord(this);
                    event.setEventCode(DescriptorEventManager.PostBuildEvent);
                    eventManager.executeEvent(event);
                }
            }
        } catch (EclipseLinkException e) {
            if (null == xmlReader.getErrorHandler()) {
                throw e;
            } else {
                SAXParseException saxParseException = new SAXParseException(null, null, null, 0, 0, e);
                xmlReader.getErrorHandler().error(saxParseException);
            }
        }

        // if the object has any primary key fields set, add it to the cache
        if (session.isUnitOfWork()) {
            ClassDescriptor xmlDescriptor = treeObjectBuilder.getDescriptor();
            if(null != xmlDescriptor) {
                List primaryKeyFields = xmlDescriptor.getPrimaryKeyFields();
                if(null != primaryKeyFields) {
                    int primaryKeyFieldsSize = primaryKeyFields.size();
                    if (primaryKeyFieldsSize > 0) {
                        Object pk = treeObjectBuilder.extractPrimaryKeyFromObject(currentObject, session);
                        for (int x=0; x<primaryKeyFieldsSize; x++) {
                            Object value = ((CacheId)pk).getPrimaryKey()[x];
                            if (null == value) {
                                XMLField pkField = (XMLField) xmlDescriptor.getPrimaryKeyFields().get(x);
                                ((CacheId)pk).set(x, getUnmarshaller().getXMLContext().getValueByXPath(currentObject, pkField.getXPath(), pkField.getNamespaceResolver(), Object.class));
                            }
                        }
                        CacheKey key = session.getIdentityMapAccessorInstance().acquireDeferredLock(pk, xmlDescriptor.getJavaClass(), xmlDescriptor);
                        key.setRecord(this);
                        key.setObject(currentObject);
                        key.releaseDeferredLock();
                    }
                }
View Full Code Here

Examples of org.exolab.castor.mapping.ClassDescriptor

                        && ((classMapping.getClassChoice() == null)
                                || (classMapping.getClassChoice().getFieldMappingCount() == 0))
                                && (classMapping.getIdentityCount() == 0)) {
                    // If we make it here we simply try to load a compiled mapping
                    try {
                        ClassDescriptor clsDesc =
                            getInternalContext()
                            .getXMLClassDescriptorResolver().resolve(classMapping.getName());
                        if (clsDesc != null) { return clsDesc; }
                    } catch (ResolverException e) {
                        if (LOG.isDebugEnabled()) {
                            String message =
                                new StringBuffer().append("Ignoring exception: ").append(e)
                                .append(" at resolving: ").append(classMapping.getName()).toString();
                            LOG.debug(message);
                        }
                    }
                }
            }
           
            // Obtain the Java class.
            Class javaClass = resolveType(classMapping.getName());
            if (classMapping.getVerifyConstructable()) {
                if (!Types.isConstructable(javaClass, true)) {
                    throw new MappingException(
                            "mapping.classNotConstructable", javaClass.getName());
                }
            }
            xmlClassDesc.setJavaClass(javaClass);

            // Obtain XML name.
            String xmlName;
            MapTo mapTo = classMapping.getMapTo();
            if ((mapTo != null) && (mapTo.getXml() != null)) {
                xmlName = mapTo.getXml();
            } else {
                String clsName = getInternalContext().getJavaNaming().getClassName(javaClass);
                xmlName = getInternalContext().getXMLNaming().toXMLName(clsName);
            }
            xmlClassDesc.setXMLName(xmlName);

            // If this class extends another class, we need to obtain the extended
            // class and make sure this class indeed extends it.
            ClassDescriptor extDesc = getExtended(classMapping, javaClass);
            xmlClassDesc.setExtends((XMLClassDescriptor) extDesc);
           
            // Create all field descriptors.
            FieldDescriptorImpl[] allFields = createFieldDescriptors(classMapping, javaClass);

            // Make sure there are no two fields with the same name.
            checkFieldNameDuplicates(allFields, javaClass);
           
            // Identify identity and normal fields. Note that order must be preserved.
            List fieldList = new ArrayList(allFields.length);
            List idList = new ArrayList();
            if (extDesc == null) {
                // Sort fields into 2 lists based on identity definition of field.
                for (int i = 0; i < allFields.length; i++) {
                    if (!allFields[i].isIdentity()) {
                        fieldList.add(allFields[i]);
                    } else {
                        idList.add(allFields[i]);
                    }
                }
               
                if (idList.size() == 0) {
                    // Found no identities based on identity definition of field.
                    // Try to find identities based on identity definition on class.
                    String[] idNames = classMapping.getIdentity();
                   
                    FieldDescriptor identity;
                    for (int i = 0; i < idNames.length; i++) {
                        identity = findIdentityByName(fieldList, idNames[i], javaClass);
                        if (identity != null) {
                            idList.add(identity);
                        } else {
                            throw new MappingException("mapping.identityMissing",
                                    idNames[i], javaClass.getName());
                        }
                    }
                }
            } else {
                // Add all fields of extending class to field list.
                for (int i = 0; i < allFields.length; i++) { fieldList.add(allFields[i]); }
               
                // Add identity of extended class to identity list.
                if (extDesc.getIdentity() != null) { idList.add(extDesc.getIdentity()); }
               
                // Search redefined identities in extending class.
                FieldDescriptor identity;
                for (int i = 0; i < idList.size(); i++) {
                    String idname = ((FieldDescriptor) idList.get(i)).getFieldName();
View Full Code Here

Examples of org.hibernate.bytecode.util.ClassDescriptor

  }

  private void collectClassNames(File file) throws Exception {
      if ( isClassFile( file ) ) {
      byte[] bytes = ByteCodeHelper.readByteCode( file );
      ClassDescriptor descriptor = getClassDescriptor( bytes );
        classNames.add( descriptor.getName() );
      }
      else if ( isJarFile( file ) ) {
        ZipEntryHandler collector = new ZipEntryHandler() {
          public void handleEntry(ZipEntry entry, byte[] byteCode) throws Exception {
          if ( !entry.isDirectory() ) {
View Full Code Here

Examples of org.hibernate.jpa.boot.spi.ClassDescriptor

  }

  @Override
  public void handleEntry(ArchiveEntry entry, ArchiveContext context) {
    final ClassFile classFile = toClassFile( entry );
    final ClassDescriptor classDescriptor = toClassDescriptor( classFile, entry );

    if ( ! isListedOrDetectable( context, classDescriptor.getName() ) ) {
      return;
    }

    // we are only interested in classes with certain annotations, so see if the ClassDescriptor
    // represents a class which contains any of those annotations
View Full Code Here

Examples of org.jbpm.pvm.internal.wire.descriptor.ClassDescriptor

  public ClassBinding() {
    super("class");
  }

  public Object parse(Element element, Parse parse, Parser parser) {
    ClassDescriptor classDescriptor = null;
    String className = XmlUtil.attribute(element, "class-name");
    if (className!=null) {
      classDescriptor = new ClassDescriptor();
      classDescriptor.setClassName(className);
    } else {
      parse.addProblem("class must have classname attribute: "+XmlUtil.toString(element), element);
    }
    return classDescriptor;
  }
View Full Code Here

Examples of org.jbpm.wire.descriptor.ClassDescriptor

* @author Guillaume Porcher (documentation)
*/
public class ClassBinding implements Binding {

  public Object parse(Element element, Parse parse, Parser parser) {
    ClassDescriptor classDescriptor = null;
    String className = XmlUtil.attribute(element, "classname");
    if (className!=null) {
      classDescriptor = new ClassDescriptor();
      classDescriptor.setClassName(className);
    } else {
      parse.addProblem("class must have classname attribute: "+XmlUtil.toString(element));
    }
    return classDescriptor;
  }
View Full Code Here

Examples of org.kohsuke.stapler.ClassDescriptor

        }

        return new NamedArgsAndClosure(singleParam(d, arg), null);
    }
    private static Map<String,Object> singleParam(StepDescriptor d, Object arg) {
        String[] names = new ClassDescriptor(d.clazz).loadConstructorParamNames();
        if (names.length == 1) {
            return Collections.singletonMap(names[0], arg);
        } else {
            throw new IllegalArgumentException("Expected named arguments but got " + arg);
        }
View Full Code Here

Examples of org.quorum.symbols.ClassDescriptor

    }

    @Override
    public CompilerLocation GetLocationAtLine(String staticKey, int line) {
        CompilerLocation location = new CompilerLocation();
        ClassDescriptor clazz = this.virtualMachine.getSymbolTable().getClassDescriptor(staticKey);
        if(clazz != null) {
            MethodDescriptor method = clazz.getMethodAtLine(line, 0);
            if(method != null) {
                location.setName(method.getName());
                Parameters parameters = method.getParameters();
                if(parameters != null) {
                    for(int i = 0; i < parameters.size(); i++) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.