Package com.sun.codemodel

Examples of com.sun.codemodel.JStringLiteral


        JExpression cons = coreType.createConstant(outline, lexical);
        Class<? extends XmlAdapter> atype = adapter.getAdapterIfKnown();

        // try to run the adapter now rather than later.
        if(cons instanceof JStringLiteral && atype!=null) {
            JStringLiteral scons = (JStringLiteral) cons;
            XmlAdapter a = ClassFactory.create(atype);
            try {
                Object value = a.unmarshal(scons.str);
                if(value instanceof String) {
                    return JExpr.lit((String)value);
View Full Code Here


                            valuesArray[i] = anno.getJavaAnnotation();
                        } else {
                            Field valueField = PrivilegedAccessHelper.getDeclaredField(values.get(i).getClass(), "value", true);
                            Object value = PrivilegedAccessHelper.getValueFromField(valueField, values.get(i));
                            if (value instanceof JStringLiteral) {
                                JStringLiteral strvalue = (JStringLiteral) value;
                                valuesArray[i] = strvalue.str;
                            } else {
                                // XmlSeeAlso.value = Array of JDefinedClasses
                                Field valClField = PrivilegedAccessHelper.getDeclaredField(value.getClass(), "val$cl", true);
                                JDefinedClass wrappedValue = (JDefinedClass) PrivilegedAccessHelper.getValueFromField(valClField, value);
                                Class<?> tempDynClass = dynamicClassLoader.createDynamicClass(wrappedValue.fullName());
                                valuesArray[i] = tempDynClass;
                            }
                        }
                    }
                    components.put(key.toString(), valuesArray);
                } else if (xjcValue.getClass().getName().contains("JAnnotationStringValue")) {
                    // JAnnotationStringValue is a package-protected class so need to compare class name.
                    // Cannot cache this field because JAnnotationStringValue is a protected class.
                    Field valueField = PrivilegedAccessHelper.getDeclaredField(xjcValue.getClass(), "value", true);
                    Object objValue = PrivilegedAccessHelper.getValueFromField(valueField, xjcValue);
                    if (objValue instanceof JStringLiteral) {
                        JStringLiteral value = (JStringLiteral) objValue;
                        String stringValue = value == null ? null : value.str;
                        components.put(key.toString(), stringValue);
                    } else if (objValue.getClass().getName().contains("JAtom")) {
                        // e.g. XmlElement.required = JAtom
                        // Cannot cache this field because JAtom is a protected class.
View Full Code Here

                            valuesArray[i] = anno.getJavaAnnotation();
                        } else {
                            Field valueField = PrivilegedAccessHelper.getDeclaredField(values.get(i).getClass(), "value", true);
                            Object value = PrivilegedAccessHelper.getValueFromField(valueField, values.get(i));
                            if (value instanceof JStringLiteral) {
                                JStringLiteral strvalue = (JStringLiteral) value;
                                valuesArray[i] = strvalue.str;
                            } else {
                                // XmlSeeAlso.value = Array of JDefinedClasses
                                Field valClField = PrivilegedAccessHelper.getDeclaredField(value.getClass(), "val$cl", true);
                                JDefinedClass wrappedValue = (JDefinedClass) PrivilegedAccessHelper.getValueFromField(valClField, value);
                                Class<?> tempDynClass = dynamicClassLoader.createDynamicClass(wrappedValue.fullName());
                                valuesArray[i] = tempDynClass;
                            }
                        }
                    }
                    components.put(key.toString(), valuesArray);
                } else if (xjcValue.getClass().getName().contains("JAnnotationStringValue")) {
                    // JAnnotationStringValue is a package-protected class so need to compare class name.
                    // Cannot cache this field because JAnnotationStringValue is a protected class.
                    Field valueField = PrivilegedAccessHelper.getDeclaredField(xjcValue.getClass(), "value", true);
                    Object objValue = PrivilegedAccessHelper.getValueFromField(valueField, xjcValue);
                    if (objValue instanceof JStringLiteral) {
                        JStringLiteral value = (JStringLiteral) objValue;
                        String stringValue = value == null ? null : value.str;
                        components.put(key.toString(), stringValue);
                    } else if (objValue.getClass().getName().contains("JAtom")) {
                        // e.g. XmlElement.required = JAtom
                        // Cannot cache this field because JAtom is a protected class.
View Full Code Here

        JExpression cons = coreType.createConstant(outline, lexical);
        Class<? extends XmlAdapter> atype = adapter.getAdapterIfKnown();

        // try to run the adapter now rather than later.
        if(cons instanceof JStringLiteral && atype!=null) {
            JStringLiteral scons = (JStringLiteral) cons;
            XmlAdapter a = ClassFactory.create(atype);
            try {
                Object value = a.unmarshal(scons.str);
                if(value instanceof String) {
                    return JExpr.lit((String)value);
View Full Code Here

TOP

Related Classes of com.sun.codemodel.JStringLiteral

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.