@Override @Nullable public String getAsText() { Resource value = (Resource) getValue(); try { // Try to determine URL for resource. return (value != null ? value.getURL().toExternalForm() : ""); } catch (IOException ex) { // Couldn't determine resource URL - return null to indicate // that there is no appropriate text representation. return null; } }
@Override public void setAsText(String text) throws IllegalArgumentException { this.resourceEditor.setAsText(text); Resource resource = (Resource) this.resourceEditor.getValue(); try { setValue(resource != null ? new InputSource(resource.getURL().toString()) : null); } catch (IOException ex) { throw new IllegalArgumentException( "Could not retrieve URL for " + resource + ": " + ex.getMessage()); } }
@Override public void setAsText(String text) throws IllegalArgumentException { this.resourceEditor.setAsText(text); Resource resource = (Resource) this.resourceEditor.getValue(); try { setValue(resource != null ? resource.getURL() : null); } catch (IOException ex) { throw new IllegalArgumentException("Could not retrieve URL for " + resource + ": " + ex.getMessage()); } }
@Override @Nullable public String getAsText() { Resource value = (Resource) getValue(); try { // Try to determine URL for resource. return (value != null ? value.getURL().toExternalForm() : ""); } catch (IOException ex) { // Couldn't determine resource URL - return null to indicate // that there is no appropriate text representation. return null; } }
@Override public void setAsText(String text) throws IllegalArgumentException { this.resourceEditor.setAsText(text); Resource resource = (Resource) this.resourceEditor.getValue(); try { setValue(resource != null ? resource.getInputStream() : null); } catch (IOException ex) { throw new IllegalArgumentException("Failed to retrieve InputStream for " + resource, ex); } }
@Override public void setAsText(String text) throws IllegalArgumentException { this.resourceEditor.setAsText(text); Resource resource = (Resource) this.resourceEditor.getValue(); try { setValue(resource != null ? new InputSource(resource.getURL().toString()) : null); } catch (IOException ex) { throw new IllegalArgumentException( "Could not retrieve URL for " + resource + ": " + ex.getMessage()); } }
@Override public void setAsText(String text) throws IllegalArgumentException { this.resourceEditor.setAsText(text); Resource resource = (Resource) this.resourceEditor.getValue(); try { setValue(resource != null ? resource.getURL() : null); } catch (IOException ex) { throw new IllegalArgumentException("Could not retrieve URL for " + resource + ": " + ex.getMessage()); } }
@Override public void setAsText(String text) throws IllegalArgumentException { this.resourceEditor.setAsText(text); Resource resource = (Resource) this.resourceEditor.getValue(); try { setValue(resource != null ? resource.getInputStream() : null); } catch (IOException ex) { throw new IllegalArgumentException("Failed to retrieve InputStream for " + resource, ex); } }
@Override public void setAsText(String text) throws IllegalArgumentException { this.resourceEditor.setAsText(text); Resource resource = (Resource) this.resourceEditor.getValue(); try { setValue(resource != null ? new EncodedResource(resource).getReader() : null); } catch (IOException ex) { throw new IllegalArgumentException("Failed to retrieve Reader for " + resource, ex); } }
Resource resource = (Resource) this.resourceEditor.getValue(); if (resource == null) { setValue(null);
Resource resource = (Resource) this.resourceEditor.getValue();
@Override public void setAsText(String text) throws IllegalArgumentException { this.resourceEditor.setAsText(text); Resource resource = (Resource) this.resourceEditor.getValue(); try { setValue(resource != null ? new EncodedResource(resource).getReader() : null); } catch (IOException ex) { throw new IllegalArgumentException("Failed to retrieve Reader for " + resource, ex); } }
Resource resource = (Resource) this.resourceEditor.getValue(); if (resource == null) { setValue(null);
Resource resource = (Resource) this.resourceEditor.getValue();
@Override public String getAsText() { Resource value = (Resource) getValue(); try { // Try to determine URL for resource. return (value != null ? value.getURL().toExternalForm() : ""); } catch (IOException ex) { // Couldn't determine resource URL - return null to indicate // that there is no appropriate text representation. return null; } }
@Override public void setAsText(String text) throws IllegalArgumentException { this.resourceEditor.setAsText(text); Resource resource = (Resource) this.resourceEditor.getValue(); try { setValue(resource != null ? new InputSource(resource.getURL().toString()) : null); } catch (IOException ex) { throw new IllegalArgumentException( "Could not retrieve URL for " + resource + ": " + ex.getMessage()); } }
@Override public void setAsText(String text) throws IllegalArgumentException { this.resourceEditor.setAsText(text); Resource resource = (Resource) this.resourceEditor.getValue(); try { setValue(resource != null ? resource.getURL() : null); } catch (IOException ex) { throw new IllegalArgumentException("Could not retrieve URL for " + resource + ": " + ex.getMessage()); } }
@Override public void setAsText(String text) throws IllegalArgumentException { this.resourceEditor.setAsText(text); Resource resource = (Resource) this.resourceEditor.getValue(); try { setValue(resource != null ? resource.getInputStream() : null); } catch (IOException ex) { throw new IllegalArgumentException( "Could not retrieve InputStream for " + resource + ": " + ex.getMessage()); } }
Resource resource = (Resource) this.resourceEditor.getValue();
public void setLocations(String[] locations) { super.setLocations(locations); ResourceEditor editor = (ResourceEditor) BeanUtils.findEditorByConvention(Resource.class); Resource[] resources = new Resource[locations.length]; for (int i = 0; i < locations.length; i++) { editor.setAsText(locations[i]); resources[i] = (Resource) editor.getValue(); } eppc.setLocations(resources); }