PropertyDefinitionUsageBuilder.java revision a23343e9e4e0b555b1bcfa99a7455e0e28117a3d
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
* Portions Copyright 2014-2015 ForgeRock AS
*/
/**
* A property definition visitor which can be used to generate syntax
* usage information.
*/
public final class PropertyDefinitionUsageBuilder {
/**
* Underlying implementation.
*/
private class MyPropertyDefinitionVisitor extends
/**
* Flag indicating whether detailed syntax information will be
* generated.
*/
private final boolean isDetailed;
/** The formatter to use for numeric values. */
private final NumberFormat numberFormat;
/** Private constructor. */
private MyPropertyDefinitionVisitor(boolean isDetailed) {
this.isDetailed = isDetailed;
this.numberFormat.setGroupingUsed(true);
}
/** {@inheritDoc} */
public <C extends ConfigurationClient, S extends Configuration>
}
/** {@inheritDoc} */
Void p) {
}
/** {@inheritDoc} */
}
/** {@inheritDoc} */
if (isDetailed) {
} else {
}
}
/** {@inheritDoc} */
} else {
}
}
/** {@inheritDoc} */
} else {
}
}
/** {@inheritDoc} */
}
if (isDetailed) {
if (d.getUpperLimit() != null) {
}
if (d.isAllowUnlimited()) {
}
}
}
/** {@inheritDoc} */
Void p) {
if (!isDetailed) {
// Use the last word in the property name.
} else {
}
} else {
}
}
}
/** {@inheritDoc} */
if (isDetailed) {
}
if (isDetailed) {
if (d.getUpperLimit() != null) {
} else if (d.isAllowUnlimited()) {
}
}
}
/** {@inheritDoc} */
}
/** {@inheritDoc} */
Void p) {
}
/** {@inheritDoc} */
}
if (isDetailed) {
if (d.getUpperLimit() != null) {
long upperLimit = d.getUpperLimit();
// Quite often an upper limit is some power of 2 minus 1. In those
// cases lets use a "less than" relation rather than a "less than
// or equal to" relation. This will result in a much more readable
// quantity.
upperLimit += 1;
} else {
}
} else {
}
}
if (d.isAllowUnlimited()) {
}
}
}
/** {@inheritDoc} */
if (d.getPattern() != null) {
if (isDetailed) {
{
}
} else {
}
} else {
}
}
/** {@inheritDoc} */
throws PropertyException {
}
}
/** Underlying implementation. */
private final MyPropertyDefinitionVisitor pimpl;
/**
* Creates a new property usage builder.
*
* @param isDetailed
* Indicates whether or not the generated usage should
* contain detailed information such as constraints.
*/
public PropertyDefinitionUsageBuilder(boolean isDetailed) {
}
/**
* Generates the usage information for the provided property
* definition.
*
* @param pd
* The property definitions.
* @return Returns the usage information for the provided property
* definition.
*/
}
}