public Field getInstance()

in src/java/org/apache/fulcrum/intake/model/FieldType.java [140:181]


        public Field<?> getInstance(XmlField f, Group g) throws IntakeException
        {
            String fieldClass = f.getFieldClass();

            if (fieldClass != null
                    && fieldClass.indexOf('.') == -1)
            {
                fieldClass = Field.defaultFieldPackage + fieldClass;
            }

            if (fieldClass != null)
            {
                Class<?> field;

                try
                {
                    field = Class.forName(fieldClass);
                    Constructor<?> constructor = field.getConstructor(XmlField.class, Group.class);

                    return (Field<?>) constructor.newInstance(f, g);
                }
                catch (ClassNotFoundException e)
                {
                    throw new IntakeException(
                            "Could not load Field class("
                                    + fieldClass + ")",
                            e);
                }
                catch (Exception e)
                {
                    throw new IntakeException(
                            "Could not create new instance of Field("
                                    + fieldClass + ")",
                            e);
                }
            }
            else
            {
                throw new IntakeException(
                        "Custom field types must define a fieldClass");
            }
        }