Package com.github.jmkgreen.morphia.annotations

Examples of com.github.jmkgreen.morphia.annotations.ConstructorArgs


        if (c == null)
            c = mf.isSingleValue ? mf.getConcreteType() : mf.getSubClass();
        try {
            return createInstance(c, dbObj);
        } catch (RuntimeException e) {
            ConstructorArgs argAnn = mf.getAnnotation(ConstructorArgs.class);
            if (argAnn == null)
                throw e;
            //TODO: now that we have a mapr, get the arg types that way by getting the fields by name. + Validate names
            Object[] args = new Object[argAnn.value().length];
            Class[] argTypes = new Class[argAnn.value().length];
            for (int i = 0; i < argAnn.value().length; i++) {
                //TODO: run converters and stuff against these. Kinda like the List of List stuff, using a fake MappedField to hold the value
                Object val = dbObj.get(argAnn.value()[i]);
                args[i] = val;
                argTypes[i] = val.getClass();
            }
            try {
                Constructor ctor = c.getDeclaredConstructor(argTypes);
View Full Code Here

TOP

Related Classes of com.github.jmkgreen.morphia.annotations.ConstructorArgs

Copyright © 2018 www.massapicom. 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.