Java 类com.intellij.util.xmlb.Accessor 实例源码

项目:intellij-ce-playground    文件:PersistableCodeStyleSchemes.java   
@Nullable
@Override
public Element getState() {
  CodeStyleScheme currentScheme = getCurrentScheme();
  CURRENT_SCHEME_NAME = currentScheme == null ? null : currentScheme.getName();
  return XmlSerializer.serialize(this, new SerializationFilter() {
    @Override
    public boolean accepts(@NotNull Accessor accessor, @NotNull Object bean) {
      if ("CURRENT_SCHEME_NAME".equals(accessor.getName())) {
        return !DEFAULT_SCHEME_NAME.equals(accessor.read(bean));
      }
      else {
        return accessor.getValueClass().equals(String.class);
      }
    }
  });
}
项目:intellij-ce-playground    文件:XDebuggerWatchesProvider.java   
@Override
public void saveContext(Element toElement) throws WriteExternalException {
  XDebuggerWatchesManager.WatchesManagerState state = myWatchesManager.getState();
  Element serialize = XmlSerializer.serialize(state, new SerializationFilter() {
    @Override
    public boolean accepts(@NotNull Accessor accessor, @NotNull Object bean) {
      return accessor.read(bean) != null;
    }
  });
  toElement.addContent(serialize.removeContent());
}
项目:intellij-ce-playground    文件:XDebuggerBreakpointsContextProvider.java   
@Override
public void saveContext(Element toElement) throws WriteExternalException {
  XBreakpointManagerImpl.BreakpointManagerState state = myBreakpointManager.getState();
  Element serialize = XmlSerializer.serialize(state, new SerializationFilter() {
    @Override
    public boolean accepts(@NotNull Accessor accessor, @NotNull Object bean) {
      return accessor.read(bean) != null;
    }
  });
  toElement.addContent(serialize.removeContent());
}
项目:tools-idea    文件:PersistableCodeStyleSchemes.java   
@Nullable
@Override
public Element getState() {
  return XmlSerializer.serialize(this, new SerializationFilter() {
    @Override
    public boolean accepts(Accessor accessor, Object bean) {
      return accessor.getValueClass().equals(String.class);
    }
  });
}
项目:tools-idea    文件:XDebuggerBreakpointsContextProvider.java   
@Override
public void saveContext(Element toElement) throws WriteExternalException {
  XBreakpointManagerImpl.BreakpointManagerState state = myBreakpointManager.getState();
  Element serialize = XmlSerializer.serialize(state, new SerializationFilter() {
    @Override
    public boolean accepts(Accessor accessor, Object bean) {
      return accessor.read(bean) != null;
    }
  });
  toElement.addContent(serialize.removeContent());
}
项目:tools-idea    文件:ShowSerializedXmlAction.java   
public Object createObject(Class<?> aClass, FList<Type> processedTypes) throws Exception {
  final Object o = aClass.newInstance();
  for (Accessor accessor : XmlSerializerUtil.getAccessors(aClass)) {
    final Type type = accessor.getGenericType();
    Object value = createValue(type, processedTypes);
    if (value != null) {
      accessor.write(o, value);
    }
  }
  return o;
}
项目:consulo-tasks    文件:XDebuggerBreakpointsContextProvider.java   
@Override
public void saveContext(Element toElement) throws WriteExternalException {
  XBreakpointManagerImpl.BreakpointManagerState state = myBreakpointManager.getState();
  Element serialize = XmlSerializer.serialize(state, new SerializationFilter() {
    @Override
    public boolean accepts(Accessor accessor, Object bean) {
      return accessor.read(bean) != null;
    }
  });
  toElement.addContent(serialize.removeContent());
}
项目:consulo    文件:PersistableCodeStyleSchemes.java   
@Nullable
@Override
public Element getState() {
  return XmlSerializer.serialize(this, new SerializationFilter() {
    @Override
    public boolean accepts(@Nonnull Accessor accessor, Object bean) {
      return accessor.getValueClass().equals(String.class);
    }
  });
}
项目:intellij-ce-playground    文件:CompilerConfigurationImpl.java   
@Override
public Element getState() {
  Element state = new Element("state");
  XmlSerializer.serializeInto(myState, state, new SkipDefaultValuesSerializationFilters() {
    @Override
    public boolean accepts(@NotNull Accessor accessor, @NotNull Object bean) {
      if (myState.compilerWasSpecified && "DEFAULT_COMPILER".equals(accessor.getName())) {
        return true;
      }
      return super.accepts(accessor, bean);
    }
  });

  if (!myAddNotNullAssertions) {
    addChild(state, JpsJavaCompilerConfigurationSerializer.ADD_NOTNULL_ASSERTIONS).setAttribute(
      JpsJavaCompilerConfigurationSerializer.ENABLED, String.valueOf(myAddNotNullAssertions));
  }

  if (myExcludesConfiguration.getExcludeEntryDescriptions().length > 0) {
    myExcludesConfiguration.getDelegate().writeExternal(addChild(state, JpsJavaCompilerConfigurationSerializer.EXCLUDE_FROM_COMPILE));
  }

  final Element newChild = addChild(state, JpsJavaCompilerConfigurationSerializer.RESOURCE_EXTENSIONS);
  for (final String pattern : getRegexpPatterns()) {
    addChild(newChild, JpsJavaCompilerConfigurationSerializer.ENTRY).setAttribute(JpsJavaCompilerConfigurationSerializer.NAME, pattern);
  }

  if (myWildcardPatternsInitialized || !myWildcardPatterns.isEmpty()) {
    final Element wildcardPatterns = addChild(state, JpsJavaCompilerConfigurationSerializer.WILDCARD_RESOURCE_PATTERNS);
    for (final String wildcardPattern : myWildcardPatterns) {
      addChild(wildcardPatterns, JpsJavaCompilerConfigurationSerializer.ENTRY).setAttribute(JpsJavaCompilerConfigurationSerializer.NAME, wildcardPattern);
    }
  }

  final Element annotationProcessingSettings = addChild(state, JpsJavaCompilerConfigurationSerializer.ANNOTATION_PROCESSING);
  final Element defaultProfileElem = addChild(annotationProcessingSettings, "profile").setAttribute("default", "true");
  AnnotationProcessorProfileSerializer.writeExternal(myDefaultProcessorsProfile, defaultProfileElem);
  for (ProcessorConfigProfile profile : myModuleProcessorProfiles) {
    final Element profileElem = addChild(annotationProcessingSettings, "profile").setAttribute("default", "false");
    AnnotationProcessorProfileSerializer.writeExternal(profile, profileElem);
  }

  if (!StringUtil.isEmpty(myBytecodeTargetLevel) || !myModuleBytecodeTarget.isEmpty()) {
    final Element bytecodeTarget = addChild(state, JpsJavaCompilerConfigurationSerializer.BYTECODE_TARGET_LEVEL);
    if (!StringUtil.isEmpty(myBytecodeTargetLevel)) {
      bytecodeTarget.setAttribute(JpsJavaCompilerConfigurationSerializer.TARGET_ATTRIBUTE, myBytecodeTargetLevel);
    }
    if (!myModuleBytecodeTarget.isEmpty()) {
      final List<String> moduleNames = new ArrayList<String>(myModuleBytecodeTarget.keySet());
      Collections.sort(moduleNames, String.CASE_INSENSITIVE_ORDER);
      for (String name : moduleNames) {
        final Element moduleElement = addChild(bytecodeTarget, JpsJavaCompilerConfigurationSerializer.MODULE);
        moduleElement.setAttribute(JpsJavaCompilerConfigurationSerializer.NAME, name);
        final String value = myModuleBytecodeTarget.get(name);
        moduleElement.setAttribute(JpsJavaCompilerConfigurationSerializer.TARGET_ATTRIBUTE, value != null ? value : "");
      }
    }
  }
  return state;
}
项目:intellij-ce-playground    文件:UISettings.java   
@Override
public boolean accepts(@NotNull Accessor accessor, @NotNull Object bean) {
  UISettings settings = (UISettings)bean;
  return !hasDefaultFontSetting(settings);
}
项目:tools-idea    文件:UISettings.java   
public boolean accepts(Accessor accessor, Object bean) {
  UISettings settings = (UISettings)bean;
  return !hasDefaultFontSetting(settings);
}
项目:consulo    文件:UISettings.java   
@Override
public boolean accepts(@Nonnull Accessor accessor, Object bean) {
  UISettings settings = (UISettings)bean;
  return !hasDefaultFontSetting(settings);
}