private static boolean isObject(ModelNode mn) { try { mn.asType(); } catch (IllegalArgumentException ex) { return true; } return false; }
protected ModelType asType(ModelNode type) { if(type == null) { return null; } try { return type.asType(); } catch(IllegalArgumentException e) { // the value type is a structure return null; } }
private static boolean isObject(ModelNode vt) { try { vt.asType(); } catch (Exception ex) { return true; } return false; }
protected ModelType asType(ModelNode type) { if(type == null) { return null; } try { return type.asType(); } catch(IllegalArgumentException e) { // the value type is a structure return null; } } }
protected ModelType asType(ModelNode type) { if(type == null) { return null; } try { return type.asType(); } catch(IllegalArgumentException e) { // the value type is a structure return null; } } }
private static boolean isObject(ModelNode vt) { try { vt.asType(); } catch (Exception ex) { return true; } return false; }
protected ModelType asType(ModelNode type) { if(type == null) { return null; } try { return type.asType(); } catch(IllegalArgumentException e) { // the value type is a structure return null; } }
protected ModelType getType(ModelNode descr) { if(!descr.has(Util.TYPE)) { return null; } try { return descr.get(Util.TYPE).asType(); } catch(IllegalArgumentException e) { // the value type is a structure return null; } }
private static boolean typeEquals(ModelNode mn, ModelType type) { ModelType mt; try { mt = mn.asType(); } catch (IllegalArgumentException ex) { return false; } return mt.equals(type); }
private static boolean typeEquals(ModelNode mn, ModelType type) { ModelType mt; try { mt = mn.asType(); } catch (IllegalArgumentException ex) { return false; } return mt.equals(type); }
@Override public boolean isValueRequired() { boolean required = true; ModelNode mn = prop.getValue().get("type"); if (mn != null) { // No value required for boolean required = mn.asType() != ModelType.BOOLEAN; } return required; }
@Override public boolean isValueRequired() { boolean required = true; ModelNode mn = prop.getValue().get("type"); if (mn != null) { // No value required for boolean required = mn.asType() != ModelType.BOOLEAN; } return required; }
private static ModelType getAdaptedArgumentType(ModelNode mn) { ModelType type = mn.get(Util.TYPE).asType(); if (mn.hasDefined(Util.FILESYSTEM_PATH) && mn.hasDefined(Util.ATTACHED_STREAMS)) { type = ModelType.STRING; } return type; }
private static ModelType getAdaptedArgumentType(ModelNode mn) { ModelType type = mn.get(Util.TYPE).asType(); if (mn.hasDefined(Util.FILESYSTEM_PATH) && mn.hasDefined(Util.ATTACHED_STREAMS)) { type = ModelType.STRING; } return type; }
private static String getAdaptedArgumentDescription(ModelNode mn) { String desc = mn.get(Util.DESCRIPTION).asString(); if (mn.hasDefined(Util.FILESYSTEM_PATH) && mn.hasDefined(Util.ATTACHED_STREAMS)) { desc = "The path to the file to attach." + " The CLI deals directly with file paths and doesn't " + "require index manipulation." + Config.getLineSeparator() + "NB: The actual argument type is " + mn.get(Util.TYPE).asType(); } return desc; }
private static String getAdaptedArgumentDescription(ModelNode mn) { String desc = mn.get(Util.DESCRIPTION).asString(); if (mn.hasDefined(Util.FILESYSTEM_PATH) && mn.hasDefined(Util.ATTACHED_STREAMS)) { desc = "The path to the file to attach." + " The CLI deals directly with file paths and doesn't " + "require index manipulation." + Config.getLineSeparator() + "NB: The actual argument type is " + mn.get(Util.TYPE).asType(); } return desc; }
public static SimpleAttributeDefinitionBuilder create(final String name, final ModelNode node) { ModelType type = node.get(ModelDescriptionConstants.TYPE).asType(); boolean nillable = node.get(ModelDescriptionConstants.NILLABLE).asBoolean(true); boolean expressionAllowed = node.get(ModelDescriptionConstants.EXPRESSIONS_ALLOWED).asBoolean(false); ModelNode defaultValue = nillable ? node.get(ModelDescriptionConstants.DEFAULT) : new ModelNode(); return SimpleAttributeDefinitionBuilder.create(name, type, nillable) .setDefaultValue(defaultValue) .setAllowExpression(expressionAllowed); }
public static SimpleAttributeDefinitionBuilder create(final String name, final ModelNode node) { ModelType type = node.get(ModelDescriptionConstants.TYPE).asType(); boolean nillable = node.get(ModelDescriptionConstants.NILLABLE).asBoolean(true); boolean expressionAllowed = node.get(ModelDescriptionConstants.EXPRESSIONS_ALLOWED).asBoolean(false); ModelNode defaultValue = nillable ? node.get(ModelDescriptionConstants.DEFAULT) : new ModelNode(); return SimpleAttributeDefinitionBuilder.create(name, type, nillable) .setDefaultValue(defaultValue) .setAllowExpression(expressionAllowed); }
public static SimpleAttributeDefinitionBuilder create(final String name, final ModelNode node) { ModelType type = node.get(ModelDescriptionConstants.TYPE).asType(); boolean nillable = node.get(ModelDescriptionConstants.NILLABLE).asBoolean(true); boolean expressionAllowed = node.get(ModelDescriptionConstants.EXPRESSIONS_ALLOWED).asBoolean(false); ModelNode defaultValue = node.get(ModelDescriptionConstants.DEFAULT); return SimpleAttributeDefinitionBuilder.create(name, type, nillable) .setDefaultValue(defaultValue) .setAllowExpression(expressionAllowed); }
public static SimpleAttributeDefinitionBuilder create(final String name, final ModelNode node) { ModelType type = node.get(ModelDescriptionConstants.TYPE).asType(); boolean nillable = node.get(ModelDescriptionConstants.NILLABLE).asBoolean(true); boolean expressionAllowed = node.get(ModelDescriptionConstants.EXPRESSIONS_ALLOWED).asBoolean(false); ModelNode defaultValue = node.get(ModelDescriptionConstants.DEFAULT); return SimpleAttributeDefinitionBuilder.create(name, type, nillable) .setDefaultValue(defaultValue) .setAllowExpression(expressionAllowed); }