@Override public Enumeration<String> getAttributes() { return delegate.getAttributes(); }
public Enumeration<String> getAttributes() { return fileObj.getAttributes(); }
public int size() { Enumeration<String> all = fo.getAttributes(); int cnt = 0; while (all.hasMoreElements()) { cnt++; all.nextElement(); } return cnt; }
/** Copies attributes of one FileObject into another. * @param source source folder or file * @param target target folder or file * @exception IOException if it fails */ private static void copyAttrs(FileObject source, FileObject target) { Enumeration<String> en = source.getAttributes(); while (en.hasMoreElements()) { String key = en.nextElement(); Object value = source.getAttribute(key); try { target.setAttribute(key, value); } catch (IOException ie) { } } }
boolean canHaveRootAttributeOnReadOnlyFS(String name) { Set<String> tmp = rootAttributes; if (tmp == null) { tmp = new HashSet<String>(); for (FileSystem fs : getDelegates()) { if (fs == null) { continue; } if (!fs.isReadOnly()) { continue; } Enumeration<String> en = fs.getRoot().getAttributes(); while (en.hasMoreElements()) { tmp.add(en.nextElement()); } rootAttributes = tmp; } } if (tmp == Collections.<String>emptySet()) { return true; } return tmp.contains(name); } }
return attr.getClass().getName(); } else { Enumeration<String> attributes = fo.getAttributes(); while (attributes.hasMoreElements()) { if (attributes.nextElement().equals("instanceCreate")) {
Enumeration<String> e = fo.getAttributes(); e = ((AbstractFileObject) fo).getAttributes(""); // NOI18N } else { e = fo.getAttributes();
Enumeration<String> attrKeys = source.getAttributes();
for (String attr : NbCollections.iterable(parent.getAttributes())) { if (LOG.isLoggable(Level.FINEST)) { LOG.log(Level.FINEST, " attr found {0}({1})", new Object[]{parent, attr}); // NOI18N
for (String attr : NbCollections.iterable(d.getAttributes())) { if (attr.indexOf('/') != -1 && d.getAttribute(attr) instanceof Boolean) { d.setAttribute(attr, null);
public Enumeration getAttributes() { return fileObj.getAttributes() ; }
public BindingEnumeration(FileObject fo) { this.fo = fo; this.en = fo.getAttributes(); }
public Enumeration getAttributes() { return fileObj.getAttributes() ; }
@Override public java.util.Enumeration propertyNames() throws IllegalStateException { return getFileObject().getAttributes(); }
public java.util.Enumeration getAttributes() { return fo == null? org.openide.util.Enumerations.empty(): fo.getAttributes(); }
/** Copies attributes of one FileObject into another. * @param source source folder or file * @param target target folder or file * @exception IOException if it fails */ private static void copyAttrs (FileObject source,FileObject target) { Enumeration en = source.getAttributes (); while (en.hasMoreElements()) { String key = (String) en.nextElement(); Object value = source.getAttribute (key); try { target.setAttribute (key, value); } catch (IOException ie){} } }
@Before public void setUp() { fileObject = mock(FileObject.class); when(fileObject.getAttribute(eq("instanceCreate"))).thenReturn("foobar"); when(fileObject.getAttribute(eq("class"))).thenReturn(Bean1.class.getName()); when(fileObject.getAttribute(eq("property1"))).thenReturn("value1"); when(fileObject.getAttribute(eq("property2"))).thenReturn(2); when(fileObject.getAttributes()).thenReturn(Collections.enumeration(Arrays.asList("class", "property1", "property2"))); }
@Test(expected=IllegalArgumentException.class) public void shouldThrowIllegalArgumentExceptionWhenMissingClassAttribute() throws Exception { when(fileObject.getAttribute(eq("class"))).thenReturn(null); when(fileObject.getAttributes()).thenReturn(Collections.enumeration(Arrays.asList("property1", "property2"))); BeanFactory.createInstance(fileObject); }
@Test(expected=UnsupportedOperationException.class) public void shouldThrowUnsupportedOperationExceptionWhenTryingToSetAPropertyWhichDoesntExist() throws Exception { when(fileObject.getAttribute(eq("notExistingProperty"))).thenReturn("value"); when(fileObject.getAttributes()).thenReturn(Collections.enumeration(Arrays.asList("class", "property1", "property2", "notExistingProperty"))); BeanFactory.createInstance(fileObject); }
@Test(expected=UnsupportedOperationException.class) public void shouldThrowUnsupportedOperationExceptionWhenTryingToSetAReadOnlyProperty() throws Exception { when(fileObject.getAttribute(eq("readOnlyProperty"))).thenReturn("value"); when(fileObject.getAttributes()).thenReturn(Collections.enumeration(Arrays.asList("class", "property1", "property2", "readOnlyProperty"))); BeanFactory.createInstance(fileObject); }