Java 类org.springframework.boot.configurationprocessor.metadata.ItemMetadata.ItemType 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JsonMarshaller.java   
public ConfigurationMetadata read(InputStream inputStream) throws IOException {
    ConfigurationMetadata metadata = new ConfigurationMetadata();
    JSONObject object = new JSONObject(toString(inputStream));
    JSONArray groups = object.optJSONArray("groups");
    if (groups != null) {
        for (int i = 0; i < groups.length(); i++) {
            metadata.add(toItemMetadata((JSONObject) groups.get(i), ItemType.GROUP));
        }
    }
    JSONArray properties = object.optJSONArray("properties");
    if (properties != null) {
        for (int i = 0; i < properties.length(); i++) {
            metadata.add(toItemMetadata((JSONObject) properties.get(i),
                    ItemType.PROPERTY));
        }
    }
    JSONArray hints = object.optJSONArray("hints");
    if (hints != null) {
        for (int i = 0; i < hints.length(); i++) {
            metadata.add(toItemHint((JSONObject) hints.get(i)));
        }
    }
    return metadata;
}
项目:spring-boot-concourse    文件:JsonMarshaller.java   
public ConfigurationMetadata read(InputStream inputStream) throws IOException {
    ConfigurationMetadata metadata = new ConfigurationMetadata();
    JSONObject object = new JSONObject(toString(inputStream));
    JSONArray groups = object.optJSONArray("groups");
    if (groups != null) {
        for (int i = 0; i < groups.length(); i++) {
            metadata.add(toItemMetadata((JSONObject) groups.get(i), ItemType.GROUP));
        }
    }
    JSONArray properties = object.optJSONArray("properties");
    if (properties != null) {
        for (int i = 0; i < properties.length(); i++) {
            metadata.add(toItemMetadata((JSONObject) properties.get(i),
                    ItemType.PROPERTY));
        }
    }
    JSONArray hints = object.optJSONArray("hints");
    if (hints != null) {
        for (int i = 0; i < hints.length(); i++) {
            metadata.add(toItemHint((JSONObject) hints.get(i)));
        }
    }
    return metadata;
}
项目:contestparser    文件:JsonMarshaller.java   
public ConfigurationMetadata read(InputStream inputStream) throws IOException {
    ConfigurationMetadata metadata = new ConfigurationMetadata();
    JSONObject object = new JSONObject(toString(inputStream));
    JSONArray groups = object.optJSONArray("groups");
    if (groups != null) {
        for (int i = 0; i < groups.length(); i++) {
            metadata.add(toItemMetadata((JSONObject) groups.get(i), ItemType.GROUP));
        }
    }
    JSONArray properties = object.optJSONArray("properties");
    if (properties != null) {
        for (int i = 0; i < properties.length(); i++) {
            metadata.add(toItemMetadata((JSONObject) properties.get(i),
                    ItemType.PROPERTY));
        }
    }
    JSONArray hints = object.optJSONArray("hints");
    if (hints != null) {
        for (int i = 0; i < hints.length(); i++) {
            metadata.add(toItemHint((JSONObject) hints.get(i)));
        }
    }
    return metadata;
}
项目:spring-boot-security-saml    文件:ConfigPropertiesMarkdownGenerator.java   
public static void main(String[] args) throws IOException {
    String basePath = System.getProperty("project.root");
    ConfigurationMetadata metadata = readMetadata(new FileInputStream(new File(basePath, "target/classes/META-INF/spring-configuration-metadata.json")));
    metadata.getItems().stream()
            .map(ItemMetadata::new)
            .filter(i -> i.isOfItemType(ItemType.PROPERTY))
            .distinct()
            .sorted(Comparator.comparing(ItemMetadata::getGroup).thenComparing(ItemMetadata::getName))
            .forEach(i -> System.out.printf("|%s\t|%s\t|%s\t|\n", i.getName(), i.getDefaultValue(), i.getDescription()));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JsonMarshaller.java   
public void write(ConfigurationMetadata metadata, OutputStream outputStream)
        throws IOException {
    JSONObject object = new JSONOrderedObject();
    object.put("groups", toJsonArray(metadata, ItemType.GROUP));
    object.put("properties", toJsonArray(metadata, ItemType.PROPERTY));
    object.put("hints", toJsonArray(metadata.getHints()));
    outputStream.write(object.toString(2).getBytes(UTF_8));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JsonMarshaller.java   
private JSONArray toJsonArray(ConfigurationMetadata metadata, ItemType itemType) {
    JSONArray jsonArray = new JSONArray();
    for (ItemMetadata item : metadata.getItems()) {
        if (item.isOfItemType(itemType)) {
            jsonArray.put(toJsonObject(item));
        }
    }
    return jsonArray;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JsonMarshaller.java   
private ItemMetadata toItemMetadata(JSONObject object, ItemType itemType) {
    String name = object.getString("name");
    String type = object.optString("type", null);
    String description = object.optString("description", null);
    String sourceType = object.optString("sourceType", null);
    String sourceMethod = object.optString("sourceMethod", null);
    Object defaultValue = readItemValue(object.opt("defaultValue"));
    ItemDeprecation deprecation = toItemDeprecation(object);
    return new ItemMetadata(itemType, name, null, type, sourceType, sourceMethod,
            description, defaultValue, deprecation);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:Metadata.java   
public MetadataItemCondition(ItemType itemType, String name, String type,
        Class<?> sourceType, String description, Object defaultValue,
        ItemDeprecation deprecation) {
    this.itemType = itemType;
    this.name = name;
    this.type = type;
    this.sourceType = sourceType;
    this.description = description;
    this.defaultValue = defaultValue;
    this.deprecation = deprecation;
    describedAs(createDescription());
}
项目:spring-boot-concourse    文件:JsonMarshaller.java   
public void write(ConfigurationMetadata metadata, OutputStream outputStream)
        throws IOException {
    JSONObject object = new JSONOrderedObject();
    object.put("groups", toJsonArray(metadata, ItemType.GROUP));
    object.put("properties", toJsonArray(metadata, ItemType.PROPERTY));
    object.put("hints", toJsonArray(metadata.getHints()));
    outputStream.write(object.toString(2).getBytes(UTF_8));
}
项目:spring-boot-concourse    文件:JsonMarshaller.java   
private JSONArray toJsonArray(ConfigurationMetadata metadata, ItemType itemType) {
    JSONArray jsonArray = new JSONArray();
    for (ItemMetadata item : metadata.getItems()) {
        if (item.isOfItemType(itemType)) {
            jsonArray.put(toJsonObject(item));
        }
    }
    return jsonArray;
}
项目:spring-boot-concourse    文件:JsonMarshaller.java   
private ItemMetadata toItemMetadata(JSONObject object, ItemType itemType) {
    String name = object.getString("name");
    String type = object.optString("type", null);
    String description = object.optString("description", null);
    String sourceType = object.optString("sourceType", null);
    String sourceMethod = object.optString("sourceMethod", null);
    Object defaultValue = readItemValue(object.opt("defaultValue"));
    ItemDeprecation deprecation = toItemDeprecation(object);
    return new ItemMetadata(itemType, name, null, type, sourceType, sourceMethod,
            description, defaultValue, deprecation);
}
项目:spring-boot-concourse    文件:Metadata.java   
public MetadataItemCondition(ItemType itemType, String name, String type,
        Class<?> sourceType, String description, Object defaultValue,
        ItemDeprecation deprecation) {
    this.itemType = itemType;
    this.name = name;
    this.type = type;
    this.sourceType = sourceType;
    this.description = description;
    this.defaultValue = defaultValue;
    this.deprecation = deprecation;
    describedAs(createDescription());
}
项目:contestparser    文件:JsonMarshaller.java   
public void write(ConfigurationMetadata metadata, OutputStream outputStream)
        throws IOException {
    JSONObject object = new JSONOrderedObject();
    object.put("groups", toJsonArray(metadata, ItemType.GROUP));
    object.put("properties", toJsonArray(metadata, ItemType.PROPERTY));
    object.put("hints", toJsonArray(metadata.getHints()));
    outputStream.write(object.toString(2).getBytes(UTF_8));
}
项目:contestparser    文件:JsonMarshaller.java   
private JSONArray toJsonArray(ConfigurationMetadata metadata, ItemType itemType) {
    JSONArray jsonArray = new JSONArray();
    for (ItemMetadata item : metadata.getItems()) {
        if (item.isOfItemType(itemType)) {
            jsonArray.put(toJsonObject(item));
        }
    }
    return jsonArray;
}
项目:contestparser    文件:JsonMarshaller.java   
private ItemMetadata toItemMetadata(JSONObject object, ItemType itemType) {
    String name = object.getString("name");
    String type = object.optString("type", null);
    String description = object.optString("description", null);
    String sourceType = object.optString("sourceType", null);
    String sourceMethod = object.optString("sourceMethod", null);
    Object defaultValue = readItemValue(object.opt("defaultValue"));
    ItemDeprecation deprecation = toItemDeprecation(object);
    return new ItemMetadata(itemType, name, null, type, sourceType, sourceMethod,
            description, defaultValue, deprecation);
}
项目:contestparser    文件:ConfigurationMetadataMatchers.java   
public ContainsItemMatcher(ItemType itemType, String name, String type,
        Class<?> sourceType, String description, Matcher<?> defaultValue,
        ItemDeprecation deprecation) {
    this.itemType = itemType;
    this.name = name;
    this.type = type;
    this.sourceType = sourceType;
    this.description = description;
    this.defaultValue = defaultValue;
    this.deprecation = deprecation;
}
项目:spring-boot-security-saml    文件:ConfigPropertiesMarkdownGenerator.java   
public boolean isOfItemType(ItemType type) {
    return delegate.isOfItemType(type);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:Metadata.java   
public static MetadataItemCondition withGroup(String name) {
    return new MetadataItemCondition(ItemType.GROUP, name);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:Metadata.java   
public static MetadataItemCondition withGroup(String name, Class<?> type) {
    return new MetadataItemCondition(ItemType.GROUP, name).ofType(type);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:Metadata.java   
public static MetadataItemCondition withGroup(String name, String type) {
    return new MetadataItemCondition(ItemType.GROUP, name).ofType(type);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:Metadata.java   
public static MetadataItemCondition withProperty(String name) {
    return new MetadataItemCondition(ItemType.PROPERTY, name);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:Metadata.java   
public static MetadataItemCondition withProperty(String name, Class<?> type) {
    return new MetadataItemCondition(ItemType.PROPERTY, name).ofType(type);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:Metadata.java   
public static MetadataItemCondition withProperty(String name, String type) {
    return new MetadataItemCondition(ItemType.PROPERTY, name).ofType(type);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:Metadata.java   
public MetadataItemCondition(ItemType itemType, String name) {
    this(itemType, name, null, null, null, null, null);
}
项目:spring-boot-concourse    文件:Metadata.java   
public static MetadataItemCondition withGroup(String name) {
    return new MetadataItemCondition(ItemType.GROUP, name);
}
项目:spring-boot-concourse    文件:Metadata.java   
public static MetadataItemCondition withGroup(String name, Class<?> type) {
    return new MetadataItemCondition(ItemType.GROUP, name).ofType(type);
}
项目:spring-boot-concourse    文件:Metadata.java   
public static MetadataItemCondition withGroup(String name, String type) {
    return new MetadataItemCondition(ItemType.GROUP, name).ofType(type);
}
项目:spring-boot-concourse    文件:Metadata.java   
public static MetadataItemCondition withProperty(String name) {
    return new MetadataItemCondition(ItemType.PROPERTY, name);
}
项目:spring-boot-concourse    文件:Metadata.java   
public static MetadataItemCondition withProperty(String name, Class<?> type) {
    return new MetadataItemCondition(ItemType.PROPERTY, name).ofType(type);
}
项目:spring-boot-concourse    文件:Metadata.java   
public static MetadataItemCondition withProperty(String name, String type) {
    return new MetadataItemCondition(ItemType.PROPERTY, name).ofType(type);
}
项目:spring-boot-concourse    文件:Metadata.java   
public MetadataItemCondition(ItemType itemType, String name) {
    this(itemType, name, null, null, null, null, null);
}
项目:contestparser    文件:ConfigurationMetadataMatchers.java   
public static ContainsItemMatcher containsGroup(String name) {
    return new ContainsItemMatcher(ItemType.GROUP, name);
}
项目:contestparser    文件:ConfigurationMetadataMatchers.java   
public static ContainsItemMatcher containsGroup(String name, Class<?> type) {
    return new ContainsItemMatcher(ItemType.GROUP, name).ofType(type);
}
项目:contestparser    文件:ConfigurationMetadataMatchers.java   
public static ContainsItemMatcher containsGroup(String name, String type) {
    return new ContainsItemMatcher(ItemType.GROUP, name).ofType(type);
}
项目:contestparser    文件:ConfigurationMetadataMatchers.java   
public static ContainsItemMatcher containsProperty(String name) {
    return new ContainsItemMatcher(ItemType.PROPERTY, name);
}
项目:contestparser    文件:ConfigurationMetadataMatchers.java   
public static ContainsItemMatcher containsProperty(String name, Class<?> type) {
    return new ContainsItemMatcher(ItemType.PROPERTY, name).ofType(type);
}
项目:contestparser    文件:ConfigurationMetadataMatchers.java   
public static ContainsItemMatcher containsProperty(String name, String type) {
    return new ContainsItemMatcher(ItemType.PROPERTY, name).ofType(type);
}
项目:contestparser    文件:ConfigurationMetadataMatchers.java   
public ContainsItemMatcher(ItemType itemType, String name) {
    this(itemType, name, null, null, null, null, null);
}