protoj.lang.InfoFeature Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of protoj-jdk6 Show documentation
Show all versions of protoj-jdk6 Show documentation
ProtoJ: the pure java build library with maximum dependencies
The newest version!
/**
* Copyright 2009 Ashley Williams
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You may
* obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package protoj.lang;
/**
* Provides support for reporting parent information such as help and
* versioning.
*
* @author Ashley Williams
*
*/
public final class InfoFeature {
/**
* See {@link #InfoFeature(StandardProject, String)}.
*/
private final StandardProject parent;
/**
* See {@link #InfoFeature(StandardProject, String)}.
*/
private final String versionInfo;
/**
* Accepts the owning parent and the information to be reported by
* {@link #reportVersion()},
*
* @param parent
* @param versionInfo
*/
public InfoFeature(StandardProject parent, String versionInfo) {
this.parent = parent;
this.versionInfo = versionInfo;
}
/**
* Reports general parent help information to stdout by iterating over the
* commands in the {@link CommandStore} and properties in the
* {@link PropertyStore} and using their descriptive properties.
*
*/
public void reportProjectHelp() {
ResourceFeature feature = parent.getResourceFeature();
String resourcePath = "/protoj-common/language/english/project.txt";
String text = feature.filterResourceToString(resourcePath);
System.out.println(text);
}
/**
* Reports help on the specified command to stdout.
*
* @param command
*/
public void reportCommandHelp(Command command) {
System.out.println(command.getHelpText());
}
/**
* Reports help on the specified property to stdout.
*
* @param property
*/
public void reportPropertyHelp(PropertyInfo property) {
System.out.println(property.getHelpText());
}
/**
* Reports version information to stdout.
*/
public void reportVersion() {
System.out.println(versionInfo);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy