/** * This is used to create a default instance of the field type. It * is up to the subclass to determine how to best instantiate an * object of the field type that best suits. This is used when the * empty value is required or to create the default type instance. * * @return a type which is used to instantiate the collection */ @Override public Object getInstance() throws Exception { Class type = getComponentType(); if(type != null) { return Array.newInstance(type, 0); } return null; }
/** * This is used to create a default instance of the field type. It * is up to the subclass to determine how to best instantiate an * object of the field type that best suits. This is used when the * empty value is required or to create the default type instance. * * @return a type which is used to instantiate the collection */ @Override public Object getInstance() throws Exception { Class type = getComponentType(); if(type != null) { return Array.newInstance(type, 0); } return null; }
/** * This is used to create a default instance of the field type. It * is up to the subclass to determine how to best instantiate an * object of the field type that best suits. This is used when the * empty value is required or to create the default type instance. * * @return a type which is used to instantiate the collection */ @Override public Object getInstance() throws Exception { Class type = getComponentType(); if(type != null) { return Array.newInstance(type, 0); } return null; }
/** * Creates the array type to use. This will use the provided * XML element to determine the array type and provide a means * for creating an array with the <code>Value</code> object. If * the array types are not compatible an exception is thrown. * * @param value this is the type object with the array details * @param entry this is the entry type for the array instance * * @return this object array type used for the instantiation */ private Instance getInstance(Value value, Class entry) throws Exception { Class expect = getComponentType(); if(!expect.isAssignableFrom(entry)) { throw new InstantiationException("Array of type %s cannot hold %s for %s", expect, entry, type); } return new ArrayInstance(value); }
/** * Creates the array type to use. This will use the provided * XML element to determine the array type and provide a means * for creating an array with the <code>Value</code> object. If * the array types are not compatible an exception is thrown. * * @param value this is the type object with the array details * @param entry this is the entry type for the array instance * * @return this object array type used for the instantiation */ private Instance getInstance(Value value, Class entry) throws Exception { Class expect = getComponentType(); if(!expect.isAssignableFrom(entry)) { throw new InstantiationException("Array of type %s cannot hold %s for %s", expect, entry, type); } return new ArrayInstance(value); }
/** * Creates the array type to use. This will use the provided * XML element to determine the array type and provide a means * for creating an array with the <code>Value</code> object. If * the array types are not compatible an exception is thrown. * * @param value this is the type object with the array details * @param entry this is the entry type for the array instance * * @return this object array type used for the instantiation */ private Instance getInstance(Value value, Class entry) throws Exception { Class expect = getComponentType(); if(!expect.isAssignableFrom(entry)) { throw new InstantiationException("Array of type %s cannot hold %s for %s", expect, entry, type); } return new ArrayInstance(value); }